Browse Source

Move modules to ccan/ tools to tools/
Requires minor fixups. "depends" now prefixes ccan/ (allows for
non-ccan deps later).

Rusty Russell 17 years ago
parent
commit
650c775ff0
75 changed files with 76 additions and 77 deletions
  1. 8 8
      Makefile
  2. 2 2
      README
  3. 1 1
      ccan/alignof/_info.c
  4. 0 0
      ccan/alignof/alignof.h
  5. 0 0
      ccan/alignof/test/run.c
  6. 1 1
      ccan/alloc/_info.c
  7. 0 0
      ccan/alloc/alloc.c
  8. 0 0
      ccan/alloc/alloc.h
  9. 0 0
      ccan/alloc/test/run.c
  10. 0 0
      ccan/build_assert/_info.c
  11. 0 0
      ccan/build_assert/build_assert.h
  12. 0 0
      ccan/build_assert/test/compile_fail-expr.c
  13. 0 0
      ccan/build_assert/test/compile_fail.c
  14. 0 0
      ccan/build_assert/test/compile_ok.c
  15. 0 0
      ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c
  16. 1 1
      ccan/check_type/_info.c
  17. 0 0
      ccan/check_type/check_type.h
  18. 0 0
      ccan/check_type/test/compile_fail-check_type.c
  19. 0 0
      ccan/check_type/test/compile_fail-check_type_unsigned.c
  20. 0 0
      ccan/check_type/test/compile_fail-check_types_match.c
  21. 0 0
      ccan/check_type/test/run.c
  22. 1 1
      ccan/container_of/_info.c
  23. 0 0
      ccan/container_of/container_of.h
  24. 0 0
      ccan/container_of/test/compile_fail-bad-type.c
  25. 0 0
      ccan/container_of/test/compile_fail-types.c
  26. 0 0
      ccan/container_of/test/compile_fail-var-types.c
  27. 0 0
      ccan/container_of/test/run.c
  28. 1 1
      ccan/list/_info.c
  29. 0 0
      ccan/list/list.c
  30. 0 0
      ccan/list/list.h
  31. 0 0
      ccan/list/test/run.c
  32. 0 0
      ccan/noerr/_info.c
  33. 0 0
      ccan/noerr/noerr.c
  34. 0 0
      ccan/noerr/noerr.h
  35. 0 0
      ccan/noerr/test/run.c
  36. 1 1
      ccan/string/_info.c
  37. 0 0
      ccan/string/string.h
  38. 0 0
      ccan/string/test/run.c
  39. 0 0
      ccan/talloc/TODO
  40. 1 1
      ccan/talloc/_info.c
  41. 0 0
      ccan/talloc/talloc.3.xml
  42. 0 0
      ccan/talloc/talloc.c
  43. 1 1
      ccan/talloc/talloc.h
  44. 0 0
      ccan/talloc/test/run.c
  45. 0 3
      ccan/tap/_info.c
  46. 0 0
      ccan/tap/tap.3
  47. 0 0
      ccan/tap/tap.c
  48. 0 0
      ccan/tap/tap.h
  49. 11 10
      ccan/tap/test/run.c
  50. 0 0
      ccan/typesafe_cb/_info.c
  51. 0 0
      ccan/typesafe_cb/test/compile_fail-cast_if_type.c
  52. 0 0
      ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c
  53. 0 0
      ccan/typesafe_cb/test/compile_fail-typesafe_cb.c
  54. 0 0
      ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c
  55. 0 0
      ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c
  56. 0 0
      ccan/typesafe_cb/test/run.c
  57. 0 0
      ccan/typesafe_cb/typesafe_cb.h
  58. 0 10
      ccan_tools/Makefile
  59. 0 31
      ccan_tools/ccanlint/Makefile
  60. 10 0
      tools/Makefile
  61. 32 0
      tools/ccanlint/Makefile
  62. 0 0
      tools/ccanlint/ccanlint.c
  63. 0 0
      tools/ccanlint/ccanlint.h
  64. 0 0
      tools/ccanlint/file_analysis.c
  65. 0 0
      tools/ccanlint/get_file_lines.c
  66. 0 0
      tools/ccanlint/get_file_lines.h
  67. 0 0
      tools/ccanlint/has_main_header.c
  68. 0 0
      tools/ccanlint/has_tests.c
  69. 0 0
      tools/ccanlint/idempotent.c
  70. 0 0
      tools/ccanlint/no_info.c
  71. 0 0
      tools/ccanlint/trailing_whitespace.c
  72. 0 0
      tools/doc_extract.c
  73. 0 0
      tools/namespacize.c
  74. 5 5
      tools/run_tests.c
  75. 0 0
      tools/test_all.sh

