test: parse the LITEST_VERBOSE environment variable
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 19 May 2015 00:33:24 +0000 (10:33 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 19 May 2015 00:49:49 +0000 (10:49 +1000)
--verbose only works when running a specific test, sometimes we need make
check to be more verbose. Set this by default for make check, the log becomes
a lot more expressive that way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
doc/test-suite.dox
test/Makefile.am
test/litest.c

index 6e993e08ae0da347dc9c8091e516133afacb2f73..d2680d9f5ea7b035d9451dd685bcbd1ad8f36390 100644 (file)
@@ -63,4 +63,16 @@ $ CK_RUN_SUITE="device:wheel" CK_RUN_CASE="wheel only" ./test/test-device
 
 Check and litest currently do not provide a way to run a specific test
 function only.
+
+@section test-verbosity Controlling test output
+
+Each test supports the `--verbose` commandline option to enable debugging
+output, see libinput_log_set_priority() for details. The `LITEST_VERBOSE`
+environment variable, if set, also enables verbose mode.
+
+@code
+$ ./test/test-device --verbose
+$ LITEST_VERBOSE=1 make check
+@endcode
+
 */
index 0df89b2cf4aab707d5232a17078257d441a18bc6..46959fdfb690285ea4be84bce47052fbf881e31a 100644 (file)
@@ -118,6 +118,8 @@ test_build_linker_LDADD = $(top_builddir)/src/libinput.la $(top_builddir)/src/li
 test_build_cxx_SOURCES = build-cxx.cc
 test_build_cxx_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter $(AM_CXXFLAGS)
 
+AM_TESTS_ENVIRONMENT= LITEST_VERBOSE=1; export LITEST_VERBOSE;
+
 if HAVE_VALGRIND
 VALGRIND_FLAGS=--leak-check=full \
               --quiet \
index 2aac5a342586ee7d8577be6d0a44cd0c9228421f..9cc87740a70be2ab451d59e9d6aafb1b926ada16 100644 (file)
@@ -500,6 +500,9 @@ litest_run(int argc, char **argv) {
                }
        }
 
+       if (getenv("LITEST_VERBOSE"))
+               verbose = 1;
+
        srunner_run_all(sr, CK_ENV);
        failed = srunner_ntests_failed(sr);
        srunner_free(sr);