From: Rusty Russell Date: Wed, 6 Jan 2010 00:23:58 +0000 (+1030) Subject: Remove old run-tests, clean up #includes to all be #include #include -#include -#include "alignof/alignof.h" +#include /* Alignment is remarkably difficult to test. The rules may be more * complex than ALIGNOF() can know: eg. on i386 __alignof__(double) == 8, but diff --git a/ccan/alloc/test/run-testsize.c b/ccan/alloc/test/run-testsize.c index 9071cb6d..2f0b772a 100644 --- a/ccan/alloc/test/run-testsize.c +++ b/ccan/alloc/test/run-testsize.c @@ -1,6 +1,6 @@ -#include "alloc/alloc.h" -#include "tap/tap.h" -#include "alloc/alloc.c" +#include +#include +#include #include #include #include diff --git a/ccan/alloc/test/run.c b/ccan/alloc/test/run.c index 8247122e..801db576 100644 --- a/ccan/alloc/test/run.c +++ b/ccan/alloc/test/run.c @@ -1,6 +1,6 @@ -#include "alloc/alloc.h" -#include "tap/tap.h" -#include "alloc/alloc.c" +#include +#include +#include #include #include diff --git a/ccan/antithread/test/run-lock.c b/ccan/antithread/test/run-lock.c index b486e0a2..712d3e1d 100644 --- a/ccan/antithread/test/run-lock.c +++ b/ccan/antithread/test/run-lock.c @@ -1,7 +1,7 @@ -#include "antithread/antithread.c" +#include #include #include -#include "tap/tap.h" +#include #define NUM_RUNS 100 diff --git a/ccan/antithread/test/run-simple.c b/ccan/antithread/test/run-simple.c index 947dbe02..56569bb2 100644 --- a/ccan/antithread/test/run-simple.c +++ b/ccan/antithread/test/run-simple.c @@ -1,6 +1,6 @@ -#include "antithread/antithread.c" +#include #include -#include "tap/tap.h" +#include static void *test(struct at_pool *atp, int *pid) { diff --git a/ccan/antithread/test/run-spawn-NULL.c b/ccan/antithread/test/run-spawn-NULL.c index 7b1b5a2c..5b633546 100644 --- a/ccan/antithread/test/run-spawn-NULL.c +++ b/ccan/antithread/test/run-spawn-NULL.c @@ -1,6 +1,6 @@ -#include "antithread/antithread.c" +#include #include -#include "tap/tap.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/antithread/test/run-spawn.c b/ccan/antithread/test/run-spawn.c index 1f12ebeb..b8aa81e5 100644 --- a/ccan/antithread/test/run-spawn.c +++ b/ccan/antithread/test/run-spawn.c @@ -1,6 +1,6 @@ -#include "antithread/antithread.c" +#include #include -#include "tap/tap.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/antithread/test/run-tell.c b/ccan/antithread/test/run-tell.c index fc42095c..84ca4928 100644 --- a/ccan/antithread/test/run-tell.c +++ b/ccan/antithread/test/run-tell.c @@ -1,6 +1,6 @@ -#include "antithread/antithread.c" +#include #include -#include "tap/tap.h" +#include static void *test(struct at_pool *atp, void *unused) { diff --git a/ccan/antithread/test/run-tell_parent.c b/ccan/antithread/test/run-tell_parent.c index f3c17e9a..d215a670 100644 --- a/ccan/antithread/test/run-tell_parent.c +++ b/ccan/antithread/test/run-tell_parent.c @@ -1,6 +1,6 @@ -#include "antithread/antithread.c" +#include #include -#include "tap/tap.h" +#include static void *test(struct at_pool *atp, int *pid) { diff --git a/ccan/array/test/run.c b/ccan/array/test/run.c index b0b672ba..91096727 100644 --- a/ccan/array/test/run.c +++ b/ccan/array/test/run.c @@ -1,7 +1,7 @@ #include -#include -#include "array/array.h" -#include "array/array.c" +#include +#include +#include #define countof(array...) (sizeof(array)/sizeof(*(array))) #include "lotsOfNumbers.h" diff --git a/ccan/array_size/test/compile_fail.c b/ccan/array_size/test/compile_fail.c index 9f9ac650..37d315f2 100644 --- a/ccan/array_size/test/compile_fail.c +++ b/ccan/array_size/test/compile_fail.c @@ -1,4 +1,4 @@ -#include "array_size/array_size.h" +#include int main(int argc, char *argv[8]) { diff --git a/ccan/array_size/test/run.c b/ccan/array_size/test/run.c index 3a3cdcc0..37b4200b 100644 --- a/ccan/array_size/test/run.c +++ b/ccan/array_size/test/run.c @@ -1,5 +1,5 @@ -#include "array_size/array_size.h" -#include "tap/tap.h" +#include +#include static char array1[1]; static int array2[2]; diff --git a/ccan/block_pool/test/run.c b/ccan/block_pool/test/run.c index 3fa7effd..f70a8026 100644 --- a/ccan/block_pool/test/run.c +++ b/ccan/block_pool/test/run.c @@ -1,6 +1,6 @@ -#include "block_pool/block_pool.h" -#include "block_pool/block_pool.c" -#include "tap/tap.h" +#include +#include +#include struct alloc_record { size_t size; diff --git a/ccan/build_assert/test/compile_fail-expr.c b/ccan/build_assert/test/compile_fail-expr.c index 41cdc0f8..fa60d689 100644 --- a/ccan/build_assert/test/compile_fail-expr.c +++ b/ccan/build_assert/test/compile_fail-expr.c @@ -1,4 +1,4 @@ -#include "build_assert/build_assert.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/build_assert/test/compile_fail.c b/ccan/build_assert/test/compile_fail.c index a6867db5..37d95edd 100644 --- a/ccan/build_assert/test/compile_fail.c +++ b/ccan/build_assert/test/compile_fail.c @@ -1,4 +1,4 @@ -#include "build_assert/build_assert.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/build_assert/test/compile_ok.c b/ccan/build_assert/test/compile_ok.c index bc5541f5..4105484d 100644 --- a/ccan/build_assert/test/compile_ok.c +++ b/ccan/build_assert/test/compile_ok.c @@ -1,4 +1,4 @@ -#include "build_assert/build_assert.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c b/ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c index 7fd0c49f..91bbbbbf 100644 --- a/ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c +++ b/ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c @@ -1,5 +1,5 @@ -#include "build_assert/build_assert.h" -#include "tap/tap.h" +#include +#include int main(int argc, char *argv[]) { diff --git a/ccan/ccan_tokenizer/test/run-simple-token.c b/ccan/ccan_tokenizer/test/run-simple-token.c index 071848f9..efc39430 100644 --- a/ccan/ccan_tokenizer/test/run-simple-token.c +++ b/ccan/ccan_tokenizer/test/run-simple-token.c @@ -1,10 +1,10 @@ -#include "ccan_tokenizer/read_cnumber.c" -#include "ccan_tokenizer/read_cstring.c" -#include "ccan_tokenizer/dict.c" -#include "ccan_tokenizer/ccan_tokenizer.c" -#include "ccan_tokenizer/queue.c" -#include "ccan_tokenizer/charflag.c" -#include "tap/tap.h" +#include +#include +#include +#include +#include +#include +#include #define item(num) (toks->first[num]) //sed 's/toks->array\.item\[\([^]]*\)\]/item(\1)/g' diff --git a/ccan/ccan_tokenizer/test/run.c b/ccan/ccan_tokenizer/test/run.c index 9a4ae19b..631518aa 100644 --- a/ccan/ccan_tokenizer/test/run.c +++ b/ccan/ccan_tokenizer/test/run.c @@ -25,16 +25,16 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ccan_tokenizer/read_cnumber.c" -#include "ccan_tokenizer/read_cstring.c" -#include "ccan_tokenizer/dict.c" -#include "ccan_tokenizer/ccan_tokenizer.c" -#include "ccan_tokenizer/queue.c" -#include "ccan_tokenizer/charflag.c" +#include +#include +#include +#include +#include +#include -#include "ccan_tokenizer/ccan_tokenizer.h" +#include -#include "tap/tap.h" +#include #include diff --git a/ccan/check_type/test/compile_fail-check_type.c b/ccan/check_type/test/compile_fail-check_type.c index d19fe86f..fe7d6a23 100644 --- a/ccan/check_type/test/compile_fail-check_type.c +++ b/ccan/check_type/test/compile_fail-check_type.c @@ -1,4 +1,4 @@ -#include "check_type/check_type.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/check_type/test/compile_fail-check_type_unsigned.c b/ccan/check_type/test/compile_fail-check_type_unsigned.c index 6b18acb5..574d4aeb 100644 --- a/ccan/check_type/test/compile_fail-check_type_unsigned.c +++ b/ccan/check_type/test/compile_fail-check_type_unsigned.c @@ -1,4 +1,4 @@ -#include "check_type/check_type.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/check_type/test/compile_fail-check_types_match.c b/ccan/check_type/test/compile_fail-check_types_match.c index bc1f9c31..cbd6e9bc 100644 --- a/ccan/check_type/test/compile_fail-check_types_match.c +++ b/ccan/check_type/test/compile_fail-check_types_match.c @@ -1,4 +1,4 @@ -#include "check_type/check_type.h" +#include int main(int argc, char *argv[]) { diff --git a/ccan/check_type/test/run.c b/ccan/check_type/test/run.c index f4b33c16..83b903c0 100644 --- a/ccan/check_type/test/run.c +++ b/ccan/check_type/test/run.c @@ -1,5 +1,5 @@ -#include "check_type/check_type.h" -#include "tap/tap.h" +#include +#include int main(int argc, char *argv[]) { diff --git a/ccan/ciniparser/ciniparser.c b/ccan/ciniparser/ciniparser.c index dceb22f5..d801b736 100644 --- a/ccan/ciniparser/ciniparser.c +++ b/ccan/ciniparser/ciniparser.c @@ -33,7 +33,7 @@ */ #include -#include "ciniparser.h" +#include #define ASCIILINESZ (1024) #define INI_INVALID_KEY ((char*) NULL) diff --git a/ccan/ciniparser/test/run.c b/ccan/ciniparser/test/run.c index 34ad13f4..5fe67b46 100644 --- a/ccan/ciniparser/test/run.c +++ b/ccan/ciniparser/test/run.c @@ -1,14 +1,14 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include -#include +#include #define NUM_TESTS 12 diff --git a/ccan/crc/test/api.c b/ccan/crc/test/api.c index 5e85e35b..1d56e3d2 100644 --- a/ccan/crc/test/api.c +++ b/ccan/crc/test/api.c @@ -1,5 +1,5 @@ -#include "crc/crc.h" -#include "tap/tap.h" +#include +#include #include static const uint32_t crc32c_tab[] = { diff --git a/ccan/endian/test/run.c b/ccan/endian/test/run.c index 2cd25861..cba96f0b 100644 --- a/ccan/endian/test/run.c +++ b/ccan/endian/test/run.c @@ -1,7 +1,7 @@ -#include "endian/endian.h" +#include #include #include -#include +#include int main(int argc, char *argv[]) { diff --git a/ccan/grab_file/test/run-grab.c b/ccan/grab_file/test/run-grab.c index 3c44ce05..b3c18e5a 100644 --- a/ccan/grab_file/test/run-grab.c +++ b/ccan/grab_file/test/run-grab.c @@ -1,14 +1,14 @@ /* This is test for grab_file() function */ -#include "grab_file/grab_file.h" -#include -#include -#include -#include -#include "grab_file/grab_file.c" -#include "tap/tap.h" -#include "str_talloc/str_talloc.h" -#include "str/str.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include int main(int argc, char *argv[]) diff --git a/ccan/hash/test/api-hash_stable.c b/ccan/hash/test/api-hash_stable.c index 37cd0736..d07c4a93 100644 --- a/ccan/hash/test/api-hash_stable.c +++ b/ccan/hash/test/api-hash_stable.c @@ -1,5 +1,5 @@ -#include "hash/hash.h" -#include "tap/tap.h" +#include +#include #include #include diff --git a/ccan/hash/test/run.c b/ccan/hash/test/run.c index 1857739a..2aeec42d 100644 --- a/ccan/hash/test/run.c +++ b/ccan/hash/test/run.c @@ -1,6 +1,6 @@ -#include "hash/hash.h" -#include "tap/tap.h" -#include "hash/hash.c" +#include +#include +#include #include #include diff --git a/ccan/ilog/test/run.c b/ccan/ilog/test/run.c index 2aeee1ce..ce19293a 100644 --- a/ccan/ilog/test/run.c +++ b/ccan/ilog/test/run.c @@ -1,7 +1,7 @@ -#include "ilog/ilog.h" -#include "ilog/ilog.c" +#include +#include #include -#include "tap/tap.h" +#include /*Dead simple (but slow) versions to compare against.*/ diff --git a/ccan/isaac/test/run.c b/ccan/isaac/test/run.c index 8e953bbf..81a46bc2 100644 --- a/ccan/isaac/test/run.c +++ b/ccan/isaac/test/run.c @@ -1,6 +1,6 @@ -#include "isaac/isaac.h" -#include "isaac/isaac.c" -#include "tap/tap.h" +#include +#include +#include #include static const uint32_t STATEVEC[ISAAC_SZ<<1]={ diff --git a/ccan/isaac/test/run64.c b/ccan/isaac/test/run64.c index cac186e1..db2b4d35 100644 --- a/ccan/isaac/test/run64.c +++ b/ccan/isaac/test/run64.c @@ -1,6 +1,6 @@ -#include "isaac/isaac64.h" -#include "isaac/isaac64.c" -#include "tap/tap.h" +#include +#include +#include #include static const uint64_t STATEVEC64[ISAAC64_SZ<<1]={ diff --git a/ccan/list/test/compile_ok-constant.c b/ccan/list/test/compile_ok-constant.c index edb3cb01..c57cdadc 100644 --- a/ccan/list/test/compile_ok-constant.c +++ b/ccan/list/test/compile_ok-constant.c @@ -1,6 +1,6 @@ -#include "list/list.h" -#include "tap/tap.h" -#include "list/list.c" +#include +#include +#include #include #include diff --git a/ccan/list/test/run.c b/ccan/list/test/run.c index ac318e1a..1a5f0934 100644 --- a/ccan/list/test/run.c +++ b/ccan/list/test/run.c @@ -1,6 +1,6 @@ -#include "list/list.h" -#include "tap/tap.h" -#include "list/list.c" +#include +#include +#include struct parent { const char *name; diff --git a/ccan/md4/test/api.c b/ccan/md4/test/api.c index 339409c0..a21833c9 100644 --- a/ccan/md4/test/api.c +++ b/ccan/md4/test/api.c @@ -1,5 +1,5 @@ -#include "md4/md4.h" -#include +#include +#include #include #include diff --git a/ccan/noerr/test/run.c b/ccan/noerr/test/run.c index 6f1361ce..144e4dd0 100644 --- a/ccan/noerr/test/run.c +++ b/ccan/noerr/test/run.c @@ -1,6 +1,6 @@ -#include "noerr/noerr.h" -#include "tap/tap.h" -#include "noerr/noerr.c" +#include +#include +#include #include #include #include diff --git a/ccan/read_write_all/test/run-read_all.c b/ccan/read_write_all/test/run-read_all.c index 5fa0ec39..ee6a9800 100644 --- a/ccan/read_write_all/test/run-read_all.c +++ b/ccan/read_write_all/test/run-read_all.c @@ -1,8 +1,8 @@ /* FIXME: Do something tricky to ensure we really do loop in read_all. */ -#include "read_write_all/read_write_all.h" -#include "read_write_all/read_write_all.c" -#include "tap/tap.h" +#include +#include +#include #include #include #include diff --git a/ccan/read_write_all/test/run-write_all.c b/ccan/read_write_all/test/run-write_all.c index ab21cd31..50bd729c 100644 --- a/ccan/read_write_all/test/run-write_all.c +++ b/ccan/read_write_all/test/run-write_all.c @@ -1,8 +1,8 @@ /* FIXME: Do something tricky to ensure we really do loop in write_all. */ -#include "read_write_all/read_write_all.h" -#include "read_write_all/read_write_all.c" -#include "tap/tap.h" +#include +#include +#include #include #include #include diff --git a/ccan/short_types/test/run.c b/ccan/short_types/test/run.c index a78d56ce..5aa80d7f 100644 --- a/ccan/short_types/test/run.c +++ b/ccan/short_types/test/run.c @@ -1,5 +1,5 @@ -#include "short_types/short_types.h" -#include "tap/tap.h" +#include +#include #include #include diff --git a/ccan/str/test/run.c b/ccan/str/test/run.c index b55444a1..f35d75d6 100644 --- a/ccan/str/test/run.c +++ b/ccan/str/test/run.c @@ -1,7 +1,7 @@ -#include "str/str.h" +#include #include #include -#include "tap/tap.h" +#include /* FIXME: ccanize */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) diff --git a/ccan/str_talloc/test/run.c b/ccan/str_talloc/test/run.c index 2e45aafe..4e1c3d16 100644 --- a/ccan/str_talloc/test/run.c +++ b/ccan/str_talloc/test/run.c @@ -1,9 +1,9 @@ -#include "str_talloc/str_talloc.h" +#include #include #include -#include "str_talloc/str_talloc.c" -#include "tap/tap.h" -#include "str/str.h" +#include +#include +#include /* FIXME: ccanize */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) diff --git a/ccan/stringmap/stringmap.c b/ccan/stringmap/stringmap.c index b3ca57af..364e2a48 100644 --- a/ccan/stringmap/stringmap.c +++ b/ccan/stringmap/stringmap.c @@ -29,7 +29,7 @@ /* This is a heavily modified version of the Patricia tree implementation in PCC at http://pcc.zentus.com/cgi-bin/cvsweb.cgi/cc/cpp/cpp.c?rev=1.96 */ -#include "stringmap.h" +#include //#define CONSISTENCY_CHECK diff --git a/ccan/stringmap/test/run.c b/ccan/stringmap/test/run.c index 0d4db567..2ffcb124 100644 --- a/ccan/stringmap/test/run.c +++ b/ccan/stringmap/test/run.c @@ -1,7 +1,7 @@ -#include "stringmap/stringmap.h" -#include "stringmap/stringmap.c" +#include +#include -#include "tap/tap.h" +#include static void test_trivial(void) { stringmap(int) map = stringmap_new(NULL); diff --git a/ccan/talloc/test/compile_fail-talloc_set.c b/ccan/talloc/test/compile_fail-talloc_set.c index 909076b7..cc9a1755 100644 --- a/ccan/talloc/test/compile_fail-talloc_set.c +++ b/ccan/talloc/test/compile_fail-talloc_set.c @@ -1,4 +1,4 @@ -#include "talloc/talloc.c" +#include int main(void) { diff --git a/ccan/talloc/test/run-external-alloc.c b/ccan/talloc/test/run-external-alloc.c index 70f3dacd..013041fe 100644 --- a/ccan/talloc/test/run-external-alloc.c +++ b/ccan/talloc/test/run-external-alloc.c @@ -1,5 +1,5 @@ -#include "talloc/talloc.c" -#include "tap/tap.h" +#include +#include #include /* Much testing already done in run.c */ diff --git a/ccan/talloc/test/run-talloc_set.c b/ccan/talloc/test/run-talloc_set.c index d7b49614..18b9066f 100644 --- a/ccan/talloc/test/run-talloc_set.c +++ b/ccan/talloc/test/run-talloc_set.c @@ -1,5 +1,5 @@ -#include "talloc/talloc.c" -#include "tap/tap.h" +#include +#include #include int main(void) diff --git a/ccan/talloc/test/run.c b/ccan/talloc/test/run.c index ad70a51e..9654f625 100644 --- a/ccan/talloc/test/run.c +++ b/ccan/talloc/test/run.c @@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "talloc/talloc.c" +#include #include -#include "tap/tap.h" +#include #define torture_assert(test, expr, str) \ ok(expr, "%s [\n%s: Expression %s failed: %s\n]\n", \ diff --git a/ccan/talloc_link/test/run.c b/ccan/talloc_link/test/run.c index e095bd9e..3cbb5f01 100644 --- a/ccan/talloc_link/test/run.c +++ b/ccan/talloc_link/test/run.c @@ -1,6 +1,6 @@ -#include "talloc_link/talloc_link.h" -#include "tap/tap.h" -#include "talloc_link/talloc_link.c" +#include +#include +#include #include #include diff --git a/ccan/typesafe_cb/test/compile_fail-cast_if_type.c b/ccan/typesafe_cb/test/compile_fail-cast_if_type.c index 1e417cba..db2f1249 100644 --- a/ccan/typesafe_cb/test/compile_fail-cast_if_type.c +++ b/ccan/typesafe_cb/test/compile_fail-cast_if_type.c @@ -1,4 +1,4 @@ -#include "typesafe_cb/typesafe_cb.h" +#include void _set_some_value(void *val); diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c index 54d0e7ba..c4033364 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c @@ -1,4 +1,4 @@ -#include "typesafe_cb/typesafe_cb.h" +#include #include void _callback(void (*fn)(void *arg), void *arg); diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c index d305d5fb..bd201313 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c @@ -1,4 +1,4 @@ -#include "typesafe_cb/typesafe_cb.h" +#include #include static void _register_callback(void (*cb)(void *arg), void *arg) diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c index 099eb257..885a3c55 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c @@ -1,4 +1,4 @@ -#include "typesafe_cb/typesafe_cb.h" +#include #include static void _register_callback(void (*cb)(void *arg, int x), void *arg) diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c index 38daec51..c7dc6f1e 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c @@ -1,4 +1,4 @@ -#include "typesafe_cb/typesafe_cb.h" +#include #include static void _register_callback(void (*cb)(int x, void *arg), void *arg) diff --git a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-const.c b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-const.c index fe3a3417..f8d0ae0f 100644 --- a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-const.c +++ b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-const.c @@ -1,4 +1,4 @@ -#include "typesafe_cb/typesafe_cb.h" +#include #include /* const args in callbacks should be OK. */ diff --git a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-volatile.c b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-volatile.c index 93875c9e..bc87ae8d 100644 --- a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-volatile.c +++ b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-volatile.c @@ -1,4 +1,4 @@ -#include "typesafe_cb/typesafe_cb.h" +#include #include /* volatile args in callbacks should be OK. */ diff --git a/ccan/typesafe_cb/test/run.c b/ccan/typesafe_cb/test/run.c index b04fae88..e01e71d5 100644 --- a/ccan/typesafe_cb/test/run.c +++ b/ccan/typesafe_cb/test/run.c @@ -1,6 +1,6 @@ -#include "typesafe_cb/typesafe_cb.h" +#include #include -#include "tap/tap.h" +#include static char dummy = 0; diff --git a/tools/Makefile b/tools/Makefile index 8301ba52..4607d41a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,4 @@ -ALL_TOOLS = tools/ccan_depends tools/run_tests tools/doc_extract tools/namespacize tools/ccanlint/ccanlint +ALL_TOOLS = tools/ccan_depends tools/doc_extract tools/namespacize tools/ccanlint/ccanlint DEP_OBJS = tools/depends.o tools/compile.o tools/tools.o ccan/str_talloc/str_talloc.o ccan/grab_file/grab_file.o ccan/talloc/talloc.o ccan/noerr/noerr.o ccan/read_write_all/read_write_all.o @@ -7,13 +7,11 @@ tools: $(ALL_TOOLS) tools/ccan_depends: tools/ccan_depends.o $(DEP_OBJS) -tools/run_tests: tools/run_tests.o ccan/tap/tap.o $(DEP_OBJS) - tools/doc_extract: tools/doc_extract.o tools/doc_extract-core.o $(DEP_OBJS) tools/namespacize: tools/namespacize.o $(DEP_OBJS) -tools/run_tests.o tools/namespacize.o tools/depends.o: tools/tools.h +tools/namespacize.o tools/depends.o: tools/tools.h tools-clean: ccanlint-clean $(RM) $(ALL_TOOLS) diff --git a/tools/run_tests.c b/tools/run_tests.c deleted file mode 100644 index 5ba276fe..00000000 --- a/tools/run_tests.c +++ /dev/null @@ -1,249 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "ccan/tap/tap.h" -#include "ccan/talloc/talloc.h" -#include "ccan/str/str.h" -#include "ccan/array_size/array_size.h" -#include "tools.h" - -static struct test *tests = NULL; -static struct obj *objs = NULL; -static int verbose; - -struct test_type { - const char *name; - void (*buildfn)(const char *dir, struct test_type *t, const char *name, - const char *apiobj, const char *libs); - void (*runfn)(const char *name); -}; - -struct test { - struct test *next; - struct test_type *type; - char *name; -}; - -struct obj { - struct obj *next; - bool generate; - char *name; -}; - -static char *output_name(const char *name) -{ - char *ret; - - assert(strends(name, ".c")); - - ret = talloc_strdup(name, name); - ret[strlen(ret) - 2] = '\0'; - return ret; -} - -static char *obj_list(const char *dir) -{ - char *list = talloc_strdup(objs, ""); - struct obj *i; - - for (i = objs; i; i = i->next) - list = talloc_asprintf_append(list, "%s ", i->name); - - /* FIXME */ - if (!streq(dir, "tap") && !strends(dir, "/tap")) - list = talloc_asprintf_append(list, "ccan/tap/tap.o"); - return list; -} - -static void compile_objs(void) -{ - struct obj *i; - - for (i = objs; i; i = i->next) { - char *cmd = talloc_asprintf(i, "gcc " CFLAGS " -o %s.o -c %s%s", - output_name(i->name), i->name, - verbose ? "" : "> /dev/null 2>&1"); - ok(system(cmd) == 0, "%s", cmd); - } -} - -static void cleanup_objs(void) -{ - struct obj *i; - - for (i = objs; i; i = i->next) { - if (!i->generate) - continue; - unlink(talloc_asprintf(i, "%s.o", output_name(i->name))); - } -} - -static void add_test(const char *testdir, const char *name, struct test_type *t) -{ - struct test *test = talloc(testdir, struct test); - - test->next = tests; - test->type = t; - test->name = talloc_asprintf(test, "%s/%s", testdir, name); - tests = test; -} - -static void add_obj(const char *testdir, const char *name, bool generate) -{ - struct obj *obj = talloc(testdir, struct obj); - - obj->next = objs; - obj->name = talloc_asprintf(obj, "%s/%s", testdir, name); - obj->generate = generate; - objs = obj; -} - -static int build(const char *dir, const char *name, const char *apiobj, - const char *libs, int fail) -{ - const char *cmd; - int ret; - - cmd = talloc_asprintf(name, "gcc " CFLAGS " %s -o %s %s %s %s%s %s", - fail ? "-DFAIL" : "", - output_name(name), name, apiobj, obj_list(dir), - libs, verbose ? "" : "> /dev/null 2>&1"); - - if (verbose) - fprintf(stderr, "Running %s\n", cmd); - - ret = system(cmd); - if (ret == -1) - diag("cmd '%s' failed to execute", cmd); - - return ret; -} - -static void compile_ok(const char *dir, struct test_type *t, const char *name, - const char *apiobj, const char *libs) -{ - ok(build(dir, name, "", libs, 0) == 0, "%s %s", t->name, name); -} - -/* api tests get the API obj linked in as well. */ -static void compile_api_ok(const char *dir, struct test_type *t, - const char *name, const char *apiobj, - const char *libs) -{ - ok(build(dir, name, apiobj, libs, 0) == 0, "%s %s", t->name, name); -} - -static void compile_fail(const char *dir, struct test_type *t, const char *name, - const char *apiobj, const char *libs) -{ - if (build(dir, name, "", libs, 0) != 0) - fail("non-FAIL build %s", name); - else - ok(build(dir, name, "", libs, 1) > 0, "%s %s", t->name, name); -} - -static void no_run(const char *name) -{ -} - -static void run(const char *name) -{ - if (system(output_name(name)) != 0) - fail("running %s had error", name); -} - -static void cleanup(const char *name) -{ - unlink(output_name(name)); -} - -static struct test_type test_types[] = { - { "compile_ok", compile_ok, no_run }, - { "compile_fail", compile_fail, no_run }, - { "run", compile_ok, run }, - { "api", compile_api_ok, run }, -}; - -int main(int argc, char *argv[]) -{ - DIR *dir; - struct dirent *d; - char *testdir, *cwd; - const char *apiobj = ""; - char *libs = talloc_strdup(NULL, ""); - struct test *test; - unsigned int num_tests = 0, num_objs = 0, i; - - if (argc > 1 && streq(argv[1], "--verbose")) { - verbose = 1; - argc--; - argv++; - } - - while (argc > 1 && strstarts(argv[1], "--lib=")) { - libs = talloc_asprintf_append(libs, " -l%s", - argv[1] + strlen("--lib=")); - argc--; - argv++; - } - - if (argc > 1 && strstarts(argv[1], "--apiobj=")) { - apiobj = argv[1] + strlen("--apiobj="); - argc--; - argv++; - } - - if (argc < 2) - errx(1, "Usage: run_tests [--verbose] [--apiobj=] [...]"); - - testdir = talloc_asprintf(NULL, "%s/test", argv[1]); - dir = opendir(testdir); - if (!dir) - err(1, "Opening '%s'", testdir); - - while ((d = readdir(dir)) != NULL) { - if (d->d_name[0] == '.' || !strends(d->d_name, ".c")) - continue; - - for (i = 0; i < ARRAY_SIZE(test_types); i++) { - if (strstarts(d->d_name, test_types[i].name)) { - add_test(testdir, d->d_name, &test_types[i]); - num_tests++; - break; - } - } - if (i == ARRAY_SIZE(test_types)) { - add_obj(testdir, d->d_name, true); - num_objs++; - } - } - - plan_tests(num_tests + num_objs + (num_objs ? 1 : 0)); - /* First all the extra object compilations. */ - compile_objs(); - - /* Now add any object files from the command line */ - cwd = talloc_strdup(testdir, "."); - for (i = 2; i < argc; i++) - add_obj(cwd, argv[i], false); - - /* Do all the test compilations. */ - for (test = tests; test; test = test->next) - test->type->buildfn(argv[1], test->type, test->name, - apiobj, libs); - - cleanup_objs(); - - /* Now run all the ones which wanted to run. */ - for (test = tests; test; test = test->next) { - test->type->runfn(test->name); - cleanup(test->name); - } - - exit(exit_status()); -} diff --git a/tools/tools.h b/tools/tools.h index ed2f6bfb..5f5f119d 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -8,9 +8,8 @@ #define SPACE_CHARS " \f\n\r\t\v" -/* FIXME: Remove some -I */ /* FIXME: Nested functions break with -Wmissing-prototypes -Wmissing-declarations */ -#define CFLAGS "-g -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Werror -Iccan/ -I. -I.. -I../.." +#define CFLAGS "-g -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Werror -I../.." /* This actually compiles and runs the info file to get dependencies. */ char **get_deps(const void *ctx, const char *dir, const char *name,