Fix failing tests

This commit is contained in:
Wildan M
2026-01-05 14:38:11 +07:00
parent 11d2bcede6
commit 13b105a54e
4 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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);
}
+9 -9
View File
@@ -1,3 +1,4 @@
#include <stdio.h>
#include <assert.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -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);