diff options
-rw-r--r-- | tools/ccanlint/tests/depends_build_without_features.c | 4 | ||||
-rw-r--r-- | tools/ccanlint/tests/objects_build_without_features.c | 4 | ||||
-rw-r--r-- | tools/ccanlint/tests/reduce_features.c | 9 | ||||
-rw-r--r-- | tools/ccanlint/tests/reduce_features.h | 2 | ||||
-rw-r--r-- | tools/ccanlint/tests/tests_compile.c | 5 | ||||
-rw-r--r-- | tools/ccanlint/tests/tests_helpers_compile.c | 3 |
6 files changed, 19 insertions, 8 deletions
diff --git a/tools/ccanlint/tests/depends_build_without_features.c b/tools/ccanlint/tests/depends_build_without_features.c index 65728fc8..cf7185be 100644 --- a/tools/ccanlint/tests/depends_build_without_features.c +++ b/tools/ccanlint/tests/depends_build_without_features.c @@ -13,6 +13,7 @@ #include <err.h> #include <string.h> #include <ctype.h> +#include "reduce_features.h" #include "../compulsory_tests/build.h" static const char *can_build(struct manifest *m) @@ -30,7 +31,8 @@ static void check_depends_built_without_features(struct manifest *m, struct manifest *i; char *flags; - flags = talloc_asprintf(score, "%s -I.", cflags); + flags = talloc_asprintf(score, "%s %s", cflags, + REDUCE_FEATURES_FLAGS); list_for_each(&m->deps, i, list) { char *errstr = build_submodule(i, flags, COMPILE_NOFEAT); diff --git a/tools/ccanlint/tests/objects_build_without_features.c b/tools/ccanlint/tests/objects_build_without_features.c index 8174541c..477d3025 100644 --- a/tools/ccanlint/tests/objects_build_without_features.c +++ b/tools/ccanlint/tests/objects_build_without_features.c @@ -1,5 +1,6 @@ #include <tools/ccanlint/ccanlint.h> #include <ccan/talloc/talloc.h> +#include "reduce_features.h" #include "../compulsory_tests/build.h" static void check_objs_build_without_features(struct manifest *m, @@ -7,7 +8,8 @@ static void check_objs_build_without_features(struct manifest *m, unsigned int *timeleft, struct score *score) { - const char *flags = talloc_asprintf(score, "-I. %s", cflags); + const char *flags = talloc_asprintf(score, "%s %s", + REDUCE_FEATURES_FLAGS, cflags); build_objects(m, keep, score, flags, COMPILE_NOFEAT); } diff --git a/tools/ccanlint/tests/reduce_features.c b/tools/ccanlint/tests/reduce_features.c index aaeba751..39a2bde0 100644 --- a/tools/ccanlint/tests/reduce_features.c +++ b/tools/ccanlint/tests/reduce_features.c @@ -160,11 +160,14 @@ static void do_reduce_features(struct manifest *m, hdr = talloc_asprintf_append (hdr, "#undef %s\n#define %s 0\n", sym, sym); } - fd = open("config.h", O_EXCL|O_CREAT|O_RDWR, 0600); + if (mkdir("reduced-features", 0700) != 0) + err(1, "Creating reduced-features directory"); + + fd = open("reduced-features/config.h", O_EXCL|O_CREAT|O_RDWR, 0600); if (fd < 0) - err(1, "Creating config.h"); + err(1, "Creating reduced-features/config.h"); if (!write_all(fd, hdr, strlen(hdr))) - err(1, "Writing config.h"); + err(1, "Writing reduced-features/config.h"); close(fd); features_were_reduced = true; } diff --git a/tools/ccanlint/tests/reduce_features.h b/tools/ccanlint/tests/reduce_features.h index f646941a..09f4c798 100644 --- a/tools/ccanlint/tests/reduce_features.h +++ b/tools/ccanlint/tests/reduce_features.h @@ -1,4 +1,6 @@ #ifndef CCANLINT_REDUCE_FEATURES_H #define CCANLINT_REDUCE_FEATURES_H extern bool features_were_reduced; + +#define REDUCE_FEATURES_FLAGS "-Ireduced-features" #endif /* CCANLINT_REDUCE_FEATURES_H */ diff --git a/tools/ccanlint/tests/tests_compile.c b/tools/ccanlint/tests/tests_compile.c index 2e7cd264..db5ea33e 100644 --- a/tools/ccanlint/tests/tests_compile.c +++ b/tools/ccanlint/tests/tests_compile.c @@ -78,7 +78,8 @@ static bool compile(const void *ctx, flags = talloc_asprintf(ctx, "%s%s%s", fail ? "-DFAIL " : "", cflags, - ctype == COMPILE_NOFEAT ? " -I." : ""); + ctype == COMPILE_NOFEAT + ? " "REDUCE_FEATURES_FLAGS : ""); fname = maybe_temp_file(ctx, "", keep, file->fullname); if (!compile_and_link(ctx, file->fullname, ccan_dir, @@ -192,6 +193,6 @@ struct ccanlint tests_compile_without_features = { .name = "Module tests compile (without features)", .check = do_compile_tests_without_features, .can_run = features_reduced, - .needs = "tests_helpers_compile_without_features reduce_features" + .needs = "tests_helpers_compile_without_features objects_build_without_features" }; REGISTER_TEST(tests_compile_without_features); diff --git a/tools/ccanlint/tests/tests_helpers_compile.c b/tools/ccanlint/tests/tests_helpers_compile.c index d7c8f0ae..baa5309f 100644 --- a/tools/ccanlint/tests/tests_helpers_compile.c +++ b/tools/ccanlint/tests/tests_helpers_compile.c @@ -102,7 +102,8 @@ static void do_compile_test_helpers_without_features(struct manifest *m, { char *flags; - flags = talloc_asprintf(score, "%s -I.", cflags); + flags = talloc_asprintf(score, "%s %s", cflags, + REDUCE_FEATURES_FLAGS); compile_test_helpers(m, keep, timeleft, score, flags, COMPILE_NOFEAT); |