From 3623b56060a97ba5ae6e4ba25db127e58ad0e6be Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 4 Jun 2024 12:43:35 +0200 Subject: executor: allow to run a single test --- executor/executor.cc | 4 ++-- executor/test.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'executor') diff --git a/executor/executor.cc b/executor/executor.cc index 6d39b4230..2c73c20dd 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -447,8 +447,8 @@ int main(int argc, char** argv) #endif return 0; } - if (argc == 2 && strcmp(argv[1], "test") == 0) - return run_tests(); + if (argc >= 2 && strcmp(argv[1], "test") == 0) + return run_tests(argc == 3 ? argv[2] : nullptr); if (argc < 2 || strcmp(argv[1], "exec") != 0) { fprintf(stderr, "unknown command"); diff --git a/executor/test.h b/executor/test.h index d2b0d4b94..bb1291f97 100644 --- a/executor/test.h +++ b/executor/test.h @@ -247,11 +247,13 @@ static struct { {"test_coverage_filter", test_coverage_filter}, }; -static int run_tests() +static int run_tests(const char* test) { int ret = 0; for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { const char* name = tests[i].name; + if (test && strcmp(test, name)) + continue; printf("=== RUN %s\n", name); int res = tests[i].f(); ret |= res > 0; -- cgit mrf-deployment