diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2014-05-30 10:23:05 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2014-05-30 10:23:05 -0300 |
commit | d7293a1628ab14062cddb17d167fe094081a3221 (patch) | |
tree | 7b27d42746b153986f660916c5c85cf06fa96002 | |
parent | f429113a473ccf3f7d98a3b3e6d6c8b6b43af5d0 (diff) | |
download | kmod-d7293a1628ab14062cddb17d167fe094081a3221.tar.gz kmod-d7293a1628ab14062cddb17d167fe094081a3221.tar.bz2 kmod-d7293a1628ab14062cddb17d167fe094081a3221.zip |
testsuite: Fix expected_fail parsing
If a test has expected_fail=true, it means the return code must be
different from 0 *and* the outputs must match. This way it's possible to
check if the error messages are printed as they should.
-rw-r--r-- | testsuite/testsuite.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index fb9509b..9ccdcb7 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -782,19 +782,28 @@ static inline int test_run_parent(const struct test *t, int fdout[2], } else { if (err == 0) { if (matchout) { - LOG("%sUNEXPECTED PASS%s: %s\n", + ERR("%sUNEXPECTED PASS%s: exit with 0: %s\n", ANSI_HIGHLIGHT_RED_ON, ANSI_HIGHLIGHT_OFF, t->name); err = EXIT_FAILURE; - } else - LOG("%sEXPECTED FAIL%s: exit ok but outputs do not match: %s\n", - ANSI_HIGHLIGHT_GREEN_ON, ANSI_HIGHLIGHT_OFF, + } else { + ERR("%sUNEXPECTED PASS%s: exit with 0 and outputs do not match: %s\n", + ANSI_HIGHLIGHT_RED_ON, ANSI_HIGHLIGHT_OFF, t->name); + err = EXIT_FAILURE; + } } else { - ERR("%sEXPECTED FAIL%s: %s\n", + if (matchout) { + LOG("%sEXPECTED FAIL%s: %s\n", ANSI_HIGHLIGHT_GREEN_ON, ANSI_HIGHLIGHT_OFF, t->name); - err = EXIT_SUCCESS; + err = EXIT_SUCCESS; + } else { + LOG("%sEXPECTED FAIL%s: exit with %d but outputs do not match: %s\n", + ANSI_HIGHLIGHT_GREEN_ON, ANSI_HIGHLIGHT_OFF, + WEXITSTATUS(err), t->name); + err = EXIT_FAILURE; + } } } |