unit-tests: Set test verbosity just after test suite loading

We see any plugin startup messages during suite configuration, where
initialization is called once to query plugin features. No need to be verbose
and show these messages once again in the first test.
This commit is contained in:
Martin Willi 2015-04-14 09:26:17 +02:00
parent 80469c2168
commit 432d712048

View File

@ -235,9 +235,6 @@ static bool call_fixture(test_case_t *tcase, bool up)
*/
static bool pre_test(test_runner_init_t init, char *cfg)
{
level_t level = LEVEL_SILENT;
char *verbosity;
library_init(cfg, "test-runner");
/* use non-blocking RNG to generate keys fast */
@ -260,12 +257,6 @@ static bool pre_test(test_runner_init_t init, char *cfg)
library_deinit();
return FALSE;
}
verbosity = getenv("TESTS_VERBOSITY");
if (verbosity)
{
level = atoi(verbosity);
}
dbg_default_set_level(level);
return TRUE;
}
@ -532,7 +523,8 @@ int test_runner_run(const char *name, test_configuration_t configs[],
test_suite_t *suite;
enumerator_t *enumerator;
int passed = 0, result;
char *cfg;
level_t level = LEVEL_SILENT;
char *cfg, *verbosity;
/* redirect all output to stderr (to redirect make's stdout to /dev/null) */
dup2(2, 1);
@ -545,6 +537,13 @@ int test_runner_run(const char *name, test_configuration_t configs[],
return EXIT_FAILURE;
}
verbosity = getenv("TESTS_VERBOSITY");
if (verbosity)
{
level = atoi(verbosity);
}
dbg_default_set_level(level);
fprintf(stderr, "Running %u '%s' test suites:\n", array_count(suites), name);
enumerator = array_create_enumerator(suites);