[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Thu May 11 18:41:12 UTC 2017


The branch master has been updated
       via  46fcbf77bc6f2a287cb7266c58c204aa3960e456 (commit)
       via  b73c5e054a9211fb493b2733baa678c71750fe51 (commit)
      from  018fcbec38509cd03fb0709904a382c3bfcf5ed4 (commit)


- Log -----------------------------------------------------------------
commit 46fcbf77bc6f2a287cb7266c58c204aa3960e456
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu May 11 19:13:49 2017 +0200

    evp_test: use the test file name as the test title
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/3445)

commit b73c5e054a9211fb493b2733baa678c71750fe51
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu May 11 19:12:48 2017 +0200

    testutil: add the possibility to set the current test title
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/3445)

-----------------------------------------------------------------------

Summary of changes:
 test/evp_test.c        |  1 +
 test/testutil.h        |  1 +
 test/testutil/driver.c | 26 ++++++++++++++++++++++----
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/test/evp_test.c b/test/evp_test.c
index 8a52699..685db4e 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -2077,6 +2077,7 @@ static int do_test_file(const char *testfile)
     char buf[10240];
     EVP_TEST t;
 
+    set_test_title(testfile);
     current_test_file = testfile;
     if (!TEST_ptr(in = BIO_new_file(testfile, "rb")))
         return 0;
diff --git a/test/testutil.h b/test/testutil.h
index 8e4481e..d8acd73 100644
--- a/test/testutil.h
+++ b/test/testutil.h
@@ -140,6 +140,7 @@ void add_test(const char *test_case_name, int (*test_fn) ());
 void add_all_tests(const char *test_case_name, int (*test_fn)(int idx), int num,
                    int subtest);
 __owur int run_tests(const char *test_prog_name);
+void set_test_title(const char *title);
 
 /*
  * Declarations for user defined functions
diff --git a/test/testutil/driver.c b/test/testutil/driver.c
index 786bc38..660db7b 100644
--- a/test/testutil/driver.c
+++ b/test/testutil/driver.c
@@ -121,6 +121,13 @@ static void finalize(int success)
         ERR_print_errors_cb(openssl_error_cb, NULL);
 }
 
+static const char *test_title = NULL;
+
+void set_test_title(const char *title)
+{
+    test_title = title;
+}
+
 int run_tests(const char *test_prog_name)
 {
     int num_failed = 0;
@@ -139,7 +146,10 @@ int run_tests(const char *test_prog_name)
 
     for (i = 0; i != num_tests; ++i) {
         if (all_tests[i].num == -1) {
-            int ret = all_tests[i].test_fn();
+            int ret = 0;
+
+            set_test_title(all_tests[i].test_case_name);
+            ret = all_tests[i].test_fn();
 
             test_flush_stdout();
             test_flush_stderr();
@@ -150,7 +160,7 @@ int run_tests(const char *test_prog_name)
                 ++num_failed;
             }
             test_printf_stdout("%*s%s %d - %s\n", level, "", verdict, i + 1,
-                               all_tests[i].test_case_name);
+                               test_title);
             test_flush_stdout();
             finalize(ret);
         } else {
@@ -166,7 +176,10 @@ int run_tests(const char *test_prog_name)
             }
 
             for (j = 0; j < all_tests[i].num; j++) {
-                int ret = all_tests[i].param_test_fn(j);
+                int ret = 0;
+
+                set_test_title(NULL);
+                ret = all_tests[i].param_test_fn(j);
 
                 test_flush_stdout();
                 test_flush_stderr();
@@ -182,7 +195,12 @@ int run_tests(const char *test_prog_name)
                         verdict = "not ok";
                         ++num_failed_inner;
                     }
-                    test_printf_stdout("%*s%s %d\n", level, "", verdict, j + 1);
+                    if (test_title != NULL)
+                        test_printf_stdout("%*s%s %d - %s\n", level, "", verdict,
+                                           j + 1, test_title);
+                    else
+                        test_printf_stdout("%*s%s %d\n", level, "", verdict,
+                                           j + 1);
                     test_flush_stdout();
                 }
             }


More information about the openssl-commits mailing list