]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
unit-tests: Add an option to increase the verbosity when running tests
authorTobias Brunner <tobias@strongswan.org>
Fri, 14 Mar 2014 08:41:50 +0000 (09:41 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 20 Mar 2014 14:49:05 +0000 (15:49 +0100)
The TESTS_VERBOSITY option takes an integer from -1 to 4 that sets the
default debug level.

src/libstrongswan/tests/test_runner.c

index 0b8830df48f3d3abe465acdfdd746cbde421b3f6..6bb1b290cf652fdda4a30a3dbd87298008e5b123 100644 (file)
@@ -228,6 +228,9 @@ static bool call_fixture(test_case_t *tcase, bool up)
  */
 static bool pre_test(test_runner_init_t init)
 {
+       level_t level = LEVEL_SILENT;
+       char *verbosity;
+
        library_init(NULL, "test-runner");
 
        /* use non-blocking RNG to generate keys fast */
@@ -250,7 +253,12 @@ static bool pre_test(test_runner_init_t init)
                library_deinit();
                return FALSE;
        }
-       dbg_default_set_level(LEVEL_SILENT);
+       verbosity = getenv("TESTS_VERBOSITY");
+       if (verbosity)
+       {
+               level = atoi(verbosity);
+       }
+       dbg_default_set_level(level);
        return TRUE;
 }