about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHeikki Kallasjoki <fis@zem.fi>2018-12-13 04:27:37 +0000
committerHeikki Kallasjoki <fis+github@zem.fi>2018-12-13 04:30:35 +0000
commit44e499db4074e7e22d7f74a34a048fa0271aedf8 (patch)
tree3545073d6335ad8c79e822937860cabddcb88688
parented420c134eb2c2533cf67aabe37f68fe86fd98fd (diff)
downloadnano-exporter-44e499db4074e7e22d7f74a34a048fa0271aedf8.tar.gz
nano-exporter-44e499db4074e7e22d7f74a34a048fa0271aedf8.tar.xz
nano-exporter-44e499db4074e7e22d7f74a34a048fa0271aedf8.zip
Run test cleanup when exiting via failure.
Fixes #12. Previously when a test escaped through the setjmp/longjmp
failure path, the `test_cleanup` function never ran, leaving the test
root directory in `/tmp`.
-rw-r--r--test/harness.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/harness.h b/test/harness.h
index 43d163b..7b7d1c3 100644
--- a/test/harness.h
+++ b/test/harness.h
@@ -40,7 +40,7 @@ void test_fail(test_env *env, const char *err, ...);
 
 #define RUN_TEST(name) do { \
     if (!test_start(env, #name)) return false; \
-    if (setjmp(*test_escape(env)) != 0) { success = false; break; } \
+    if (setjmp(*test_escape(env)) != 0) { test_cleanup(env); success = false; break; } \
     testcase_##name(env); \
     if (!test_cleanup(env)) return false; \
   } while (0)