summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-12 13:40:17 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-06-12 14:06:06 +0100
commit53139261c7ba1a4cc0b869cb48c136b0362a3b0c (patch)
treeca15e25423b9d161120eef0c8dc7be12c4ec4225
parent97288b0859bae6cea1e3bff84b632e00f1d10917 (diff)
test: Use exact matching on test names by default.
Specifying individual tests to run is more common than using a group chosen from a keyword, so change the default matching mode and introduce '-k' to select by keyword.
-rw-r--r--test/cairo-test-runner.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index aa9e1013..0b0ac9c1 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -97,7 +97,7 @@ typedef struct _cairo_test_runner {
cairo_bool_t exit_on_failure;
cairo_bool_t list_only;
cairo_bool_t full_test;
- cairo_bool_t exact_test_names;
+ cairo_bool_t keyword_match;
cairo_bool_t force_pass;
} cairo_test_runner_t;
@@ -321,7 +321,7 @@ static void
usage (const char *argv0)
{
fprintf (stderr,
- "Usage: %s [-afxlt] [test-names|keywords ...]\n"
+ "Usage: %s [-afkxl] [test-names|keywords ...]\n"
" %s -l\n"
"\n"
"Run the cairo conformance test suite over the given tests (all by default)\n"
@@ -330,13 +330,14 @@ 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"
- " -t exact test names, no keyword matching\n"
+ " -k match tests by keyword\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 matches either to a specific\n"
"test case or to a keyword, so a command such as\n"
- "\"cairo-test-suite text\" can be used to run all text test cases.\n",
+ "\"cairo-test-suite -k text\" can be used to run all text test cases, and\n"
+ "\"cairo-test-suite text-transform\" to run the individual case.\n",
argv0, argv0);
}
@@ -363,8 +364,8 @@ _parse_cmdline (cairo_test_runner_t *runner, int *argc, char **argv[])
case 'x':
runner->exit_on_failure = TRUE;
break;
- case 't':
- runner->exact_test_names = TRUE;
+ case 'k':
+ runner->keyword_match = TRUE;
break;
default:
fprintf (stderr, "Internal error: unhandled option: %c\n", c);
@@ -760,23 +761,21 @@ main (int argc, char **argv)
if (invert)
match++;
- /* exact match on test name */
- if (strcmp (name, match) == 0) {
- found = ! invert;
- break;
- } else if (invert) {
- found = TRUE;
- }
-
- if (runner.exact_test_names)
- continue;
-
- /* XXX keyword match */
- if (keywords != NULL && strstr (keywords, match) != NULL) {
- found = ! invert;
- break;
- } else if (invert) {
- found = TRUE;
+ if (runner.keyword_match) {
+ if (keywords != NULL && strstr (keywords, match) != NULL) {
+ found = ! invert;
+ break;
+ } else if (invert) {
+ found = TRUE;
+ }
+ } else {
+ /* exact match on test name */
+ if (strcmp (name, match) == 0) {
+ found = ! invert;
+ break;
+ } else if (invert) {
+ found = TRUE;
+ }
}
}