Revert PR #2608: Manually revert commits 70c94d..f9c0b5

Closes: #2707
This commit is contained in:
Shirui Cheng 2025-07-15 15:44:14 -07:00 committed by Guangli Dai
parent ced8b3cffb
commit 2114349a4e
30 changed files with 124 additions and 1364 deletions

View file

@ -1,5 +1,34 @@
#include "test/jemalloc_test.h"
#include "test/fork.h"
#ifndef _WIN32
# include <sys/wait.h>
#endif
#ifndef _WIN32
static void
wait_for_child_exit(int pid) {
int status;
while (true) {
if (waitpid(pid, &status, 0) == -1) {
test_fail("Unexpected waitpid() failure.");
}
if (WIFSIGNALED(status)) {
test_fail(
"Unexpected child termination due to "
"signal %d",
WTERMSIG(status));
break;
}
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0) {
test_fail("Unexpected child exit value %d",
WEXITSTATUS(status));
}
break;
}
}
}
#endif
TEST_BEGIN(test_fork) {
#ifndef _WIN32
@ -37,7 +66,7 @@ TEST_BEGIN(test_fork) {
/* Child. */
_exit(0);
} else {
fork_wait_for_child_exit(pid);
wait_for_child_exit(pid);
}
#else
test_skip("fork(2) is irrelevant to Windows");
@ -60,7 +89,7 @@ do_fork_thd(void *arg) {
test_fail("Exec failed");
} else {
/* Parent */
fork_wait_for_child_exit(pid);
wait_for_child_exit(pid);
}
return NULL;
}
@ -97,7 +126,7 @@ TEST_BEGIN(test_fork_multithreaded) {
do_test_fork_multithreaded();
_exit(0);
} else {
fork_wait_for_child_exit(pid);
wait_for_child_exit(pid);
}
}
#else