tools/namespacize
tools/run_tests
tools/ccanlint/ccanlint
-tools/ccanlint/generated-init-tests
+tools/ccanlint/generated-compulsory-tests
+tools/ccanlint/generated-normal-tests
inter-depends
test-depends
lib-depends
-TEST_CFILES := $(wildcard tools/ccanlint/compulsory_tests/*.c) \
- $(wildcard tools/ccanlint/tests/*.c)
-TEST_OBJS := $(TEST_CFILES:.c=.o)
+COMPULSORY_TEST_CFILES := $(wildcard tools/ccanlint/compulsory_tests/*.c)
+NORMAL_TEST_CFILES := $(wildcard tools/ccanlint/tests/*.c)
+TEST_OBJS := $(NORMAL_TEST_CFILES:.c=.o) $(COMPULSORY_TEST_CFILES:.c=.o)
CORE_OBJS := tools/ccanlint/ccanlint.o \
tools/ccanlint/file_analysis.o \
OBJS := $(CORE_OBJS) $(TEST_OBJS)
# FIXME: write a trivial C program to do this
-tools/ccanlint/generated-init-tests: $(TEST_CFILES)
- cat $(TEST_CFILES) | grep ^REGISTER_TEST > $@
+tools/ccanlint/generated-normal-tests: $(NORMAL_TEST_CFILES)
+ cat $^ | grep ^REGISTER_TEST > $@
+tools/ccanlint/generated-compulsory-tests: $(COMPULSORY_TEST_CFILES)
+ cat $^ | grep ^REGISTER_TEST > $@
-$(TEST_OBJS): tools/ccanlint/generated-init-tests
+$(TEST_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
# Otherwise, ccanlint.c et al. may fail to build
-$(CORE_OBJS): tools/ccanlint/generated-init-tests
+$(CORE_OBJS): tools/ccanlint/generated-normal-tests tools/ccanlint/generated-compulsory-tests
tools/ccanlint/ccanlint: $(OBJS)
ccanlint-clean:
- $(RM) tools/ccanlint/generated-init-tests
+ $(RM) tools/ccanlint/generated-compulsory-tests
+ $(RM) tools/ccanlint/generated-normal-tests
$(RM) tools/ccanlint/ccanlint
return false;
}
-static void register_test(struct ccanlint *test, ...)
+static void register_test(struct list_head *h, struct ccanlint *test, ...)
{
va_list ap;
struct ccanlint *depends;
struct dependent *dchild;
- if (!test->total_score)
- list_add(&compulsory_tests, &test->list);
- else
- list_add(&normal_tests, &test->list);
+ list_add(h, &test->list);
va_start(ap, test);
/* Careful: we might have been initialized by a dependent. */
const struct ccanlint *i;
#undef REGISTER_TEST
-#define REGISTER_TEST(name, ...) register_test(&name, __VA_ARGS__)
-#include "generated-init-tests"
+#define REGISTER_TEST(name, ...) register_test(&normal_tests, &name, __VA_ARGS__)
+#include "generated-normal-tests"
+#undef REGISTER_TEST
+#define REGISTER_TEST(name, ...) register_test(&compulsory_tests, &name, __VA_ARGS__)
+#include "generated-compulsory-tests"
if (!verbose)
return;
if (verbose)
printf("\nNormal tests:\n");
score = total_score = 0;
- while ((i = get_next_test(&normal_tests)) != NULL) {
- if (i->total_score)
- run_test(i, summary, &score, &total_score, m);
- }
+ while ((i = get_next_test(&normal_tests)) != NULL)
+ run_test(i, summary, &score, &total_score, m);
+
printf("Total score: %u/%u\n", score, total_score);
return 0;
}
#include "../doc_extract.h"
#define REGISTER_TEST(name, ...) extern struct ccanlint name
-#include "generated-init-tests"
+#include "generated-compulsory-tests"
+#include "generated-normal-tests"
#undef REGISTER_TEST
#define REGISTER_TEST(name, ...)
/* Unique name of test */
const char *name;
- /* Total score that this test is worth. 0 means compulsory tests. */
+ /* Total score that this test is worth. */
unsigned int total_score;
/* Can we run this test? Return string explaining why, if not. */
struct ccan_file *i;
/* One point for each obj file. */
- build_objs.total_score = 0;
list_for_each(&m->c_files, i, list)
build_objs.total_score++;
struct ccanlint build_objs = {
.name = "Module object files can be built",
- .total_score = 1,
.check = check_objs_build,
.describe = describe_objs_build,
.can_run = can_build,
list_head_init(list);
- compile_tests.total_score = 0;
list_for_each(&m->compile_ok_tests, i, list) {
compile_tests.total_score++;
cmdout = compile(list, m, i, false, false);
struct ccanlint compile_tests = {
.name = "Compile tests succeed",
- .total_score = 1,
.score = score_compile_tests,
.check = do_compile_tests,
.describe = describe_compile_tests,
list_head_init(list);
- run_tests.total_score = 0;
list_for_each(&m->run_tests, i, list) {
char *testout;
run_tests.total_score++;
struct ccanlint run_tests = {
.name = "run and api tests run successfully",
- .total_score = 1,
.score = score_run_tests,
.check = do_run_tests,
.describe = describe_run_tests,
#define SPACE_CHARS " \f\n\r\t\v"
/* FIXME: Remove some -I */
-#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan/ -I. -I../.."
+#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan/ -I.. -I../.."
/* This actually compiles and runs the info file to get dependencies. */
char **get_deps(const void *ctx, const char *dir, const char *name,