]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: Fix expected_fail parsing
authorLucas De Marchi <lucas.demarchi@intel.com>
Fri, 30 May 2014 13:23:05 +0000 (10:23 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Fri, 30 May 2014 13:23:05 +0000 (10:23 -0300)
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.

testsuite/testsuite.c

index fb9509b8abe0646ffe8b4c53efbc20ba1002e19b..9ccdcb78352c7ca60eae66f0e693e28ce207b28b 100644 (file)
@@ -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;
+                       }
                }
        }