$ ./test/test-touchpad --filter-test="*1fg_tap*"
@endcode
+The `--filter-device` argument enables selective running of tests through
+basic shell-style device name matching. The device names matched are the
+litest-specific shortnames, see the output of `--list`. For example:
+
+@code
+$ ./test/test-touchpad --filter-device="synaptics*"
+@endcode
+
+The `--filter-device` argument can be combined with `--list` to show
+which devices will be affected.
+
@section test-verbosity Controlling test output
Each test supports the `--verbose` commandline option to enable debugging
static int in_debugger = -1;
static int verbose = 0;
const char *filter_test = NULL;
+const char *filter_device = NULL;
struct test {
struct list node;
struct test *t;
const char *test_name = "no device";
+ if (filter_device &&
+ fnmatch(filter_device, test_name, 0) != 0)
+ return;
+
list_for_each(t, &suite->tests, node) {
if (strcmp(t->name, test_name) != 0)
continue;
excluded == LITEST_DISABLE_DEVICE) {
litest_add_tcase_no_device(suite, func, range);
} else if (required != LITEST_ANY || excluded != LITEST_ANY) {
- while (*dev) {
- if (((*dev)->features & required) == required &&
- ((*dev)->features & excluded) == 0)
- litest_add_tcase_for_device(suite,
- funcname,
- func,
- *dev,
- range);
- dev++;
+ for (; *dev; dev++) {
+ if (filter_device &&
+ fnmatch(filter_device, (*dev)->shortname, 0) != 0)
+ continue;
+ if (((*dev)->features & required) != required ||
+ ((*dev)->features & excluded) != 0)
+ continue;
+
+ litest_add_tcase_for_device(suite,
+ funcname,
+ func,
+ *dev,
+ range);
}
} else {
- while (*dev) {
+ for (; *dev; dev++) {
+ if (filter_device &&
+ fnmatch(filter_device, (*dev)->shortname, 0) != 0)
+ continue;
+
litest_add_tcase_for_device(suite,
funcname,
func,
*dev,
range);
- dev++;
}
}
}
assert(type < LITEST_NO_DEVICE);
s = get_suite(name);
- while (*dev) {
+ for (; *dev; dev++) {
+ if (filter_device &&
+ fnmatch(filter_device, (*dev)->shortname, 0) != 0)
+ continue;
+
if ((*dev)->type == type) {
litest_add_tcase_for_device(s,
funcname,
range);
return;
}
- dev++;
}
ck_abort_msg("Invalid test device type");
{
enum {
OPT_FILTER_TEST,
+ OPT_FILTER_DEVICE,
OPT_LIST,
OPT_VERBOSE,
};
static const struct option opts[] = {
{ "filter-test", 1, 0, OPT_FILTER_TEST },
+ { "filter-device", 1, 0, OPT_FILTER_DEVICE },
{ "list", 0, 0, OPT_LIST },
{ "verbose", 0, 0, OPT_VERBOSE },
{ 0, 0, 0, 0}
case OPT_FILTER_TEST:
filter_test = optarg;
break;
+ case OPT_FILTER_DEVICE:
+ filter_device = optarg;
+ break;
case OPT_LIST:
litest_list_tests(&all_tests);
exit(0);