mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 06:50:05 +01:00
test: fix --list for the tests
The argument worked, but the test list was empty since b2fd428f96.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8bb67c2550
commit
602bca6977
1 changed files with 33 additions and 20 deletions
|
|
@ -696,20 +696,6 @@ is_debugger_attached(void)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
litest_list_tests(struct list *tests)
|
|
||||||
{
|
|
||||||
struct suite *s;
|
|
||||||
|
|
||||||
list_for_each(s, tests, node) {
|
|
||||||
struct test *t;
|
|
||||||
printf("%s:\n", s->name);
|
|
||||||
list_for_each(t, &s->tests, node) {
|
|
||||||
printf(" %s\n", t->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
litest_log_handler(struct libinput *libinput,
|
litest_log_handler(struct libinput *libinput,
|
||||||
enum libinput_log_priority pri,
|
enum libinput_log_priority pri,
|
||||||
|
|
@ -2155,7 +2141,13 @@ litest_semi_mt_touch_up(struct litest_device *d,
|
||||||
litest_event(d, EV_SYN, SYN_REPORT, 0);
|
litest_event(d, EV_SYN, SYN_REPORT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
enum litest_mode {
|
||||||
|
LITEST_MODE_ERROR,
|
||||||
|
LITEST_MODE_TEST,
|
||||||
|
LITEST_MODE_LIST,
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline enum litest_mode
|
||||||
litest_parse_argv(int argc, char **argv)
|
litest_parse_argv(int argc, char **argv)
|
||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -2192,31 +2184,52 @@ litest_parse_argv(int argc, char **argv)
|
||||||
filter_group = optarg;
|
filter_group = optarg;
|
||||||
break;
|
break;
|
||||||
case OPT_LIST:
|
case OPT_LIST:
|
||||||
litest_list_tests(&all_tests);
|
return LITEST_MODE_LIST;
|
||||||
exit(0);
|
|
||||||
case OPT_VERBOSE:
|
case OPT_VERBOSE:
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "usage: %s [--list]\n", argv[0]);
|
fprintf(stderr, "usage: %s [--list]\n", argv[0]);
|
||||||
return 1;
|
return LITEST_MODE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return LITEST_MODE_TEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef LITEST_NO_MAIN
|
#ifndef LITEST_NO_MAIN
|
||||||
|
static void
|
||||||
|
litest_list_tests(struct list *tests)
|
||||||
|
{
|
||||||
|
struct suite *s;
|
||||||
|
|
||||||
|
list_for_each(s, tests, node) {
|
||||||
|
struct test *t;
|
||||||
|
printf("%s:\n", s->name);
|
||||||
|
list_for_each(t, &s->tests, node) {
|
||||||
|
printf(" %s\n", t->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
enum litest_mode mode;
|
||||||
|
|
||||||
list_init(&all_tests);
|
list_init(&all_tests);
|
||||||
|
|
||||||
if (litest_parse_argv(argc, argv) != 0)
|
mode = litest_parse_argv(argc, argv);
|
||||||
|
if (mode == LITEST_MODE_ERROR)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
litest_setup_tests();
|
litest_setup_tests();
|
||||||
|
|
||||||
|
if (mode == LITEST_MODE_LIST) {
|
||||||
|
litest_list_tests(&all_tests);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
return litest_run(argc, argv);
|
return litest_run(argc, argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue