Browse Source

ccan: update to get configurator with --wrapper option

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
6209ae1abf
  1. 2
      ccan/README
  2. 2
      ccan/ccan/bitmap/bitmap.h
  3. 4
      ccan/ccan/json_out/json_out.h
  4. 22
      ccan/tools/configurator/configurator.c

2
ccan/README

@ -1,3 +1,3 @@
CCAN imported from http://ccodearchive.net. CCAN imported from http://ccodearchive.net.
CCAN version: init-2488-g7aac849a CCAN version: init-2491-ga1f9c169

2
ccan/ccan/bitmap/bitmap.h

@ -21,7 +21,7 @@ typedef unsigned long bitmap_word;
/* /*
* We wrap each word in a structure for type checking. * We wrap each word in a structure for type checking.
*/ */
typedef struct { typedef struct bitmap {
bitmap_word w; bitmap_word w;
} bitmap; } bitmap;

4
ccan/ccan/json_out/json_out.h

@ -87,11 +87,11 @@ bool json_out_end(struct json_out *jout, char type);
* If the resulting string requires escaping, and @quote is true, we * If the resulting string requires escaping, and @quote is true, we
* call json_escape(). * call json_escape().
*/ */
PRINTF_FMT(4,5)
bool json_out_add(struct json_out *jout, bool json_out_add(struct json_out *jout,
const char *fieldname, const char *fieldname,
bool quote, bool quote,
const char *fmt, ...) const char *fmt, ...);
PRINTF_FMT(4,5);
/** /**
* json_out_addv - add a formatted member (vararg variant) * json_out_addv - add a formatted member (vararg variant)

22
ccan/tools/configurator/configurator.c

@ -639,7 +639,7 @@ static struct test *find_test(const char *name)
#define MAIN_BODY_BOILERPLATE "return 0;\n" #define MAIN_BODY_BOILERPLATE "return 0;\n"
#define MAIN_END_BOILERPLATE "}\n" #define MAIN_END_BOILERPLATE "}\n"
static bool run_test(const char *cmd, struct test *test) static bool run_test(const char *cmd, const char *wrapper, struct test *test)
{ {
char *output, *newcmd; char *output, *newcmd;
FILE *outf; FILE *outf;
@ -667,7 +667,7 @@ static bool run_test(const char *cmd, struct test *test)
dep++; dep++;
positive = false; positive = false;
} }
if (run_test(cmd, find_test(dep)) != positive) { if (run_test(cmd, wrapper, find_test(dep)) != positive) {
test->answer = false; test->answer = false;
test->done = true; test->done = true;
return test->answer; return test->answer;
@ -757,7 +757,14 @@ static bool run_test(const char *cmd, struct test *test)
/* We run INSIDE_MAIN tests for sanity checking. */ /* We run INSIDE_MAIN tests for sanity checking. */
if (strstr(test->style, "EXECUTE") if (strstr(test->style, "EXECUTE")
|| strstr(test->style, "INSIDE_MAIN")) { || strstr(test->style, "INSIDE_MAIN")) {
output = run("." DIR_SEP OUTPUT_FILE, &status); char *cmd = malloc(strlen(wrapper) + strlen(" ." DIR_SEP OUTPUT_FILE) + 1);
strcpy(cmd, wrapper);
strcat(cmd, " ." DIR_SEP OUTPUT_FILE);
output = run(cmd, &status);
if (wrapper) {
free(cmd);
}
if (!strstr(test->style, "EXECUTE") && status != 0) if (!strstr(test->style, "EXECUTE") && status != 0)
c12r_errx(EXIT_BAD_TEST, c12r_errx(EXIT_BAD_TEST,
"Test for %s failed with %i:\n%s", "Test for %s failed with %i:\n%s",
@ -908,6 +915,7 @@ int main(int argc, const char *argv[])
= { "", DEFAULT_COMPILER, DEFAULT_FLAGS, NULL }; = { "", DEFAULT_COMPILER, DEFAULT_FLAGS, NULL };
const char *outflag = DEFAULT_OUTPUT_EXE_FLAG; const char *outflag = DEFAULT_OUTPUT_EXE_FLAG;
const char *configurator_cc = NULL; const char *configurator_cc = NULL;
const char *wrapper = "";
const char *orig_cc; const char *orig_cc;
const char *varfile = NULL; const char *varfile = NULL;
const char *headerfile = NULL; const char *headerfile = NULL;
@ -919,7 +927,7 @@ int main(int argc, const char *argv[])
while (argc > 1) { while (argc > 1) {
if (strcmp(argv[1], "--help") == 0) { if (strcmp(argv[1], "--help") == 0) {
printf("Usage: configurator [-v] [--var-file=<filename>] [-O<outflag>] [--configurator-cc=<compiler-for-tests>] [--autotools-style] [--extra-tests] [<compiler> <flags>...]\n" printf("Usage: configurator [-v] [--var-file=<filename>] [-O<outflag>] [--configurator-cc=<compiler-for-tests>] [--wrapper=<wrapper-for-tests>] [--autotools-style] [--extra-tests] [<compiler> <flags>...]\n"
" <compiler> <flags> will have \"<outflag> <outfile> <infile.c>\" appended\n" " <compiler> <flags> will have \"<outflag> <outfile> <infile.c>\" appended\n"
"Default: %s %s %s\n", "Default: %s %s %s\n",
DEFAULT_COMPILER, DEFAULT_FLAGS, DEFAULT_COMPILER, DEFAULT_FLAGS,
@ -948,6 +956,10 @@ int main(int argc, const char *argv[])
configurator_cc = argv[1] + 18; configurator_cc = argv[1] + 18;
argc--; argc--;
argv++; argv++;
} else if (strncmp(argv[1], "--wrapper=", 10) == 0) {
wrapper = argv[1] + 10;
argc--;
argv++;
} else if (strncmp(argv[1], "--var-file=", 11) == 0) { } else if (strncmp(argv[1], "--var-file=", 11) == 0) {
varfile = argv[1] + 11; varfile = argv[1] + 11;
argc--; argc--;
@ -995,7 +1007,7 @@ int main(int argc, const char *argv[])
end_test(1); end_test(1);
} }
for (i = 0; tests[i].name; i++) for (i = 0; tests[i].name; i++)
run_test(cmd, &tests[i]); run_test(cmd, wrapper, &tests[i]);
free(cmd); free(cmd);
remove(OUTPUT_FILE); remove(OUTPUT_FILE);

Loading…
Cancel
Save