aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-13 11:46:04 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-13 11:46:04 -0400
commitd44eb16b23829299f154e46984bf4be0d5036dea (patch)
tree073c12052d5f8c82578407fa42548ffd00a20cb3
parent4b646e30d8364e56fb6ae4ce5850f01e714eabcb (diff)
parent3ddfd5ff25b1319dee3a013c8dac02ff9121971e (diff)
downloadtor-d44eb16b23829299f154e46984bf4be0d5036dea.tar.gz
tor-d44eb16b23829299f154e46984bf4be0d5036dea.zip
Merge branch 'maint-0.3.4'
-rw-r--r--changes/bug276586
-rw-r--r--src/ext/tinytest.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/changes/bug27658 b/changes/bug27658
new file mode 100644
index 0000000000..8cc0aa4714
--- /dev/null
+++ b/changes/bug27658
@@ -0,0 +1,6 @@
+ o Minor bugfixes (testing):
+ - If a unit test running in a subprocess exits abnormally or with a
+ nonzero status code, treat the test as having failed, even if
+ the test reported success. Without this fix, memory leaks don't cause
+ cause the tests to fail, even with LeakSanitizer. Fixes bug 27658;
+ bugfix on 0.2.2.4-alpha.
diff --git a/src/ext/tinytest.c b/src/ext/tinytest.c
index 052fb6483f..16f11e4639 100644
--- a/src/ext/tinytest.c
+++ b/src/ext/tinytest.c
@@ -218,12 +218,20 @@ testcase_run_forked_(const struct testgroup_t *group,
r = (int)read(outcome_pipe[0], b, 1);
if (r == 0) {
printf("[Lost connection!] ");
- return 0;
+ return FAIL;
} else if (r != 1) {
perror("read outcome from pipe");
}
- waitpid(pid, &status, 0);
+ r = waitpid(pid, &status, 0);
close(outcome_pipe[0]);
+ if (r == -1) {
+ perror("waitpid");
+ return FAIL;
+ }
+ if (! WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+ printf("[did not exit cleanly.]");
+ return FAIL;
+ }
return b[0]=='Y' ? OK : (b[0]=='S' ? SKIP : FAIL);
}
#endif