Skip to content

Commit 920b2f7

Browse files
authored
Merge pull request swiftlang#22415 from drodriguez/standarize-darwin-glibc-msvcrt
[tests] Standarize the checks for Darwin, Glibc and MSVCRT.
2 parents b69bd97 + d08b46c commit 920b2f7

30 files changed

+186
-108
lines changed

test/ClangImporter/availability_returns_twice.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// RUN: %target-typecheck-verify-swift
22
// UNSUPPORTED: OS=windows-msvc
33

4-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
4+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
55
import Darwin
66
typealias JumpBuffer = Int32
7-
#elseif os(Android) || os(Cygwin) || os(FreeBSD) || os(Linux)
7+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
88
import Glibc
99
typealias JumpBuffer = jmp_buf
10+
#else
11+
#error("Unsupported platform")
1012
#endif
1113

1214
func test_unavailable_returns_twice_function() {

test/ClangImporter/clang_builtins.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// RUN: not %target-swift-frontend -typecheck %s 2>&1 | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-%target-runtime %s
22

3-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
3+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
44
import Darwin
5-
#elseif os(Android) || os(Cygwin) || os(FreeBSD) || os(Linux)
5+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
66
import Glibc
77
#elseif os(Windows)
88
import MSVCRT
9+
#else
10+
#error("Unsupported platform")
911
#endif
1012

1113
func test() {

test/Fuzzing/fuzzer_test.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
// XFAIL: OS=watchos
99
// CHECK: Crash!
1010

11-
#if os(macOS) || os(iOS)
12-
import Darwin
13-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
14-
import Glibc
11+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
12+
import Darwin
13+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
14+
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
17+
#else
18+
#error("Unsupported platform")
1519
#endif
1620

1721
@_cdecl("LLVMFuzzerTestOneInput") public func fuzzOneInput(Data: UnsafePointer<CChar>, Size: CLong) -> CInt {

test/Fuzzing/fuzzer_test_simpler.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
// XFAIL: OS=tvos
99
// XFAIL: OS=watchos
1010

11-
#if os(macOS) || os(iOS)
12-
import Darwin
13-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
14-
import Glibc
11+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
12+
import Darwin
13+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
14+
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
17+
#else
18+
#error("Unsupported platform")
1519
#endif
1620

1721
@_cdecl("LLVMFuzzerTestOneInput") public func fuzzOneInput(Data: UnsafePointer<CChar>, Size: CLong) -> CInt {

test/IRGen/builtin_math.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// RUN: %target-swift-frontend -emit-ir -O %s | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-%target-os
22

3-
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
4-
import Darwin
5-
#elseif os(Android) || os(Cygwin) || os(FreeBSD) || os(Linux)
6-
import Glibc
3+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
4+
import Darwin
5+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
6+
import Glibc
77
#elseif os(Windows)
8-
import MSVCRT
8+
import MSVCRT
9+
#else
10+
#error("Unsupported platform")
911
#endif
1012

1113
// Make sure we use an intrinsic for functions such as exp.

test/IRGen/sanitize_coverage.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,8bit-counters %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_8BIT_COUNTERS
99
// RUN: %target-swift-frontend -emit-ir -sanitize=fuzzer %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_TRACE_CMP
1010

11-
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
12-
import Darwin
13-
#elseif os(Android) || os(Cygwin) || os(FreeBSD) || os(Linux)
14-
import Glibc
11+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
12+
import Darwin
13+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
14+
import Glibc
1515
#elseif os(Windows)
16-
import MSVCRT
16+
import MSVCRT
17+
#else
18+
#error("Unsupported platform")
1719
#endif
1820

1921
// FIXME: We should have a reliable way of triggering an indirect call in the

test/Interpreter/SDK/libc.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
// TODO: rdar://problem/33388782
1010
// REQUIRES: CPU=x86_64
1111

12-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
12+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
1313
import Darwin
14-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android)
14+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
1515
import Glibc
1616
#elseif os(Windows)
1717
import MSVCRT
18+
#else
19+
#error("Unsupported platform")
1820
#endif
1921

2022
let sourcePath = CommandLine.arguments[1]

test/Interpreter/dynamic_replacement.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ import Module1
5353

5454
import StdlibUnittest
5555

56-
#if os(Linux)
56+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
57+
import Darwin
58+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
5759
import Glibc
5860
#elseif os(Windows)
5961
import MSVCRT
6062
import WinSDK
6163
#else
62-
import Darwin
64+
#error("Unsupported platform")
6365
#endif
6466

6567
var DynamicallyReplaceable = TestSuite("DynamicallyReplaceable")

test/Interpreter/dynamic_replacement_chaining.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ import A
2222

2323
import StdlibUnittest
2424

25-
#if os(Linux)
25+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
26+
import Darwin
27+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
2628
import Glibc
2729
#elseif os(Windows)
2830
import MSVCRT
2931
import WinSDK
3032
#else
31-
import Darwin
33+
#error("Unsupported platform")
3234
#endif
3335

3436
var DynamicallyReplaceable = TestSuite("DynamicallyReplaceableChaining")

test/Interpreter/dynamic_replacement_dlclose.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import Module1
99

1010
import StdlibUnittest
1111

12-
#if os(Linux)
12+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
13+
import Darwin
14+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
1315
import Glibc
1416
#elseif os(Windows)
1517
import MSVCRT
1618
import WinSDK
1719
#else
18-
import Darwin
20+
#error("Unsupported platform")
1921
#endif
2022

2123
var DynamicallyReplaceable = TestSuite("DynamicallyReplaceable")

0 commit comments

Comments
 (0)