]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/run_tests_valgrind.c
ccanlint: with -vv, give details on attempts to compile examples.
[ccan] / tools / ccanlint / tests / run_tests_valgrind.c
index 233a719dfb3eddfec896eeda3daa8ec48ed6320e..4b425ea23ba59d7baa3d689ddbbd58355596af8f 100644 (file)
@@ -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);
@@ -39,22 +39,14 @@ static void *do_run_tests_vg(struct manifest *m,
        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;
@@ -66,7 +58,8 @@ static void *do_run_tests_vg(struct manifest *m,
        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;
@@ -80,9 +73,6 @@ static void *do_run_tests_vg(struct manifest *m,
                list = NULL;
        }
 
-       if (chdir(olddir) != 0)
-               err(1, "Could not chdir to %s", olddir);
-
        return list;
 }