mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-28 07:30:12 +01:00
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.
This commit is contained in:
parent
97288b0859
commit
53139261c7
1 changed files with 22 additions and 23 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue