From 13b105a54e2c4ed1b2f9841e7eeb80a8194d71e1 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 5 Jan 2026 14:38:11 +0700 Subject: [PATCH] Fix failing tests --- .gitlab-ci.yml | 2 +- tests/signals/kill-child.c | 4 ++-- tests/src/main.rs | 2 +- tests/waitpid_multiple.c | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 398c2c1a53..7084537f09 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,6 +66,6 @@ test:aarch64: needs: [aarch64] image: "redoxos/redoxer:aarch64" script: - - ./check.sh --arch=aarch64 --test + - timeout -s KILL 9m ./check.sh --arch=aarch64 --test #TODO: Enable more arch once dynamic linker working diff --git a/tests/signals/kill-child.c b/tests/signals/kill-child.c index 3db868c984..c2644bd670 100644 --- a/tests/signals/kill-child.c +++ b/tests/signals/kill-child.c @@ -36,7 +36,7 @@ void child_proc(int signum) sigemptyset(&act.sa_mask); sigaction(signum, &act, NULL); - status = usleep(200); + status = usleep(200000); ERROR_IF(usleep, status, == 0); assert(sig_handled != 0); @@ -48,7 +48,7 @@ void parent(int signum, pid_t pid) { int status; - usleep(100); + usleep(100000); status = kill(pid, signum); ERROR_IF(kill, status, != 0); diff --git a/tests/src/main.rs b/tests/src/main.rs index 5607e3ad90..d6b6f8edef 100644 --- a/tests/src/main.rs +++ b/tests/src/main.rs @@ -205,7 +205,7 @@ fn main() { } if let Err(e) = exit_status.exit_ok() { - let failure = format!("test return error: {}", e); + let failure = format!("# {}: {}", bin, e); println!("{}", failure); failures.push(failure); } diff --git a/tests/waitpid_multiple.c b/tests/waitpid_multiple.c index 7f1df48ff9..838b5c7659 100644 --- a/tests/waitpid_multiple.c +++ b/tests/waitpid_multiple.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -6,16 +7,14 @@ #include "test_helpers.h" int main(void) { - // Spawn two children, one with same pgid and one with pgid set to its own - // pid, so that the one with different pgid completes first. Then test - // waitpid both for 'any child' and for 'any child with same pgid'. + // Spawn three childrens, one with same pgid and two with pgid set to its own + // pid, so the exit order is two different pgid, then followed with same pgid pid_t pid_samepgid = fork(); ERROR_IF(fork, pid_samepgid, == -1); if (pid_samepgid == 0) { - // child - usleep(200); + usleep(300000); _Exit(2); } pid_t pid_diffpgids[2]; @@ -26,9 +25,7 @@ int main(void) { if (pid_diffpgids[i] == 0) { int ret = setpgid(0, 0); ERROR_IF(setpgid, ret, == -1); - - // child - usleep(100); + usleep((i + 1) * 100000); _Exit(i); } } @@ -38,6 +35,7 @@ int main(void) { // First, check that the first different-pgid proc is recognized. wid = waitpid(-1, &status, 0); ERROR_IF(waitpid, wid, == -1); + printf("wait 1: got %d, expected %d\n", wid, pid_diffpgids[0]); assert(wid == pid_diffpgids[0]); assert(WIFEXITED(status)); assert(WEXITSTATUS(status) == 0); @@ -45,13 +43,15 @@ int main(void) { // Then, check that the longest-waiting proc with the same pgid is properly matched. wid = waitpid(0, &status, 0); ERROR_IF(waitpid, wid, == -1); + printf("wait 2: got %d, expected %d\n", wid, pid_samepgid); assert(wid == pid_samepgid); assert(WIFEXITED(status)); assert(WEXITSTATUS(status) == 2); - // Finally, the last same-pgid must have completed. + // Finally, the last different-pgid must have completed. wid = waitpid(-1, &status, WNOHANG); ERROR_IF(waitpid, wid, == -1); + printf("wait 3: got %d, expected %d\n", wid, pid_diffpgids[1]); assert(wid == pid_diffpgids[1]); assert(WIFEXITED(status)); assert(WEXITSTATUS(status) == 1);