Commit 2926cafb authored by Rusty Russell's avatar Rusty Russell

ccanlint: rename structures to match keys

parent 016a19d2
...@@ -73,7 +73,7 @@ static void do_build(struct manifest *m, ...@@ -73,7 +73,7 @@ static void do_build(struct manifest *m,
score->score = score->total; score->score = score->total;
} }
struct ccanlint build = { struct ccanlint module_builds = {
.key = "module_builds", .key = "module_builds",
.name = "Module can be built from object files", .name = "Module can be built from object files",
.check = do_build, .check = do_build,
...@@ -81,4 +81,4 @@ struct ccanlint build = { ...@@ -81,4 +81,4 @@ struct ccanlint build = {
.needs = "objects_build" .needs = "objects_build"
}; };
REGISTER_TEST(build); REGISTER_TEST(module_builds);
...@@ -57,7 +57,7 @@ static void check_objs_build(struct manifest *m, ...@@ -57,7 +57,7 @@ static void check_objs_build(struct manifest *m,
} }
} }
struct ccanlint build_objs = { struct ccanlint objects_build = {
.key = "objects_build", .key = "objects_build",
.name = "Module object files can be built", .name = "Module object files can be built",
.check = check_objs_build, .check = check_objs_build,
...@@ -65,4 +65,4 @@ struct ccanlint build_objs = { ...@@ -65,4 +65,4 @@ struct ccanlint build_objs = {
.needs = "depends_exist" .needs = "depends_exist"
}; };
REGISTER_TEST(build_objs); REGISTER_TEST(objects_build);
...@@ -83,7 +83,7 @@ static void check_use_build(struct manifest *m, ...@@ -83,7 +83,7 @@ static void check_use_build(struct manifest *m,
} }
} }
struct ccanlint check_build = { struct ccanlint module_links = {
.key = "module_links", .key = "module_links",
.name = "Module can be linked against trivial program", .name = "Module can be linked against trivial program",
.check = check_use_build, .check = check_use_build,
...@@ -91,4 +91,4 @@ struct ccanlint check_build = { ...@@ -91,4 +91,4 @@ struct ccanlint check_build = {
.needs = "module_builds depends_build" .needs = "module_builds depends_build"
}; };
REGISTER_TEST(check_build); REGISTER_TEST(module_links);
...@@ -100,7 +100,7 @@ static void check_depends_built(struct manifest *m, ...@@ -100,7 +100,7 @@ static void check_depends_built(struct manifest *m,
score->score = score->total; score->score = score->total;
} }
struct ccanlint depends_built = { struct ccanlint depends_build = {
.key = "depends_build", .key = "depends_build",
.name = "Module's CCAN dependencies can be found or built", .name = "Module's CCAN dependencies can be found or built",
.check = check_depends_built, .check = check_depends_built,
...@@ -108,4 +108,4 @@ struct ccanlint depends_built = { ...@@ -108,4 +108,4 @@ struct ccanlint depends_built = {
.needs = "depends_exist" .needs = "depends_exist"
}; };
REGISTER_TEST(depends_built); REGISTER_TEST(depends_build);
...@@ -67,7 +67,7 @@ static void check_includes_build(struct manifest *m, ...@@ -67,7 +67,7 @@ static void check_includes_build(struct manifest *m,
} }
} }
struct ccanlint includes_build = { struct ccanlint main_header_compiles = {
.key = "main_header_compiles", .key = "main_header_compiles",
.name = "Modules main header compiles", .name = "Modules main header compiles",
.check = check_includes_build, .check = check_includes_build,
...@@ -75,4 +75,4 @@ struct ccanlint includes_build = { ...@@ -75,4 +75,4 @@ struct ccanlint includes_build = {
.needs = "depends_exist main_header_exists" .needs = "depends_exist main_header_exists"
}; };
REGISTER_TEST(includes_build); REGISTER_TEST(main_header_compiles);
...@@ -74,7 +74,7 @@ static void create_info_template(struct manifest *m, struct score *score) ...@@ -74,7 +74,7 @@ static void create_info_template(struct manifest *m, struct score *score)
fclose(info); fclose(info);
} }
struct ccanlint has_info = { struct ccanlint info_exists = {
.key = "info_exists", .key = "info_exists",
.name = "Module has _info file", .name = "Module has _info file",
.check = check_has_info, .check = check_has_info,
...@@ -82,4 +82,4 @@ struct ccanlint has_info = { ...@@ -82,4 +82,4 @@ struct ccanlint has_info = {
.needs = "" .needs = ""
}; };
REGISTER_TEST(has_info); REGISTER_TEST(info_exists);
...@@ -33,11 +33,11 @@ static void check_has_main_header(struct manifest *m, ...@@ -33,11 +33,11 @@ static void check_has_main_header(struct manifest *m,
m->basename, m->basename); m->basename, m->basename);
} }
struct ccanlint has_main_header = { struct ccanlint main_header_exists = {
.key = "main_header_exists", .key = "main_header_exists",
.name = "Module has main header file", .name = "Module has main header file",
.check = check_has_main_header, .check = check_has_main_header,
.needs = "" .needs = ""
}; };
REGISTER_TEST(has_main_header); REGISTER_TEST(main_header_exists);
...@@ -142,7 +142,7 @@ static void do_compile_coverage_tests(struct manifest *m, ...@@ -142,7 +142,7 @@ static void do_compile_coverage_tests(struct manifest *m,
} }
} }
struct ccanlint compile_coverage_tests = { struct ccanlint tests_compile_coverage = {
.key = "tests_compile_coverage", .key = "tests_compile_coverage",
.name = "Module tests compile with " COVERAGE_CFLAGS, .name = "Module tests compile with " COVERAGE_CFLAGS,
.check = do_compile_coverage_tests, .check = do_compile_coverage_tests,
...@@ -150,4 +150,4 @@ struct ccanlint compile_coverage_tests = { ...@@ -150,4 +150,4 @@ struct ccanlint compile_coverage_tests = {
.needs = "tests_compile" .needs = "tests_compile"
}; };
REGISTER_TEST(compile_coverage_tests); REGISTER_TEST(tests_compile_coverage);
...@@ -64,7 +64,7 @@ static void do_compile_test_helpers(struct manifest *m, ...@@ -64,7 +64,7 @@ static void do_compile_test_helpers(struct manifest *m,
} }
} }
struct ccanlint compile_test_helpers = { struct ccanlint tests_helpers_compile = {
.key = "tests_helpers_compile", .key = "tests_helpers_compile",
.name = "Module test helper objects compile", .name = "Module test helper objects compile",
.check = do_compile_test_helpers, .check = do_compile_test_helpers,
...@@ -72,4 +72,4 @@ struct ccanlint compile_test_helpers = { ...@@ -72,4 +72,4 @@ struct ccanlint compile_test_helpers = {
.needs = "depends_build tests_exist" .needs = "depends_build tests_exist"
}; };
REGISTER_TEST(compile_test_helpers); REGISTER_TEST(tests_helpers_compile);
...@@ -130,7 +130,7 @@ static void do_compile_tests(struct manifest *m, ...@@ -130,7 +130,7 @@ static void do_compile_tests(struct manifest *m,
score->score = 1 + !warnings; score->score = 1 + !warnings;
} }
struct ccanlint compile_tests = { struct ccanlint tests_compile = {
.key = "tests_compile", .key = "tests_compile",
.name = "Module tests compile", .name = "Module tests compile",
.check = do_compile_tests, .check = do_compile_tests,
...@@ -138,4 +138,4 @@ struct ccanlint compile_tests = { ...@@ -138,4 +138,4 @@ struct ccanlint compile_tests = {
.needs = "tests_helpers_compile objects_build" .needs = "tests_helpers_compile objects_build"
}; };
REGISTER_TEST(compile_tests); REGISTER_TEST(tests_compile);
...@@ -109,11 +109,11 @@ static void extract_examples(struct manifest *m, ...@@ -109,11 +109,11 @@ static void extract_examples(struct manifest *m,
score->pass = score->score != 0; score->pass = score->score != 0;
} }
struct ccanlint has_examples = { struct ccanlint examples_exist = {
.key = "examples_exist", .key = "examples_exist",
.name = "_info and main header file have Example: sections", .name = "_info and main header file have Example: sections",
.check = extract_examples, .check = extract_examples,
.needs = "info_exists" .needs = "info_exists"
}; };
REGISTER_TEST(has_examples); REGISTER_TEST(examples_exist);
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <ccan/noerr/noerr.h> #include <ccan/noerr/noerr.h>
#include <ccan/grab_file/grab_file.h> #include <ccan/grab_file/grab_file.h>
extern struct ccanlint has_info_documentation; extern struct ccanlint info_documentation_exists;
static void create_info_template_doc(struct manifest *m, struct score *score) static void create_info_template_doc(struct manifest *m, struct score *score)
{ {
...@@ -58,7 +58,7 @@ static void create_info_template_doc(struct manifest *m, struct score *score) ...@@ -58,7 +58,7 @@ static void create_info_template_doc(struct manifest *m, struct score *score)
} }
} }
static void check_has_info_documentation(struct manifest *m, static void check_info_documentation_exists(struct manifest *m,
bool keep, bool keep,
unsigned int *timeleft, unsigned int *timeleft,
struct score *score) struct score *score)
...@@ -83,7 +83,7 @@ static void check_has_info_documentation(struct manifest *m, ...@@ -83,7 +83,7 @@ static void check_has_info_documentation(struct manifest *m,
score->error = "_info file has no module documentation.\n\n" score->error = "_info file has no module documentation.\n\n"
"CCAN modules use /**-style comments for documentation: the\n" "CCAN modules use /**-style comments for documentation: the\n"
"overall documentation belongs in the _info metafile.\n"; "overall documentation belongs in the _info metafile.\n";
has_info_documentation.handle = create_info_template_doc; info_documentation_exists.handle = create_info_template_doc;
} else if (!description) { } else if (!description) {
score->error = "_info file has no module description.\n\n" score->error = "_info file has no module description.\n\n"
"The lines after the first summary line in the _info file\n" "The lines after the first summary line in the _info file\n"
...@@ -92,11 +92,11 @@ static void check_has_info_documentation(struct manifest *m, ...@@ -92,11 +92,11 @@ static void check_has_info_documentation(struct manifest *m,
} }
} }
struct ccanlint has_info_documentation = { struct ccanlint info_documentation_exists = {
.key = "info_documentation_exists", .key = "info_documentation_exists",
.name = "Module has documentation in _info", .name = "Module has documentation in _info",
.check = check_has_info_documentation, .check = check_info_documentation_exists,
.needs = "info_exists" .needs = "info_exists"
}; };
REGISTER_TEST(has_info_documentation); REGISTER_TEST(info_documentation_exists);
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <err.h> #include <err.h>
#include <ccan/talloc/talloc.h> #include <ccan/talloc/talloc.h>
extern struct ccanlint has_tests; extern struct ccanlint tests_exist;
static void handle_no_tests(struct manifest *m, struct score *score) static void handle_no_tests(struct manifest *m, struct score *score)
{ {
...@@ -92,7 +92,7 @@ static void handle_no_tests(struct manifest *m, struct score *score) ...@@ -92,7 +92,7 @@ static void handle_no_tests(struct manifest *m, struct score *score)
fclose(run); fclose(run);
} }
static void check_has_tests(struct manifest *m, static void check_tests_exist(struct manifest *m,
bool keep, bool keep,
unsigned int *timeleft, struct score *score) unsigned int *timeleft, struct score *score)
{ {
...@@ -103,7 +103,7 @@ static void check_has_tests(struct manifest *m, ...@@ -103,7 +103,7 @@ static void check_has_tests(struct manifest *m,
score->error = "No test directory"; score->error = "No test directory";
if (errno != ENOENT) if (errno != ENOENT)
err(1, "statting %s", test_dir); err(1, "statting %s", test_dir);
has_tests.handle = handle_no_tests; tests_exist.handle = handle_no_tests;
return; return;
} }
...@@ -117,7 +117,7 @@ static void check_has_tests(struct manifest *m, ...@@ -117,7 +117,7 @@ static void check_has_tests(struct manifest *m,
&& list_empty(&m->compile_ok_tests)) { && list_empty(&m->compile_ok_tests)) {
if (list_empty(&m->compile_fail_tests)) { if (list_empty(&m->compile_fail_tests)) {
score->error = "No tests in test directory"; score->error = "No tests in test directory";
has_tests.handle = handle_no_tests; tests_exist.handle = handle_no_tests;
} else } else
score->error = "No positive tests in test directory"; score->error = "No positive tests in test directory";
return; return;
...@@ -126,11 +126,11 @@ static void check_has_tests(struct manifest *m, ...@@ -126,11 +126,11 @@ static void check_has_tests(struct manifest *m,
score->score = score->total; score->score = score->total;
} }
struct ccanlint has_tests = { struct ccanlint tests_exist = {
.key = "tests_exist", .key = "tests_exist",
.name = "Module has test directory with tests in it", .name = "Module has test directory with tests in it",
.check = check_has_tests, .check = check_tests_exist,
.needs = "" .needs = ""
}; };
REGISTER_TEST(has_tests); REGISTER_TEST(tests_exist);
...@@ -193,7 +193,7 @@ static void check_idempotent(struct manifest *m, ...@@ -193,7 +193,7 @@ static void check_idempotent(struct manifest *m,
} }
} }
struct ccanlint idempotent = { struct ccanlint headers_idempotent = {
.key = "headers_idempotent", .key = "headers_idempotent",
.name = "Module headers are #ifndef/#define wrapped", .name = "Module headers are #ifndef/#define wrapped",
.check = check_idempotent, .check = check_idempotent,
...@@ -201,4 +201,4 @@ struct ccanlint idempotent = { ...@@ -201,4 +201,4 @@ struct ccanlint idempotent = {
.needs = "" .needs = ""
}; };
REGISTER_TEST(idempotent); REGISTER_TEST(headers_idempotent);
...@@ -149,11 +149,11 @@ static void check_has_license(struct manifest *m, ...@@ -149,11 +149,11 @@ static void check_has_license(struct manifest *m,
score->score = score->total; score->score = score->total;
} }
struct ccanlint has_license = { struct ccanlint license_exists = {
.key = "license_exists", .key = "license_exists",
.name = "Module has License: entry in _info, and LICENSE symlink/file", .name = "Module has License: entry in _info, and LICENSE symlink/file",
.check = check_has_license, .check = check_has_license,
.needs = "info_exists" .needs = "info_exists"
}; };
REGISTER_TEST(has_license); REGISTER_TEST(license_exists);
...@@ -162,11 +162,11 @@ static void do_run_coverage_tests(struct manifest *m, ...@@ -162,11 +162,11 @@ static void do_run_coverage_tests(struct manifest *m,
analyze_coverage(m, full_gcov, cmdout, score); analyze_coverage(m, full_gcov, cmdout, score);
} }
struct ccanlint run_coverage_tests = { struct ccanlint tests_coverage = {
.key = "tests_coverage", .key = "tests_coverage",
.name = "Module's tests cover all the code", .name = "Module's tests cover all the code",
.check = do_run_coverage_tests, .check = do_run_coverage_tests,
.needs = "tests_compile_coverage tests_pass" .needs = "tests_compile_coverage tests_pass"
}; };
REGISTER_TEST(run_coverage_tests); REGISTER_TEST(tests_coverage);
...@@ -65,7 +65,7 @@ static void run_under_debugger(struct manifest *m, struct score *score) ...@@ -65,7 +65,7 @@ static void run_under_debugger(struct manifest *m, struct score *score)
doesnt_matter(); doesnt_matter();
} }
struct ccanlint run_tests = { struct ccanlint tests_pass = {
.key = "tests_pass", .key = "tests_pass",
.name = "Module's run and api tests pass", .name = "Module's run and api tests pass",
.check = do_run_tests, .check = do_run_tests,
...@@ -74,4 +74,4 @@ struct ccanlint run_tests = { ...@@ -74,4 +74,4 @@ struct ccanlint run_tests = {
.needs = "tests_compile" .needs = "tests_compile"
}; };
REGISTER_TEST(run_tests); REGISTER_TEST(tests_pass);
...@@ -179,7 +179,7 @@ static void run_under_debugger_vg(struct manifest *m, struct score *score) ...@@ -179,7 +179,7 @@ static void run_under_debugger_vg(struct manifest *m, struct score *score)
doesnt_matter(); doesnt_matter();
} }
struct ccanlint run_tests_vg = { struct ccanlint tests_pass_valgrind = {
.key = "tests_pass_valgrind", .key = "tests_pass_valgrind",
.name = "Module's run and api tests succeed under valgrind", .name = "Module's run and api tests succeed under valgrind",
.can_run = can_run_vg, .can_run = can_run_vg,
...@@ -189,13 +189,13 @@ struct ccanlint run_tests_vg = { ...@@ -189,13 +189,13 @@ struct ccanlint run_tests_vg = {
.needs = "tests_pass" .needs = "tests_pass"
}; };
REGISTER_TEST(run_tests_vg); REGISTER_TEST(tests_pass_valgrind);
struct ccanlint run_tests_vg_leak = { struct ccanlint tests_pass_valgrind_noleaks = {
.key = "tests_pass_valgrind_noleaks", .key = "tests_pass_valgrind_noleaks",
.name = "Module's run and api tests leak memory", .name = "Module's run and api tests leak memory",
.check = do_leakcheck_vg, .check = do_leakcheck_vg,
.needs = "tests_pass_valgrind" .needs = "tests_pass_valgrind"
}; };
REGISTER_TEST(run_tests_vg_leak); REGISTER_TEST(tests_pass_valgrind_noleaks);
...@@ -49,7 +49,7 @@ static void check_trailing_whitespace(struct manifest *m, ...@@ -49,7 +49,7 @@ static void check_trailing_whitespace(struct manifest *m,
} }
} }
struct ccanlint trailing_whitespace = { struct ccanlint no_trailing_whitespace = {
.key = "no_trailing_whitespace", .key = "no_trailing_whitespace",
.name = "Module's source code has no trailing whitespace", .name = "Module's source code has no trailing whitespace",
.check = check_trailing_whitespace, .check = check_trailing_whitespace,
...@@ -57,4 +57,4 @@ struct ccanlint trailing_whitespace = { ...@@ -57,4 +57,4 @@ struct ccanlint trailing_whitespace = {
}; };
REGISTER_TEST(trailing_whitespace); REGISTER_TEST(no_trailing_whitespace);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment