mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This converts the instances of the pattern for which we have a proper substitution in lit. This will make it easier to replace it appropriately with Windows equivalents.
84 lines
3.1 KiB
Plaintext
84 lines
3.1 KiB
Plaintext
|
|
// The tester will only work when asserts file
|
|
// REQUIRES: asserts
|
|
|
|
// We put in a bunch of checks since we are making platform specific assumptions
|
|
// about putchar, so we are being paranoid.
|
|
|
|
// REQUIRES: OS=macosx
|
|
// REQUIRES: CPU=x86_64
|
|
// REQUIRES: PTRSIZE=64
|
|
|
|
// Clear the temporary directory
|
|
// RUN: %empty-directory(%t)
|
|
|
|
// We use a driver file to ensure that we are not dependent on how main/start
|
|
// are setup on our platform. The c function interface that we use is very
|
|
// standard, so we should be ok to rely on it. Lets compile it.
|
|
// RUN: %target-swift-frontend -c %S/Inputs/bug-reducer-tester-miscompile-driver.swift -o %t/main.o
|
|
|
|
// Now test the base case. We emit a sib file/etc to make sure all of the
|
|
// components of our test work, even though we could just use a sil file
|
|
// directly.
|
|
// RUN: %target-sil-opt %s -emit-sib -o %t/good.sib -module-name main
|
|
// RUN: %target-swift-frontend -c %t/good.sib -o %t/good.o -module-name main
|
|
// RUN: %target-swiftc_driver -o %t/good %t/good.o %t/main.o -module-name main
|
|
// RUN: %t/good | %FileCheck %s
|
|
|
|
// Now try to insert a runtime crash and make sure that we hit the crash.
|
|
// RUN: %target-sil-opt -bug-reducer-tester %s -bug-reducer-tester-failure-kind=runtime-crasher -bug-reducer-tester-target-func='target_func' -emit-sib -o %t/runtime_crasher.sib -module-name main
|
|
// RUN: %target-swift-frontend -c %t/runtime_crasher.sib -o %t/runtime_crasher.o -module-name main
|
|
// RUN: %target-swiftc_driver -o %t/runtime_crasher %t/runtime_crasher.o %t/main.o -module-name main
|
|
// RUN: not --crash %t/runtime_crasher
|
|
|
|
// CHECK: swift
|
|
// CHECK: swift
|
|
// CHECK: swift
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
|
|
sil @putchar : $@convention(c) (Builtin.Int64) -> ()
|
|
|
|
sil [serialized] @target_func : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @putchar : $@convention(c) (Builtin.Int64) -> ()
|
|
// "swift\n" in ASCII
|
|
%1 = integer_literal $Builtin.Int64, 115
|
|
%2 = integer_literal $Builtin.Int64, 119
|
|
%3 = integer_literal $Builtin.Int64, 105
|
|
%4 = integer_literal $Builtin.Int64, 102
|
|
%5 = integer_literal $Builtin.Int64, 116
|
|
%6 = integer_literal $Builtin.Int64, 10
|
|
apply %0(%1) : $@convention(c) (Builtin.Int64) -> ()
|
|
apply %0(%2) : $@convention(c) (Builtin.Int64) -> ()
|
|
apply %0(%3) : $@convention(c) (Builtin.Int64) -> ()
|
|
apply %0(%4) : $@convention(c) (Builtin.Int64) -> ()
|
|
apply %0(%5) : $@convention(c) (Builtin.Int64) -> ()
|
|
apply %0(%6) : $@convention(c) (Builtin.Int64) -> ()
|
|
%9999 = tuple()
|
|
return %9999 : $()
|
|
}
|
|
|
|
sil [serialized] @function_2 : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @target_func : $@convention(thin) () -> ()
|
|
apply %0() : $@convention(thin) () -> ()
|
|
// Make sure we only eliminate one.
|
|
apply %0() : $@convention(thin) () -> ()
|
|
%1 = function_ref @function_3 : $@convention(thin) () -> ()
|
|
apply %1() : $@convention(thin) () -> ()
|
|
%9999 = tuple()
|
|
return %9999 : $()
|
|
}
|
|
|
|
sil [serialized] @function_3 : $@convention(thin) () -> () {
|
|
bb0:
|
|
// Make sure we only eliminate one.
|
|
%0 = function_ref @target_func : $@convention(thin) () -> ()
|
|
apply %0() : $@convention(thin) () -> ()
|
|
%9999 = tuple()
|
|
return %9999 : $()
|
|
}
|