summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-09-11 16:08:30 +1000
committerKristian Høgsberg <krh@bitplanet.net>2013-09-11 13:41:12 -0700
commit534f0a4dd1f55eafb132cd6942d007831e56c68a (patch)
treefc1e8848e328887119159c1fcda9276621c47d96 /tests
parentd8ca89017ce8f991380da008ad0bb8fe27e4938e (diff)
tests: support -h/--help for the tests
Including listing the tests available in that binary
Diffstat (limited to 'tests')
-rw-r--r--tests/weston-test-runner.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c
index 7cc1cbe5..fefb93bf 100644
--- a/tests/weston-test-runner.c
+++ b/tests/weston-test-runner.c
@@ -53,6 +53,16 @@ run_test(const struct weston_test *t)
exit(EXIT_SUCCESS);
}
+static void
+list_tests(void)
+{
+ const struct weston_test *t;
+
+ fprintf(stderr, "Available test names:\n");
+ for (t = &__start_test_section; t < &__stop_test_section; t++)
+ fprintf(stderr, " %s\n", t->name);
+}
+
int main(int argc, char *argv[])
{
const struct weston_test *t;
@@ -61,6 +71,14 @@ int main(int argc, char *argv[])
siginfo_t info;
if (argc == 2) {
+ const char *testname = argv[1];
+ if (strcmp(testname, "--help") == 0 ||
+ strcmp(testname, "-h") == 0) {
+ fprintf(stderr, "Usage: %s [test-name]\n", program_invocation_short_name);
+ list_tests();
+ exit(EXIT_SUCCESS);
+ }
+
t = find_test(argv[1]);
if (t == NULL) {
fprintf(stderr, "unknown test: \"%s\"\n", argv[1]);