+ 8 - 8
Makefile

@@ -1,9 +1,9 @@
 # Hacky makefile to compile everything and run the tests in some kind of sane order.
 # V=--verbose for verbose tests.
 
-CFLAGS=-O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I.
+CFLAGS=-O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I.
 
-ALL=$(patsubst %/test, %, $(wildcard */test))
+ALL=$(patsubst ccan/%/test, ccan/%, $(wildcard ccan/*/test))
 ALL_DEPENDS=$(patsubst %, %/.depends, $(ALL))
 
 test-all: $(ALL_DEPENDS)
@@ -16,13 +16,13 @@ distclean: clean
 $(ALL_DEPENDS): %/.depends: %/_info
 	@$< depends > $@ || ( rm -f $@; exit 1 )
 
-test-%: ccan_tools/run_tests
+test-ccan/%: tools/run_tests
 	@echo Testing $*...
-	@if ccan_tools/run_tests $(V) $* | grep ^'not ok'; then exit 1; else exit 0; fi
+	@if tools/run_tests $(V) ccan/$* | grep ^'not ok'; then exit 1; else exit 0; fi
 
-ccanlint: ccan_tools/ccanlint/ccanlint
+ccanlint: tools/ccanlint/ccanlint
 
-clean: ccan_tools-clean
-	rm -f `find . -name '*.o'`
+clean: tools-clean
+	rm -f `find . -name '*.o'` `find . -name '.depends'`
 
-include ccan_tools/Makefile
+include tools/Makefile

+ 2 - 2
README

@@ -1,8 +1,8 @@
-ccan_tools:
+tools:
 	This is currently a bootstrap junkyard for ccan tools.
 
 	It is expected that some of this code, being generally useful, will be
 	shuffled out to their own modules over time.
 
-other:
+ccan:
 	The beginnings of a ccan repository.

+ 1 - 1
alignof/_info.c → ccan/alignof/_info.c

@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
 		return 1;
 
 	if (strcmp(argv[1], "depends") == 0) {
-		printf("build_assert\n");
+		printf("ccan/build_assert\n");
 		return 0;
 	}
 

+ 0 - 0
alignof/alignof.h → ccan/alignof/alignof.h


+ 0 - 0
alignof/test/run.c → ccan/alignof/test/run.c


+ 1 - 1
alloc/_info.c → ccan/alloc/_info.c

@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
 		return 1;
 
 	if (strcmp(argv[1], "depends") == 0) {
-		printf("build_assert\n");
+		printf("ccan/build_assert\n");
 		return 0;
 	}
 

+ 0 - 0
alloc/alloc.c → ccan/alloc/alloc.c


+ 0 - 0
alloc/alloc.h → ccan/alloc/alloc.h


+ 0 - 0
alloc/test/run.c → ccan/alloc/test/run.c


+ 0 - 0
build_assert/_info.c → ccan/build_assert/_info.c


+ 0 - 0
build_assert/build_assert.h → ccan/build_assert/build_assert.h


+ 0 - 0
build_assert/test/compile_fail-expr.c → ccan/build_assert/test/compile_fail-expr.c


+ 0 - 0
build_assert/test/compile_fail.c → ccan/build_assert/test/compile_fail.c


+ 0 - 0
build_assert/test/compile_ok.c → ccan/build_assert/test/compile_ok.c


+ 0 - 0
build_assert/test/run-EXPR_BUILD_ASSERT.c → ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c


+ 1 - 1
check_type/_info.c → ccan/check_type/_info.c

@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
 
 	if (strcmp(argv[1], "depends") == 0) {
 #if !HAVE_TYPEOF
-		printf("build_assert\n");
+		printf("ccan/build_assert\n");
 #endif
 		return 0;
 	}

+ 0 - 0
check_type/check_type.h → ccan/check_type/check_type.h


+ 0 - 0
check_type/test/compile_fail-check_type.c → ccan/check_type/test/compile_fail-check_type.c


+ 0 - 0
check_type/test/compile_fail-check_type_unsigned.c → ccan/check_type/test/compile_fail-check_type_unsigned.c


+ 0 - 0
check_type/test/compile_fail-check_types_match.c → ccan/check_type/test/compile_fail-check_types_match.c


+ 0 - 0
check_type/test/run.c → ccan/check_type/test/run.c


+ 1 - 1
container_of/_info.c → ccan/container_of/_info.c

@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
 		return 1;
 
 	if (strcmp(argv[1], "depends") == 0) {
-		printf("check_type\n");
+		printf("ccan/check_type\n");
 		return 0;
 	}
 

+ 0 - 0
container_of/container_of.h → ccan/container_of/container_of.h


+ 0 - 0
container_of/test/compile_fail-bad-type.c → ccan/container_of/test/compile_fail-bad-type.c


+ 0 - 0
container_of/test/compile_fail-types.c → ccan/container_of/test/compile_fail-types.c


+ 0 - 0
container_of/test/compile_fail-var-types.c → ccan/container_of/test/compile_fail-var-types.c


+ 0 - 0
container_of/test/run.c → ccan/container_of/test/run.c


+ 1 - 1
list/_info.c → ccan/list/_info.c

@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
 		return 1;
 
 	if (strcmp(argv[1], "depends") == 0) {
-		printf("container_of\n");
+		printf("ccan/container_of\n");
 		return 0;
 	}
 

+ 0 - 0
list/list.c → ccan/list/list.c


+ 0 - 0
list/list.h → ccan/list/list.h


+ 0 - 0
list/test/run.c → ccan/list/test/run.c


+ 0 - 0
noerr/_info.c → ccan/noerr/_info.c


+ 0 - 0
noerr/noerr.c → ccan/noerr/noerr.c


+ 0 - 0
noerr/noerr.h → ccan/noerr/noerr.h


+ 0 - 0
noerr/test/run.c → ccan/noerr/test/run.c


+ 1 - 1
string/_info.c → ccan/string/_info.c

@@ -9,7 +9,7 @@
  * the standard string.h.
  *
  * Example:
- *	#include "ccan/string.h"
+ *	#include "string/string.h"
  *
  *	int main(int argc, char *argv[])
  *	{

+ 0 - 0
string/string.h → ccan/string/string.h


+ 0 - 0
string/test/run.c → ccan/string/test/run.c


+ 0 - 0
talloc/TODO → ccan/talloc/TODO


+ 1 - 1
talloc/_info.c → ccan/talloc/_info.c

@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
 		return 1;
 
 	if (strcmp(argv[1], "depends") == 0) {
-		printf("typesafe_cb\n");
+		printf("ccan/typesafe_cb\n");
 		return 0;
 	}
 

+ 0 - 0
talloc/talloc.3.xml → ccan/talloc/talloc.3.xml


+ 0 - 0
talloc/talloc.c → ccan/talloc/talloc.c


+ 1 - 1
talloc/talloc.h → ccan/talloc/talloc.h

@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include "config.h"
-#include "typesafe_cb/typesafe_cb.h"
+#include "ccan/typesafe_cb/typesafe_cb.h"
 
 /*
   this uses a little trick to allow __LINE__ to be stringified

+ 0 - 0
talloc/test/run.c → ccan/talloc/test/run.c


+ 0 - 3
tap/_info.c → ccan/tap/_info.c

@@ -51,8 +51,5 @@ int main(int argc, char *argv[])
 	if (strcmp(argv[1], "depends") == 0)
 		return 0;
 
-	if (strcmp(argv[1], "license") == 0)
-		return "BSD";
-
 	return 1;
 }

+ 0 - 0
tap/tap.3 → ccan/tap/tap.3


+ 0 - 0
tap/tap.c → ccan/tap/tap.c


+ 0 - 0
tap/tap.h → ccan/tap/tap.h


+ 11 - 10
tap/test/run.c → ccan/tap/test/run.c

@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <stdbool.h>
+#include <fnmatch.h>
 
 /* We dup stderr to here. */
 static int stderrfd;
@@ -32,18 +33,18 @@ static void failmsg(const char *fmt, ...)
 	_exit(1);
 }
 
-static void expect(int fd, const char *str)
+static void expect(int fd, const char *pattern)
 {
- 	char buffer[PIPE_BUF];
+ 	char buffer[PIPE_BUF+1];
 	int r;
 
-	r = read(fd, buffer, sizeof(buffer));
+	r = read(fd, buffer, sizeof(buffer)-1);
 	if (r < 0)
 		failmsg("reading from pipe");
+	buffer[r] = '\0';
 
-	if (strlen(str) != r || strncmp(str, buffer, r) != 0)
-		failmsg("Expected '%s' got '%.*s'",
-			str, r, buffer);
+	if (fnmatch(pattern, buffer, 0) != 0)
+		failmsg("Expected '%s' got '%s'", pattern, buffer);
 }
 
 int main(int argc, char *argv[])
@@ -75,21 +76,21 @@ int main(int argc, char *argv[])
 
 	ok(0, "msg2");
 	expect(p[0], "not ok 2 - msg2\n"
-	       "#     Failed test (tap/test/run.c:main() at line 76)\n");
+	       "#     Failed test (*tap/test/run.c:main() at line 77)\n");
 
 	ok1(true);
 	expect(p[0], "ok 3 - true\n");
 
 	ok1(false);
  	expect(p[0], "not ok 4 - false\n"
-	       "#     Failed test (tap/test/run.c:main() at line 83)\n");
+	       "#     Failed test (*tap/test/run.c:main() at line 84)\n");
 
 	pass("passed");
  	expect(p[0], "ok 5 - passed\n");
 
 	fail("failed");
  	expect(p[0], "not ok 6 - failed\n"
-	       "#     Failed test (tap/test/run.c:main() at line 90)\n");
+	       "#     Failed test (*tap/test/run.c:main() at line 91)\n");
 
 	skip(2, "skipping %s", "test");
  	expect(p[0], "ok 7 # skip skipping test\n"
@@ -98,7 +99,7 @@ int main(int argc, char *argv[])
 	todo_start("todo");
 	ok1(false);
 	expect(p[0], "not ok 9 - false # TODO todo\n"
-	       "#     Failed (TODO) test (tap/test/run.c:main() at line 99)\n");
+	       "#     Failed (TODO) test (*tap/test/run.c:main() at line 100)\n");
 	ok1(true);
 	expect(p[0], "ok 10 - true # TODO todo\n");
 	todo_end();

