X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fcheck_includes_build.c;h=7e0ab945f290dfaaa83e373b3255520a4e61fc20;hp=33668ed84c5ac3a3ccabe413e8dfb4298faa5dfd;hb=687cde2a8c561b68f17609b615eb930ea02f5aac;hpb=61088f5c752c555172e2ab6cf93a7967f79f3f2c diff --git a/tools/ccanlint/tests/check_includes_build.c b/tools/ccanlint/tests/check_includes_build.c index 33668ed8..7e0ab945 100644 --- a/tools/ccanlint/tests/check_includes_build.c +++ b/tools/ccanlint/tests/check_includes_build.c @@ -22,22 +22,13 @@ static const char *can_build(struct manifest *m) return NULL; } -static int cleanup_testfile(char *testfile) -{ - unlink(testfile); - return 0; -} - static void *check_includes_build(struct manifest *m) { char *contents; - char *tmpfile, *objfile; + char *tmpfile, *err; int fd; - tmpfile = talloc_strdup(m, tempnam("/tmp", "ccanlint")); - talloc_set_destructor(tmpfile, cleanup_testfile); - objfile = talloc_strdup(m, tempnam("/tmp", "ccanlint")); - talloc_set_destructor(objfile, cleanup_testfile); + tmpfile = temp_file(m, ".c"); fd = open(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600); if (fd < 0) @@ -52,8 +43,9 @@ static void *check_includes_build(struct manifest *m) } close(fd); - return run_command(m, "cc " CFLAGS " -o %s -c -x c %s", - objfile, tmpfile); + if (compile_object(m, tmpfile, &err)) + return NULL; + return err; } static const char *describe_includes_build(struct manifest *m,