From f6dc239ed2a4d1b6abd4e52976d558cdbb730d01 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Sat, 21 Feb 2015 13:39:36 -0200 Subject: 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. --- testsuite/testsuite.c | 6 ++++++ testsuite/testsuite.h | 1 + 2 files changed, 7 insertions(+) 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))); -- cgit v1.2.1