X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Frun_tests_valgrind.c;h=4b425ea23ba59d7baa3d689ddbbd58355596af8f;hb=a560351e7c4fc40039ba25ff5a48b0a6d7bf0c90;hp=3c6fb81cbcdd9988e9bf00e9c3b89e4a4b44b4a2;hpb=304652023042670b3173de0ad5dc0eb7c836618c;p=ccan diff --git a/tools/ccanlint/tests/run_tests_valgrind.c b/tools/ccanlint/tests/run_tests_valgrind.c index 3c6fb81c..4b425ea2 100644 --- a/tools/ccanlint/tests/run_tests_valgrind.c +++ b/tools/ccanlint/tests/run_tests_valgrind.c @@ -18,7 +18,7 @@ static const char *can_run_vg(struct manifest *m) { unsigned int timeleft = default_timeout_ms; - char *output = run_command(m, &timeleft, "valgrind -q true"); + char *output = run_command(m, &timeleft, "valgrind -q --error-exitcode=0 true"); if (output) return talloc_asprintf(m, "No valgrind support: %s", output); @@ -31,28 +31,22 @@ struct run_tests_result { const char *output; }; -static void *do_run_tests_vg(struct manifest *m, unsigned int *timeleft) +static void *do_run_tests_vg(struct manifest *m, + bool keep, + unsigned int *timeleft) { struct list_head *list = talloc(m, struct list_head); struct run_tests_result *res; struct ccan_file *i; char *cmdout; - char *olddir; - - /* We run tests in the module directory, so any paths - * referenced can all be module-local. */ - olddir = talloc_getcwd(m); - if (!olddir) - err(1, "Could not save cwd"); - if (chdir(m->dir) != 0) - err(1, "Could not chdir to %s", m->dir); list_head_init(list); list_for_each(&m->run_tests, i, list) { run_tests_vg.total_score++; cmdout = run_command(m, timeleft, - "valgrind -q %s", i->compiled); + "valgrind -q --error-exitcode=100 %s", + i->compiled); if (cmdout) { res = talloc(list, struct run_tests_result); res->file = i; @@ -64,7 +58,8 @@ static void *do_run_tests_vg(struct manifest *m, unsigned int *timeleft) list_for_each(&m->api_tests, i, list) { run_tests_vg.total_score++; cmdout = run_command(m, timeleft, - "valgrind -q %s", i->compiled); + "valgrind -q --error-exitcode=100 %s", + i->compiled); if (cmdout) { res = talloc(list, struct run_tests_result); res->file = i; @@ -78,9 +73,6 @@ static void *do_run_tests_vg(struct manifest *m, unsigned int *timeleft) list = NULL; } - if (chdir(olddir) != 0) - err(1, "Could not chdir to %s", olddir); - return list; } @@ -128,7 +120,7 @@ static void run_under_debugger_vg(struct manifest *m, void *check_result) } struct ccanlint run_tests_vg = { - .key = "valgrind", + .key = "valgrind-tests", .name = "Module's run and api tests succeed under valgrind", .score = score_run_tests_vg, .check = do_run_tests_vg,