testsuite: add option to copy output from test
authorLucas De Marchi <lucas.demarchi@intel.com>
Sat, 21 Feb 2015 15:39:36 +0000 (13:39 -0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Sat, 21 Feb 2015 15:39:36 +0000 (13:39 -0200)
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
testsuite/testsuite.h

index 686f188..8512b56 100644 (file)
@@ -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");
index 9db1d1a..3bd74f3 100644 (file)
@@ -102,6 +102,7 @@ struct test {
        const struct keyval *env_vars;
        bool need_spawn;
        bool expected_fail;
+       bool print_outputs;
 } __attribute__((aligned(8)));