+ 0 - 0
typesafe_cb/_info.c → ccan/typesafe_cb/_info.c


+ 0 - 0
typesafe_cb/test/compile_fail-cast_if_type.c → ccan/typesafe_cb/test/compile_fail-cast_if_type.c


+ 0 - 0
typesafe_cb/test/compile_fail-typesafe_cb-int.c → ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c


+ 0 - 0
typesafe_cb/test/compile_fail-typesafe_cb.c → ccan/typesafe_cb/test/compile_fail-typesafe_cb.c


+ 0 - 0
typesafe_cb/test/compile_fail-typesafe_cb_postargs.c → ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c


+ 0 - 0
typesafe_cb/test/compile_fail-typesafe_cb_preargs.c → ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c


+ 0 - 0
typesafe_cb/test/run.c → ccan/typesafe_cb/test/run.c


+ 0 - 0
typesafe_cb/typesafe_cb.h → ccan/typesafe_cb/typesafe_cb.h


+ 0 - 10
ccan_tools/Makefile

@@ -1,10 +0,0 @@
-ccan_tools/run_tests: ccan_tools/run_tests.o tap/tap.o talloc/talloc.o 
-
-ccan_tools/doc_extract: ccan_tools/doc_extract.c talloc/talloc.o
-
-ccan_tools/namespacize: ccan_tools/namespacize.c talloc/talloc.o
-
-ccan_tools-clean: ccanlint-clean
-	rm -f run_tests doc_extract
-
-include ccan_tools/ccanlint/Makefile

