Putting the reduced config.h in the current directory means that it's
actually being picked up by other tests, such as the string checks.
So move it to a sub-directory where we need an explicit -I.
We also fix the dependencies, so that "--target
tests_pass_without_features" works.
#include <err.h>
#include <string.h>
#include <ctype.h>
#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)
#include "../compulsory_tests/build.h"
static const char *can_build(struct manifest *m)
struct manifest *i;
char *flags;
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);
list_for_each(&m->deps, i, list) {
char *errstr = build_submodule(i, flags, COMPILE_NOFEAT);
#include <tools/ccanlint/ccanlint.h>
#include <ccan/talloc/talloc.h>
#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,
#include "../compulsory_tests/build.h"
static void check_objs_build_without_features(struct manifest *m,
unsigned int *timeleft,
struct score *score)
{
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);
}
build_objects(m, keep, score, flags, COMPILE_NOFEAT);
}
hdr = talloc_asprintf_append
(hdr, "#undef %s\n#define %s 0\n", sym, sym);
}
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);
- err(1, "Creating config.h");
+ err(1, "Creating reduced-features/config.h");
if (!write_all(fd, hdr, strlen(hdr)))
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;
}
close(fd);
features_were_reduced = true;
}
#ifndef CCANLINT_REDUCE_FEATURES_H
#define CCANLINT_REDUCE_FEATURES_H
extern bool features_were_reduced;
#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 */
#endif /* CCANLINT_REDUCE_FEATURES_H */
flags = talloc_asprintf(ctx, "%s%s%s",
fail ? "-DFAIL " : "",
cflags,
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,
fname = maybe_temp_file(ctx, "", keep, file->fullname);
if (!compile_and_link(ctx, file->fullname, ccan_dir,
.name = "Module tests compile (without features)",
.check = do_compile_tests_without_features,
.can_run = features_reduced,
.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);
};
REGISTER_TEST(tests_compile_without_features);
- 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);
compile_test_helpers(m, keep, timeleft, score, flags,
COMPILE_NOFEAT);