diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | support/support_test_main.c | 11 | ||||
-rw-r--r-- | support/test-driver.c | 4 | ||||
-rw-r--r-- | support/test-driver.h | 6 | ||||
-rw-r--r-- | support/tst-support_record_failure-2.sh | 7 | ||||
-rw-r--r-- | support/tst-support_record_failure.c | 2 |
6 files changed, 35 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog index 7ab09eb21a..2938d872b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2016-12-31 Florian Weimer <fweimer@redhat.com> + * support/test-driver.h (TEST_DEFAULT_OPTIONS): Add --verbose. + (test_verbose): Declare. + * support/test-driver.c (main): Use TEST_DEFAULT_OPTIONS. + * support/support_test_main.c (default_options): Likewise. + (usage, support_test_main): Handle 'v'. + (test_verbose): Define. + * support/tst-support_record_failure.c (do_test): Use + test_verbose. + * support/tst-support_record_failure-2.sh (different_status): Add + --verbose test. + +2016-12-31 Florian Weimer <fweimer@redhat.com> + * support/check.h (FAIL_RET, FAIL_EXIT, FAIL_EXIT1): Document that test failures are recorded. * support/check.c (support_print_failure_impl): Call diff --git a/support/support_test_main.c b/support/support_test_main.c index 8d31e2f138..1c90986506 100644 --- a/support/support_test_main.c +++ b/support/support_test_main.c @@ -37,8 +37,7 @@ static const struct option default_options[] = { - { "direct", no_argument, NULL, OPT_DIRECT }, - { "test-dir", required_argument, NULL, OPT_TESTDIR }, + TEST_DEFAULT_OPTIONS { NULL, 0, NULL, 0 } }; @@ -67,6 +66,9 @@ usage (const struct option *options) printf ("%*s", 25 - indent, ""); switch (options[i].val) { + case 'v': + printf ("Increase the output verbosity"); + break; case OPT_DIRECT: printf ("Run the test directly (instead of forking & monitoring)"); break; @@ -164,7 +166,7 @@ run_test_function (int argc, char **argv, const struct test_config *config) static bool test_main_called; const char *test_dir = NULL; - +unsigned int test_verbose = 0; /* If test failure reporting has been linked in, it may contribute additional test failures. */ @@ -215,6 +217,9 @@ support_test_main (int argc, char **argv, const struct test_config *config) case '?': usage (options); exit (1); + case 'v': + ++test_verbose; + break; case OPT_DIRECT: direct = 1; break; diff --git a/support/test-driver.c b/support/test-driver.c index 3a61b7bf3f..a847c9647a 100644 --- a/support/test-driver.c +++ b/support/test-driver.c @@ -144,9 +144,7 @@ main (int argc, char **argv) struct option options[] = { CMDLINE_OPTIONS - { "direct", no_argument, NULL, OPT_DIRECT }, - { "test-dir", required_argument, NULL, OPT_TESTDIR }, - { NULL, 0, NULL, 0 } + TEST_DEFAULT_OPTIONS }; test_config.options = &options; #endif diff --git a/support/test-driver.h b/support/test-driver.h index 7787e9c4ff..f3f5c176dc 100644 --- a/support/test-driver.h +++ b/support/test-driver.h @@ -55,12 +55,18 @@ enum /* Options provided by the test driver. */ #define TEST_DEFAULT_OPTIONS \ + { "verbose", no_argument, NULL, 'v' }, \ { "direct", no_argument, NULL, OPT_DIRECT }, \ { "test-dir", required_argument, NULL, OPT_TESTDIR }, \ /* The directory the test should use for temporary files. */ extern const char *test_dir; +/* The number of --verbose arguments specified during program + invocation. This variable can be used to control the verbosity of + tests. */ +extern unsigned int test_verbose; + int support_test_main (int argc, char **argv, const struct test_config *); __END_DECLS diff --git a/support/tst-support_record_failure-2.sh b/support/tst-support_record_failure-2.sh index a96a60d310..6fffd8a9d5 100644 --- a/support/tst-support_record_failure-2.sh +++ b/support/tst-support_record_failure-2.sh @@ -54,13 +54,16 @@ different_status () { run_test 1 "error: 1 test failures" $direct --status=77 run_test 2 "error: tst-support_record_failure.c:108: not true: false error: 1 test failures" $direct --test-verify + run_test 2 "error: tst-support_record_failure.c:108: not true: false +info: execution passed failed TEST_VERIFY +error: 1 test failures" $direct --test-verify --verbose } different_status different_status --direct -run_test 1 "error: tst-support_record_failure.c:113: not true: false +run_test 1 "error: tst-support_record_failure.c:115: not true: false error: 1 test failures" --test-verify-exit # --direct does not print the summary error message if exit is called. -run_test 1 "error: tst-support_record_failure.c:113: not true: false" \ +run_test 1 "error: tst-support_record_failure.c:115: not true: false" \ --direct --test-verify-exit diff --git a/support/tst-support_record_failure.c b/support/tst-support_record_failure.c index a999f7075c..75dd10f1c5 100644 --- a/support/tst-support_record_failure.c +++ b/support/tst-support_record_failure.c @@ -106,6 +106,8 @@ do_test (void) if (test_verify) { TEST_VERIFY (false); + if (test_verbose) + printf ("info: execution passed failed TEST_VERIFY\n"); return 2; /* Expected exit status. */ } if (test_verify_exit) |