+ 0 - 31
ccan_tools/ccanlint/Makefile

@@ -1,31 +0,0 @@
-OBJS := ccan_tools/ccanlint/no_info.o \
-	ccan_tools/ccanlint/has_main_header.o \
-	ccan_tools/ccanlint/has_tests.o \
-	ccan_tools/ccanlint/trailing_whitespace.o \
-	ccan_tools/ccanlint/idempotent.o \
-
-FUTURE:=ccan_tools/ccanlint/if_have_not_ifdef.o \
-	ccan_tools/ccanlint/needs_depends.o \
-	ccan_tools/ccanlint/has_info_documentation.o \
-	ccan_tools/ccanlint/has_header_documentation.o \
-	ccan_tools/ccanlint/has_tests.o \
-	ccan_tools/ccanlint/builds_ok.o \
-	ccan_tools/ccanlint/builds_ok_all_have_variants.o \
-	ccan_tools/ccanlint/run_tests.o \
-	ccan_tools/ccanlint/test_coverage.o \
-
-ccan_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' >$@
-
-ccan_tools/ccanlint/ccanlint.o: ccan_tools/ccanlint/generated-init-tests
-
-ccan_tools/ccanlint/ccanlint: \
-	$(OBJS)			\
-	ccan_tools/ccanlint/ccanlint.o \
-	ccan_tools/ccanlint/get_file_lines.o \
-	ccan_tools/ccanlint/file_analysis.o \
-	talloc/talloc.o noerr/noerr.o
-
-ccanlint-clean:
-	$(RM) ccan_tools/ccanlint/generated-init-tests
-

