Files
swift-mirror/test/Backtracing/CrashWithThunk.test
Alastair Houghton e47788232c [Backtracing][Test] Use !, not not.
`not` works on Windows, but not on Linux or Darwin.

rdar://101623384
2026-02-06 08:53:16 +00:00

53 lines
2.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %S/Inputs/CrashWithThunk.swift -parse-as-library -Onone %swift-debug-flags -o %t/CrashWithThunk.exe
// RUN: %target-codesign %t/CrashWithThunk.exe
// RUN: ! env SWIFT_BACKTRACE=enable=yes,cache=no %target-run %t/CrashWithThunk.exe > %t/CrashWithThunk.out 2>&1
// RUN: %FileCheck --ignore-case %s < %t/CrashWithThunk.out
// RUN: ! env SWIFT_BACKTRACE=preset=friendly,enable=yes,cache=no %target-run %t/CrashWithThunk.exe > %t/Friendly.out 2>&1
// RUN %FileCheck %s --ignore-case --check-prefix FRIENDLY < %t/Friendly.out
// UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime
// UNSUPPORTED: asan
// REQUIRES: executable_test
// REQUIRES: backtracing
// REQUIRES: OS=macosx || OS=linux-gnu || OS=windows-msvc
// CHECK: *** Program crashed: {{(Bad pointer dereference|Access violation)}} at 0x{{0+}}4 ***
// CHECK: Thread 0 {{(".*" )?}}crashed:
// CHECK: 0 0x{{[0-9a-f]+}} crash() + {{[0-9]+}} in CrashWithThunk.exe at {{.*[\\/]}}CrashWithThunk.swift:8:15
// CHECK-NEXT: 1 [ra] [thunk] 0x{{[0-9a-f]+}} thunk for @escaping @callee_guaranteed () -> () + {{[0-9]+}} in CrashWithThunk.exe at {{.*[\\/]}}<compiler-generated>
// CHECK-NEXT: 2 [ra] 0x{{[0-9a-f]+}} static CrashWithThunk.main() + {{[0-9]+}} in CrashWithThunk.exe at {{.*[\\/]}}CrashWithThunk.swift:16:9
// CHECK-NEXT: 3 [ra] [system] 0x{{[0-9a-f]+}} static CrashWithThunk.$main() + {{[0-9]+}} in CrashWithThunk.exe at {{.*[\\/]}}<compiler-generated>
// CHECK-NEXT: 4 [ra] [system] 0x{{[0-9a-f]+}} main + {{[0-9]+}} in CrashWithThunk.exe at {{.*[\\/]}}CrashWithThunk.swift
// CHECK: Registers:
// CHECK: Images ({{[0-9]+}} omitted):
// CHECK: {{0x[0-9a-f]+}}{{0x[0-9a-f]+}}{{ +}}{{[0-9a-f]+|<no build ID>}}{{ +}}CrashWithThunk.exe{{ +}}{{.*[\\/]}}CrashWithThunk.exe
// FRIENDLY: *** Program crashed: {{(Bad pointer dereference|Access violation)}} at 0x{{0+}}4 ***
// FRIENDLY: Thread 0 {{(".*" )?}}crashed:
// FRIENDLY: 0 crash() + {{[0-9]+}} in CrashWithThunk.exe at {{.*[\\/]}}CrashWithThunk.swift:8:15
// FRIENDLY: 6| print("I'm going to crash here")
// FRIENDLY-NEXT: 7| let ptr = UnsafeMutablePointer<Int>(bitPattern: 4)!
// FRIENDLY-NEXT: 8| ptr.pointee = 42
// FRIENDLY-NEXT: | ^
// FRIENDLY-NEXT: 9| }
// FRIENDLY-NEXT: 10|
// FRIENDLY: 1 static CrashWithThunk.main() + {{[0-9]+}} in CrashWithThunk.exe at {{.*[\\/]}}CrashWithThunk.swift:16:9
// FRIENDLY: 14| let foo = Foo(value: crash)
// FRIENDLY-NEXT: 15|
// FRIENDLY-NEXT: 16| foo.value()
// FRIENDLY-NEXT: | ^
// FRIENDLY-NEXT: 17| }
// FRIENDLY-NEXT: 18| }