Browse Source

Move ccanlint tests into subdirectories.

Rusty Russell 16 years ago
parent
commit
8f61c0bccb

+ 11 - 22
tools/ccanlint/Makefile

@@ -1,32 +1,21 @@
-OBJS := tools/ccanlint/has_info.o \
-	tools/ccanlint/has_main_header.o \
-	tools/ccanlint/has_tests.o \
-	tools/ccanlint/trailing_whitespace.o \
-	tools/ccanlint/idempotent.o \
-	tools/ccanlint/has_info_documentation.o \
+TEST_CFILES := $(wildcard tools/ccanlint/compulsory_tests/*.c) \
+	$(wildcard tools/ccanlint/tests/*.c)
+TEST_OBJS := $(TEST_CFILES:.c=.o)
 
-FUTURE:=tools/ccanlint/if_have_not_ifdef.o \
-	tools/ccanlint/needs_depends.o \
-	tools/ccanlint/has_info_documentation.o \
-	tools/ccanlint/has_header_documentation.o \
-	tools/ccanlint/has_tests.o \
-	tools/ccanlint/builds_ok.o \
-	tools/ccanlint/builds_ok_all_have_variants.o \
-	tools/ccanlint/run_tests.o \
-	tools/ccanlint/test_coverage.o \
+CORE_OBJS := tools/ccanlint/ccanlint.o \
+	tools/ccanlint/file_analysis.o \
+	tools/doc_extract-core.o \
+	ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
+	ccan/talloc/talloc.o ccan/noerr/noerr.o
+
+OBJS := $(CORE_OBJS) $(TEST_OBJS)
 
 tools/ccanlint/generated-init-tests: $(OBJS)
 	cat $(OBJS:.o=.c) | sed -n 's/^struct ccanlint \([A-Za-z0-9_]*\) = {/{ extern struct ccanlint \1; list_add(\&tests, \&\1.list); }/p' >$@
 
 tools/ccanlint/ccanlint.o: tools/ccanlint/generated-init-tests
 
-tools/ccanlint/ccanlint: \
-	$(OBJS)			\
-	tools/ccanlint/ccanlint.o \
-	tools/ccanlint/file_analysis.o \
-	tools/doc_extract-core.o \
-	ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o \
-	ccan/talloc/talloc.o ccan/noerr/noerr.o
+tools/ccanlint/ccanlint: $(OBJS)
 
 ccanlint-clean:
 	$(RM) tools/ccanlint/generated-init-tests

+ 1 - 1
tools/ccanlint/has_info.c → tools/ccanlint/compulsory_tests/has_info.c

@@ -1,4 +1,4 @@
-#include "ccanlint.h"
+#include <tools/ccanlint/ccanlint.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>

+ 1 - 1
tools/ccanlint/has_main_header.c → tools/ccanlint/compulsory_tests/has_main_header.c

@@ -1,4 +1,4 @@
-#include "ccanlint.h"
+#include <tools/ccanlint/ccanlint.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>

+ 1 - 1
tools/ccanlint/has_tests.c → tools/ccanlint/compulsory_tests/has_tests.c

@@ -1,4 +1,4 @@
-#include "ccanlint.h"
+#include <tools/ccanlint/ccanlint.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>

+ 2 - 2
tools/ccanlint/has_info_documentation.c → tools/ccanlint/tests/has_info_documentation.c

@@ -1,5 +1,5 @@
-#include "ccanlint.h"
-#include "../doc_extract.h"
+#include <tools/ccanlint/ccanlint.h>
+#include <tools/doc_extract.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>

+ 2 - 2
tools/ccanlint/idempotent.c → tools/ccanlint/tests/idempotent.c

@@ -1,4 +1,5 @@
-#include "ccanlint.h"
+#include <tools/ccanlint/ccanlint.h>
+#include <tools/tools.h>
 #include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
 #include <sys/types.h>
@@ -12,7 +13,6 @@
 #include <err.h>
 #include <string.h>
 #include <ctype.h>
-#include "../tools.h"
 
 static const char explain[] 
 = "Headers usually start with the C preprocessor lines to prevent multiple\n"

+ 1 - 1
tools/ccanlint/trailing_whitespace.c → tools/ccanlint/tests/trailing_whitespace.c

@@ -1,5 +1,5 @@
 /* Trailing whitespace test.  Almost embarrassing, but trivial. */
-#include "ccanlint.h"
+#include <tools/ccanlint/ccanlint.h>
 #include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>