Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,17 @@ for mode in debug release; do
fail "exited successfully but was supposed to fail"
else
exit_code=$?
# expecting illegal instruction as it should fail with an unacceptable errno
assert_equal $(( 128 + 4 )) $exit_code # 4 == SIGILL

# expecting irrecoverable error as process should be terminated through fatalError/precondition/assert
architecture=$(uname -m)
if [[ $architecture =~ ^(arm|aarch) ]]; then
assert_equal $exit_code $(( 128 + 5 )) # 5 == SIGTRAP aka trace trap, expected on ARM
elif [[ $architecture =~ ^(x86|i386) ]]; then
assert_equal $exit_code $(( 128 + 4 )) # 4 == SIGILL aka illegal instruction, expected on x86
else
fail "unknown CPU architecture for which we don't know the expected signal for a crash"
fi

if [[ "$mode" == "debug" ]]; then
grep -q unacceptable\ errno "$temp_file"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,17 @@ for mode in debug release; do
fail "exited successfully but was supposed to fail"
else
exit_code=$?
# expecting illegal instruction as it should fail with an unacceptable errno
assert_equal $(( 128 + 4 )) $exit_code # 4 == SIGILL

# expecting irrecoverable error as process should be terminated through fatalError/precondition/assert
architecture=$(uname -m)
if [[ $architecture =~ ^(arm|aarch) ]]; then
assert_equal $exit_code $(( 128 + 5 )) # 5 == SIGTRAP aka trace trap, expected on ARM
elif [[ $architecture =~ ^(x86|i386) ]]; then
assert_equal $exit_code $(( 128 + 4 )) # 4 == SIGILL aka illegal instruction, expected on x86
else
fail "unknown CPU architecture for which we don't know the expected signal for a crash"
fi

if [[ "$mode" == "debug" ]]; then
grep -q unacceptable\ errno "$temp_file"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,14 @@ if "$tmp/test"; then
fail "should have crashed"
else
exit_code=$?
assert_equal $(( 128 + 4 )) $exit_code # 4 == SIGILL

# expecting irrecoverable error as process should be terminated through fatalError/precondition/assert
architecture=$(uname -m)
if [[ $architecture =~ ^(arm|aarch) ]]; then
assert_equal $exit_code $(( 128 + 5 )) # 5 == SIGTRAP aka trace trap, expected on ARM
elif [[ $architecture =~ ^(x86|i386) ]]; then
assert_equal $exit_code $(( 128 + 4 )) # 4 == SIGILL aka illegal instruction, expected on x86
else
fail "unknown CPU architecture for which we don't know the expected signal for a crash"
fi
fi
10 changes: 8 additions & 2 deletions Sources/NIOCrashTester/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ func main() throws {
regex: String,
runResult: RunResult) throws -> InterpretedRunResult {
struct NoOutputFound: Error {}

guard case .signal(Int(SIGILL)) = runResult else {
#if arch(i386) || arch(x86_64)
let expectedSignal = SIGILL
#elseif arch(arm) || arch(arm64)
let expectedSignal = SIGTRAP
#else
#error("unknown CPU architecture for which we don't know the expected signal for a crash")
#endif
guard case .signal(Int(expectedSignal)) = runResult else {
return .unexpectedRunResult(runResult)
}

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.2004.main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
- MAX_ALLOCS_ALLOWED_1000_udp_reqs=12050
- MAX_ALLOCS_ALLOWED_1000_udpbootstraps=2050
- MAX_ALLOCS_ALLOWED_1000_udpconnections=81050
- MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=405000
- MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=409000
- MAX_ALLOCS_ALLOWED_bytebuffer_lots_of_rw=2050
- MAX_ALLOCS_ALLOWED_creating_10000_headers=0
- MAX_ALLOCS_ALLOWED_decode_1000_ws_frames=2050
Expand Down