From 085a7bdd4be113035b0b2810d384c8974d25a787 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Fri, 21 Jul 2023 05:45:31 +0100 Subject: [PATCH] runtests: check if run.us file exists --- test/runtests.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/runtests.c b/test/runtests.c index f53c457..3eabbba 100644 --- a/test/runtests.c +++ b/test/runtests.c @@ -39,7 +39,8 @@ _Thread_local char outfname[PATH_MAX]; int silent_success = 1; static int -is_valid_test_name(const char *name) { +is_valid_test(const char *name) { + // Check that name starts with t\d\d\d if (name[0] != 't') { return 0; } @@ -48,7 +49,13 @@ is_valid_test_name(const char *name) { return 0; } } - return 1; + // Check that run.us file exists + sprintf(reffname, "%s/%s", name, "run.us"); + FILE *f = fopen(reffname, "rb"); + if (f) { + fclose(f); + } + return f != NULL; } static int @@ -244,7 +251,7 @@ thread_run_test(void *arg) { break; } const char *testname = dent->d_name; - if (!is_valid_test_name(testname)) { + if (!is_valid_test(testname)) { continue; } fprintf(stderr, "running test %s\n", testname);