summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2015-02-21 13:39:36 -0200
committerLucas De Marchi <lucas.demarchi@intel.com>2015-02-21 13:39:36 -0200
commitf6dc239ed2a4d1b6abd4e52976d558cdbb730d01 (patch)
tree3c124576c44c95bb04b83d8cd78fa371fe48dadc
parent03a5079f620982995ac1416540ba7e3c54121f7c (diff)
downloadkmod-f6dc239ed2a4d1b6abd4e52976d558cdbb730d01.tar.gz
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.
-rw-r--r--testsuite/testsuite.c6
-rw-r--r--testsuite/testsuite.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index 686f188..8512b56 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 9db1d1a..3bd74f3 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)));