Skip to content

Commit 0b63e62

Browse files
avoid unstable test
1 parent 0a36d86 commit 0b63e62

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

libc/test/src/sys/mman/linux/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ add_libc_unittest(
197197
libc.src.signal.kill
198198
libc.include.signal
199199
libc.src.stdlib.exit
200+
libc.src.signal.raise
200201
libc.src.__support.OSUtil.osutil
201202
libc.src.__support.threads.sleep
202203
libc.test.UnitTest.ErrnoSetterMatcher

libc/test/src/sys/mman/linux/process_mrelease_test.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
10-
#include "src/__support/threads/sleep.h"
1110
#include "src/errno/libc_errno.h"
1211
#include "src/signal/kill.h"
12+
#include "src/signal/raise.h"
1313
#include "src/stdlib/exit.h"
1414
#include "src/sys/mman/process_mrelease.h"
1515
#include "src/unistd/close.h"
@@ -30,13 +30,11 @@ TEST(LlvmLibcProcessMReleaseTest, NoError) {
3030
EXPECT_GE(child_pid, 0);
3131

3232
if (child_pid == 0) {
33-
// Child process: wait a bit then exit gracefully.
34-
LIBC_NAMESPACE::sleep_briefly();
35-
LIBC_NAMESPACE::exit(0);
33+
// pause the child process
34+
LIBC_NAMESPACE::raise(SIGSTOP);
3635
} else {
3736
// Parent process: wait a bit and then kill the child.
3837
// Give child process some time to start.
39-
LIBC_NAMESPACE::sleep_briefly();
4038
int pidfd = pidfd_open(child_pid, 0);
4139
EXPECT_GE(pidfd, 0);
4240

@@ -54,12 +52,9 @@ TEST(LlvmLibcProcessMReleaseTest, ErrorNotKilled) {
5452
EXPECT_GE(child_pid, 0);
5553

5654
if (child_pid == 0) {
57-
// Child process: wait a bit then exit gracefully.
58-
LIBC_NAMESPACE::sleep_briefly();
59-
LIBC_NAMESPACE::exit(0);
55+
// pause the child process
56+
LIBC_NAMESPACE::raise(SIGSTOP);
6057
} else {
61-
// Give child process some time to start.
62-
LIBC_NAMESPACE::sleep_briefly();
6358
int pidfd = pidfd_open(child_pid, 0);
6459
EXPECT_GE(pidfd, 0);
6560

0 commit comments

Comments
 (0)