From: Lucas De Marchi Date: Sat, 21 Feb 2015 15:39:36 +0000 (-0200) Subject: testsuite: add option to copy output from test X-Git-Tag: v20~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f6dc239ed2a4d1b6abd4e52976d558cdbb730d01;p=thirdparty%2Fkmod.git testsuite: add option to copy output from test This is helpful while debugging the tests: copy the output from test (both stdout and stderr) to the stdout of the parent process. --- diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index 686f188b..8512b560 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -423,6 +423,12 @@ static inline bool test_run_parent_check_outputs(const struct test *t, buf[r] = '\0'; bufmatch[r] = '\0'; + + if (t->print_outputs) + printf("%s: %s\n", + fd_match == fd_matchout ? "STDOUT:" : "STDERR:", + buf); + if (!streq(buf, bufmatch)) { ERR("Outputs do not match on %s:\n", fd_match == fd_matchout ? "STDOUT" : "STDERR"); diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h index 9db1d1ab..3bd74f34 100644 --- a/testsuite/testsuite.h +++ b/testsuite/testsuite.h @@ -102,6 +102,7 @@ struct test { const struct keyval *env_vars; bool need_spawn; bool expected_fail; + bool print_outputs; } __attribute__((aligned(8)));