summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-25 07:16:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-26 23:51:42 +0100
commitbf4977b645270bb88225501e73848f7814cccead (patch)
tree3a4b2aa8809ab5e9a8d91d27da7a36ceacb8eaea /test
parent40aefac5d714bf7536632ed38c7a8ee05049f30b (diff)
[test] Exit on first failure '-x'
Add a command line option to the test suite to cause it to exit after the first failure. The purpose of this is for integration into 'git bisect run', where the failing test is unknown and we are looking for any failure. For example, for use in a regression script to find commits in the midst of as series that need a refresh of a reference image (or fixing!).
Diffstat (limited to 'test')
-rw-r--r--test/cairo-test-runner.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index cf1c0069e..f147b5b73 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -81,6 +81,7 @@ typedef struct _cairo_test_runner {
int *num_crashed_per_target;
cairo_bool_t foreground;
+ cairo_bool_t exit_on_failure;
cairo_bool_t list_only;
cairo_bool_t full_test;
} cairo_test_runner_t;
@@ -285,7 +286,7 @@ static void
usage (const char *argv0)
{
fprintf (stderr,
- "Usage: %s [-af] [test-names|keywords ...]\n"
+ "Usage: %s [-afx] [test-names|keywords ...]\n"
" %s -l\n"
"\n"
"Run the cairo conformance test suite over the given tests (all by default)\n"
@@ -294,6 +295,7 @@ usage (const char *argv0)
" -a all; run the full set of tests. By default the test suite\n"
" skips similar surface and device offset testing.\n"
" -f foreground; do not fork\n"
+ " -x exit on first failure\n"
" -l list only; just list selected test case names without executing\n"
"\n"
"If test names are given they are used as exact matches either to a specific\n"
@@ -308,7 +310,7 @@ _parse_cmdline (cairo_test_runner_t *runner, int *argc, char **argv[])
int c;
while (1) {
- c = _cairo_getopt (*argc, *argv, ":afl");
+ c = _cairo_getopt (*argc, *argv, ":aflx");
if (c == -1)
break;
@@ -322,6 +324,9 @@ _parse_cmdline (cairo_test_runner_t *runner, int *argc, char **argv[])
case 'f':
runner->foreground = TRUE;
break;
+ case 'x':
+ runner->exit_on_failure = TRUE;
+ break;
default:
fprintf (stderr, "Internal error: unhandled option: %c\n", c);
/* fall-through */
@@ -625,6 +630,9 @@ main (int argc, char **argv)
if (strstr (env, "foreground")) {
runner.foreground = TRUE;
}
+ if (strstr (env, "exit-on-failure")) {
+ runner.exit_on_failure = TRUE;
+ }
}
_parse_cmdline (&runner, &argc, &argv);
@@ -894,6 +902,9 @@ main (int argc, char **argv)
TEST_NEXT:
free (name);
+ if (runner.exit_on_failure && ! runner.passed)
+ break;
+
}
_list_free (tests);