From f3948bf8102ce5281460e6ed6053150a96d71a91 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 28 Sep 2009 13:50:25 +0930 Subject: [PATCH] Fix "make check": this is temporary until we use ccanlint for it. --- ccan/grab_file/test/run-grab.c | 7 ++++++- tools/run_tests.c | 9 +++++---- tools/tools.h | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ccan/grab_file/test/run-grab.c b/ccan/grab_file/test/run-grab.c index 357a88b3..3c44ce05 100644 --- a/ccan/grab_file/test/run-grab.c +++ b/ccan/grab_file/test/run-grab.c @@ -19,6 +19,9 @@ main(int argc, char *argv[]) struct stat st; str = grab_file(NULL, "test/run-grab.c", NULL); + /* FIXME: run_tests runs us from top level dir. Kill this */ + if (!str) + str = grab_file(NULL, "ccan/grab_file/test/run-grab.c", NULL); split = strsplit(NULL, str, "\n", NULL); length = strlen(split[0]); ok1(streq(split[0], "/* This is test for grab_file() function")); @@ -26,7 +29,9 @@ main(int argc, char *argv[]) length += strlen(split[i]); ok1(streq(split[i-1], "/* End of grab_file() test */")); if (stat("test/run-grab.c", &st) != 0) - err(1, "Could not stat self"); + /* FIXME: ditto */ + if (stat("ccan/grab_file/test/run-grab.c", &st) != 0) + err(1, "Could not stat self"); ok1(st.st_size == length + i); return 0; diff --git a/tools/run_tests.c b/tools/run_tests.c index e50d1910..5ba276fe 100644 --- a/tools/run_tests.c +++ b/tools/run_tests.c @@ -46,7 +46,7 @@ static char *output_name(const char *name) return ret; } -static char *obj_list(void) +static char *obj_list(const char *dir) { char *list = talloc_strdup(objs, ""); struct obj *i; @@ -55,7 +55,8 @@ static char *obj_list(void) list = talloc_asprintf_append(list, "%s ", i->name); /* FIXME */ - list = talloc_asprintf_append(list, "ccan/tap/tap.o"); + if (!streq(dir, "tap") && !strends(dir, "/tap")) + list = talloc_asprintf_append(list, "ccan/tap/tap.o"); return list; } @@ -110,8 +111,8 @@ static int build(const char *dir, const char *name, const char *apiobj, cmd = talloc_asprintf(name, "gcc " CFLAGS " %s -o %s %s %s %s%s %s", fail ? "-DFAIL" : "", - output_name(name), name, apiobj, obj_list(), libs, - verbose ? "" : "> /dev/null 2>&1"); + output_name(name), name, apiobj, obj_list(dir), + libs, verbose ? "" : "> /dev/null 2>&1"); if (verbose) fprintf(stderr, "Running %s\n", cmd); diff --git a/tools/tools.h b/tools/tools.h index 6f732378..cc004036 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -9,7 +9,7 @@ #define SPACE_CHARS " \f\n\r\t\v" /* FIXME: Remove some -I */ -#define CFLAGS "-O -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan/ -I.. -I../.." +#define CFLAGS "-O -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan/ -I. -I.. -I../.." /* This actually compiles and runs the info file to get dependencies. */ char **get_deps(const void *ctx, const char *dir, const char *name, -- 2.39.2