diff --git a/test/syscalls/linux/BUILD b/test/syscalls/linux/BUILD index 1f1d66b3a5..3db8109b4e 100644 --- a/test/syscalls/linux/BUILD +++ b/test/syscalls/linux/BUILD @@ -2444,12 +2444,15 @@ cc_binary( deps = [ "//test/util:capability_util", "//test/util:cleanup", + "//test/util:fs_util", + "//test/util:posix_error", "//test/util:proc_util", "//test/util:test_main", "//test/util:test_util", "//test/util:thread_util", "@com_google_absl//absl/algorithm:container", "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", ], ) diff --git a/test/syscalls/linux/rlimits.cc b/test/syscalls/linux/rlimits.cc index 142469610f..092e273802 100644 --- a/test/syscalls/linux/rlimits.cc +++ b/test/syscalls/linux/rlimits.cc @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include #include @@ -20,16 +21,15 @@ #include #include -#include -#include #include #include #include "absl/algorithm/container.h" -#include "absl/strings/numbers.h" -#include "absl/strings/str_split.h" +#include "absl/strings/str_format.h" #include "test/util/capability_util.h" #include "test/util/cleanup.h" +#include "test/util/fs_util.h" +#include "test/util/posix_error.h" #include "test/util/proc_util.h" #include "test/util/test_util.h" #include "test/util/thread_util.h" @@ -130,11 +130,12 @@ TEST(RlimitTest, RlimitNProc) { for (int i = 0; i < kNProc; i++) { pid_t pid = fork(); if (pid == 0) { - while (1) { - sleep(1); + // Child process: Wait passively until the parent terminates us. + while (true) { + pause(); } - _exit(1); } + // Parent process: Record the child's PID and continue the test. EXPECT_THAT(pid, SyscallSucceeds()); pids[i] = pid; }