From: Lucas De Marchi Date: Fri, 30 May 2014 13:23:05 +0000 (-0300) Subject: testsuite: Fix expected_fail parsing X-Git-Tag: v18~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d7293a1628ab14062cddb17d167fe094081a3221;p=thirdparty%2Fkmod.git 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. --- diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index fb9509b8..9ccdcb78 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; + } } }