diff --git a/IntegrationTests/tests_02_syscall_wrappers/test_02_unacceptable_errnos.sh b/IntegrationTests/tests_02_syscall_wrappers/test_02_unacceptable_errnos.sh index 6ab2c8d362..880d574f09 100644 --- a/IntegrationTests/tests_02_syscall_wrappers/test_02_unacceptable_errnos.sh +++ b/IntegrationTests/tests_02_syscall_wrappers/test_02_unacceptable_errnos.sh @@ -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 diff --git a/IntegrationTests/tests_02_syscall_wrappers/test_03_unacceptable_read_errnos.sh b/IntegrationTests/tests_02_syscall_wrappers/test_03_unacceptable_read_errnos.sh index 442f9d8279..77249bcf32 100644 --- a/IntegrationTests/tests_02_syscall_wrappers/test_03_unacceptable_read_errnos.sh +++ b/IntegrationTests/tests_02_syscall_wrappers/test_03_unacceptable_read_errnos.sh @@ -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 diff --git a/IntegrationTests/tests_05_assertions/test_01_syscall_wrapper_fast.sh b/IntegrationTests/tests_05_assertions/test_01_syscall_wrapper_fast.sh index d3d366f18b..1ab5ac3cb2 100644 --- a/IntegrationTests/tests_05_assertions/test_01_syscall_wrapper_fast.sh +++ b/IntegrationTests/tests_05_assertions/test_01_syscall_wrapper_fast.sh @@ -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 diff --git a/Sources/NIOCrashTester/main.swift b/Sources/NIOCrashTester/main.swift index a2e589bfe4..868b5934e0 100644 --- a/Sources/NIOCrashTester/main.swift +++ b/Sources/NIOCrashTester/main.swift @@ -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) } diff --git a/docker/docker-compose.2004.main.yaml b/docker/docker-compose.2004.main.yaml index 69c49db0d5..e400fe9dec 100644 --- a/docker/docker-compose.2004.main.yaml +++ b/docker/docker-compose.2004.main.yaml @@ -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