1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/str/str.h>
5 #include <ccan/foreach/foreach.h>
18 static const char *can_run(struct manifest *m)
21 return "Safe mode enabled";
25 static void do_run_tests(struct manifest *m,
27 unsigned int *timeleft,
30 struct list_head *list;
35 foreach_ptr(list, &m->run_tests, &m->api_tests) {
36 list_for_each(list, i, list) {
38 if (run_command(m, timeleft, &cmdout, "%s",
42 score_file_error(score, i, 0, "%s", cmdout);
46 if (score->score == score->total)
50 /* Gcc's warn_unused_result is fascist bullshit. */
51 #define doesnt_matter()
53 static void run_under_debugger(struct manifest *m, struct score *score)
56 struct file_error *first;
58 if (!ask("Should I run the first failing test under the debugger?"))
61 first = list_top(&score->per_file_errors, struct file_error, list);
62 command = talloc_asprintf(m, "gdb -ex 'break tap.c:132' -ex 'run' %s",
63 first->file->compiled);
68 struct ccanlint tests_pass = {
70 .name = "Module's run and api tests pass",
71 .check = do_run_tests,
72 .handle = run_under_debugger,
74 .needs = "tests_compile"
77 REGISTER_TEST(tests_pass);
79 struct ccanlint tests_pass_without_features = {
80 .key = "tests_pass_without_features",
81 .name = "Module's run and api tests pass (without features)",
82 .check = do_run_tests,
83 .handle = run_under_debugger,
84 .needs = "tests_pass reduce_features"
87 REGISTER_TEST(tests_pass_without_features);