Files
swift-mirror/test/Backtracing/EarlyMessage.swift
T
Alastair Houghton a9bebe632a [Test][Backtracer] Suppress warnings during EarlyMessage test.
Suppress warnings, otherwise we get an extra message we don't expect.

rdar://170801141
2026-02-21 10:38:06 +00:00

48 lines
1.1 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -parse-as-library -Onone -g -o %t/EarlyMessage.exe
// RUN: %target-codesign %t/EarlyMessage.exe
// RUN: ! env SWIFT_BACKTRACE=enable=yes,cache=no,warnings=suppressed %target-run %t/EarlyMessage.exe > %t/EarlyMessage.out 2>&1
// RUN: %FileCheck %s < %t/EarlyMessage.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
func level1() {
level2()
}
func level2() {
level3()
}
func level3() {
level4()
}
func level4() {
level5()
}
func level5() {
print("About to crash")
let ptr = UnsafeMutablePointer<Int>(bitPattern: 4)!
ptr.pointee = 42
}
@main
struct EarlyMessage {
static func main() {
level1()
}
}
// Make sure we get the early crash message from the backtracer (the first
// part is generated by the runtime itself; the "done ***" on the end is from
// swift-backtrace).
// CHECK: *** {{.*}}: Backtracing from 0x{{[0-9a-f]+}}... done ***