mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
posix: fix test on netbsd
This commit is contained in:
@@ -408,7 +408,7 @@ SA_Flags_Bits :: enum c.int {
|
|||||||
RESTART = log2(SA_RESTART),
|
RESTART = log2(SA_RESTART),
|
||||||
// Cause extra information to be passed to signal handlers at the time of receipt of a signal.
|
// Cause extra information to be passed to signal handlers at the time of receipt of a signal.
|
||||||
SIGINFO = log2(SA_SIGINFO),
|
SIGINFO = log2(SA_SIGINFO),
|
||||||
// Cause implemention not to create zombie processes or status information on child termination.
|
// Cause implementation not to create zombie processes or status information on child termination.
|
||||||
NOCLDWAIT = log2(SA_NOCLDWAIT),
|
NOCLDWAIT = log2(SA_NOCLDWAIT),
|
||||||
// Cause signal not to be automatically blocked on entry to signal handler.
|
// Cause signal not to be automatically blocked on entry to signal handler.
|
||||||
SA_NODEFER = log2(SA_NODEFER),
|
SA_NODEFER = log2(SA_NODEFER),
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ when ODIN_OS == .Darwin {
|
|||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
_WEXITSTATUS :: #force_inline proc "contextless" (x: c.int) -> c.int {
|
_WEXITSTATUS :: #force_inline proc "contextless" (x: c.int) -> c.int {
|
||||||
return (x >> 8) & 0x000000ff
|
return c.int((c.uint(x) >> 8) & 0xff)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
@@ -310,7 +310,7 @@ when ODIN_OS == .Darwin {
|
|||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
_WSTOPSIG :: #force_inline proc "contextless" (x: c.int) -> Signal {
|
_WSTOPSIG :: #force_inline proc "contextless" (x: c.int) -> Signal {
|
||||||
return Signal((x >> 8) & 0xff)
|
return Signal(c.int((c.uint(x) >> 8) & 0xff))
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
|
|||||||
@@ -249,10 +249,21 @@ test_signal :: proc(t: ^testing.T) {
|
|||||||
case 0:
|
case 0:
|
||||||
posix.exit(69)
|
posix.exit(69)
|
||||||
case:
|
case:
|
||||||
status: i32
|
for {
|
||||||
posix.waitpid(pid, &status, {})
|
status: i32
|
||||||
testing.expect(t, posix.WIFEXITED(status))
|
res := posix.waitpid(pid, &status, {})
|
||||||
testing.expect(t, posix.WEXITSTATUS(status) == 69)
|
if res == -1 {
|
||||||
|
if !testing.expect_value(t, posix.errno(), posix.Errno.EINTR) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if posix.WIFEXITED(status) || posix.WIFSIGNALED(status) {
|
||||||
|
testing.expect(t, posix.WIFEXITED(status))
|
||||||
|
testing.expect(t, posix.WEXITSTATUS(status) == 69)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user