X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fhas_tests.c;h=bdfe49d56b8725389b279671052fd8356f499a06;hp=0a510a034629b62d10bffa5ab06b04cfb043b0c3;hb=2926cafb52b9d95646d9dafa877d53f2368d8b2c;hpb=a40b318e7a07a452ae7456053727bd11b2fa49b4 diff --git a/tools/ccanlint/tests/has_tests.c b/tools/ccanlint/tests/has_tests.c index 0a510a03..bdfe49d5 100644 --- a/tools/ccanlint/tests/has_tests.c +++ b/tools/ccanlint/tests/has_tests.c @@ -10,6 +10,8 @@ #include #include +extern struct ccanlint tests_exist; + static void handle_no_tests(struct manifest *m, struct score *score) { FILE *run; @@ -90,7 +92,7 @@ static void handle_no_tests(struct manifest *m, struct score *score) fclose(run); } -static void check_has_tests(struct manifest *m, +static void check_tests_exist(struct manifest *m, bool keep, unsigned int *timeleft, struct score *score) { @@ -101,7 +103,7 @@ static void check_has_tests(struct manifest *m, score->error = "No test directory"; if (errno != ENOENT) err(1, "statting %s", test_dir); - has_tests.handle = handle_no_tests; + tests_exist.handle = handle_no_tests; return; } @@ -115,7 +117,7 @@ static void check_has_tests(struct manifest *m, && list_empty(&m->compile_ok_tests)) { if (list_empty(&m->compile_fail_tests)) { score->error = "No tests in test directory"; - has_tests.handle = handle_no_tests; + tests_exist.handle = handle_no_tests; } else score->error = "No positive tests in test directory"; return; @@ -124,10 +126,11 @@ static void check_has_tests(struct manifest *m, score->score = score->total; } -struct ccanlint has_tests = { - .key = "has-tests", - .name = "Module has tests", - .check = check_has_tests, +struct ccanlint tests_exist = { + .key = "tests_exist", + .name = "Module has test directory with tests in it", + .check = check_tests_exist, + .needs = "" }; -REGISTER_TEST(has_tests, NULL); +REGISTER_TEST(tests_exist);