Commit b7764474 authored by Rusty Russell's avatar Rusty Russell

We no longer make ccan/foo.o files, so use libccan.a in run_tests.

Handle case where test segfaults (fail on *any* non-zero exit)
parent f0bf01e9
...@@ -105,28 +105,10 @@ static int build(const char *dir, const char *name, int fail) ...@@ -105,28 +105,10 @@ static int build(const char *dir, const char *name, int fail)
{ {
const char *cmd; const char *cmd;
int ret; int ret;
char *externals = talloc_strdup(name, "");
char **deps;
for (deps = get_deps(talloc_autofree_context(), dir, true); *deps; deps++) { cmd = talloc_asprintf(name, "gcc " CFLAGS " %s -o %s %s %s -L. -lccan %s",
char *newobj;
struct stat st;
if (!strstarts(*deps, "ccan/"))
continue;
/* ccan/foo -> ccan/foo.o */
newobj = talloc_asprintf(name, "%s.o", *deps);
/* Only if it exists. Makefile sorts this out. */
if (stat(newobj, &st) == 0 || errno != ENOENT)
externals = talloc_asprintf_append(externals,
" %s", newobj);
}
cmd = talloc_asprintf(name, "gcc " CFLAGS " %s -o %s %s %s%s%s",
fail ? "-DFAIL" : "", fail ? "-DFAIL" : "",
output_name(name), name, obj_list(), externals, output_name(name), name, obj_list(),
verbose ? "" : "> /dev/null 2>&1"); verbose ? "" : "> /dev/null 2>&1");
if (verbose) if (verbose)
...@@ -158,8 +140,8 @@ static void no_run(const char *name) ...@@ -158,8 +140,8 @@ static void no_run(const char *name)
static void run(const char *name) static void run(const char *name)
{ {
if (system(output_name(name)) == -1) if (system(output_name(name)) != 0)
fail("running %s had error %m", name); fail("running %s had error", name);
} }
static void cleanup(const char *name) static void cleanup(const char *name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment