mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Windows uses `\` for the path separator while other targets use `/` Use the correct seprator for calculating the basename of the executable to enable the test on Windows.
40 lines
800 B
Swift
40 lines
800 B
Swift
// RUN: %target-resilience-test
|
|
// REQUIRES: executable_test
|
|
|
|
// Check for the 'rth' tool itself, to make sure it's doing what we expect.
|
|
|
|
import rth
|
|
|
|
#if BEFORE
|
|
let clientIsAfter = false
|
|
#else
|
|
let clientIsAfter = true
|
|
#endif
|
|
|
|
let execPath = CommandLine.arguments.first!
|
|
#if os(Windows)
|
|
let execName = execPath.split(separator: "\\").last!
|
|
#else
|
|
let execName = execPath.split(separator: "/").last!
|
|
#endif
|
|
switch execName {
|
|
case "after_after":
|
|
precondition(clientIsAfter)
|
|
precondition(libIsAfter)
|
|
|
|
case "before_after":
|
|
precondition(clientIsAfter)
|
|
precondition(!libIsAfter)
|
|
|
|
case "before_before":
|
|
precondition(!clientIsAfter)
|
|
precondition(!libIsAfter)
|
|
|
|
case "after_before":
|
|
precondition(!clientIsAfter)
|
|
precondition(libIsAfter)
|
|
|
|
default:
|
|
fatalError("unknown exec name \(execName)")
|
|
}
|