+ 10 - 0
tools/Makefile

@@ -0,0 +1,10 @@
+tools/run_tests: tools/run_tests.o ccan/tap/tap.o ccan/talloc/talloc.o 
+
+tools/doc_extract: tools/doc_extract.c ccan/talloc/talloc.o
+
+tools/namespacize: tools/namespacize.c ccan/talloc/talloc.o
+
+tools-clean: ccanlint-clean
+	rm -f run_tests doc_extract namespacize
+
+include tools/ccanlint/Makefile

+ 32 - 0
tools/ccanlint/Makefile

@@ -0,0 +1,32 @@
+OBJS := tools/ccanlint/no_info.o \
+	tools/ccanlint/has_main_header.o \
+	tools/ccanlint/has_tests.o \
+	tools/ccanlint/trailing_whitespace.o \
+	tools/ccanlint/idempotent.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 \
+
+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/get_file_lines.o \
+	tools/ccanlint/file_analysis.o \
+	talloc/talloc.o noerr/noerr.o
+
+ccanlint-clean:
+	$(RM) tools/ccanlint/generated-init-tests
+	$(RM) tools/ccanlint/ccanlint
+

+ 0 - 0
ccan_tools/ccanlint/ccanlint.c → tools/ccanlint/ccanlint.c


+ 0 - 0
ccan_tools/ccanlint/ccanlint.h → tools/ccanlint/ccanlint.h


+ 0 - 0
ccan_tools/ccanlint/file_analysis.c → tools/ccanlint/file_analysis.c


+ 0 - 0
ccan_tools/ccanlint/get_file_lines.c → tools/ccanlint/get_file_lines.c


+ 0 - 0
ccan_tools/ccanlint/get_file_lines.h → tools/ccanlint/get_file_lines.h


+ 0 - 0
ccan_tools/ccanlint/has_main_header.c → tools/ccanlint/has_main_header.c


+ 0 - 0
ccan_tools/ccanlint/has_tests.c → tools/ccanlint/has_tests.c


+ 0 - 0
ccan_tools/ccanlint/idempotent.c → tools/ccanlint/idempotent.c


+ 0 - 0
ccan_tools/ccanlint/no_info.c → tools/ccanlint/no_info.c


+ 0 - 0
ccan_tools/ccanlint/trailing_whitespace.c → tools/ccanlint/trailing_whitespace.c


+ 0 - 0
ccan_tools/doc_extract.c → tools/doc_extract.c


+ 0 - 0
ccan_tools/namespacize.c → tools/namespacize.c


+ 5 - 5
ccan_tools/run_tests.c → tools/run_tests.c

@@ -4,11 +4,11 @@
 #include <dirent.h>
 #include <assert.h>
 #include <unistd.h>
-#include "tap/tap.h"
-#include "talloc/talloc.h"
-#include "../string/string.h"
+#include "ccan/tap/tap.h"
+#include "ccan/talloc/talloc.h"
+#include "ccan/string/string.h"
 
-#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I."
+#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I."
 
 /* FIXME: Use build bug later. */
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
@@ -56,7 +56,7 @@ static char *obj_list(void)
 		list = talloc_asprintf_append(list, "%s ", i->name);
 
 	/* FIXME */
-	list = talloc_asprintf_append(list, "tap/tap.o");
+	list = talloc_asprintf_append(list, "ccan/tap/tap.o");
 	return list;
 }
 

+ 0 - 0
ccan_tools/test_all.sh → tools/test_all.sh