1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/str/str.h>
17 static const char *can_build(struct manifest *m)
20 return "Safe mode enabled";
24 static int cleanup_testfile(char *testfile)
30 static char *objname(const void *ctx, const char *cfile)
32 return talloc_asprintf(ctx, "%.*s.o ", strlen(cfile) - 2, cfile);
35 static char *compile(struct manifest *m, const char *cfile)
39 obj = objname(m, cfile);
40 talloc_set_destructor(obj, cleanup_testfile);
41 return run_command(m, "cc " CFLAGS " -c -o %s %s", obj, cfile);
44 static void *do_compile_test_helpers(struct manifest *m)
49 list_for_each(&m->other_test_c_files, i, list) {
50 compile_tests.total_score++;
51 cmdout = compile(m, i->name);
53 return talloc_asprintf(m,
54 "Failed to compile helper C"
61 static const char *describe_compile_test_helpers(struct manifest *m,
67 struct ccanlint compile_test_helpers = {
68 .name = "Compiling test helper files",
70 .check = do_compile_test_helpers,
71 .describe = describe_compile_test_helpers,
75 REGISTER_TEST(compile_test_helpers, &depends_built);