Skip to content

Commit 5a35160

Browse files
authored
Merge pull request swiftlang#23163 from apple/lit-dispatch-feature
2 parents d9642d0 + c0674b7 commit 5a35160

File tree

8 files changed

+52
-39
lines changed

8 files changed

+52
-39
lines changed

test/ClangImporter/Dispatch_test.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// RUN: %target-typecheck-verify-swift
22

3-
// REQUIRES: objc_interop
3+
// REQUIRES: libdispatch
44

55
import Dispatch
6-
import Foundation
76

87
func test1(_ queue: dispatch_queue_t) {} // expected-error {{'dispatch_queue_t' is unavailable}}
98
func test2(_ queue: DispatchQueue) {

test/lit.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,10 @@ if run_vendor == 'apple':
632632
{ 'macosx': 'macos', 'darwin': 'macos' }.get(run_os, run_os)
633633
)
634634

635+
config.available_features.add('libdispatch')
636+
config.available_features.add('foundation')
635637
config.available_features.add('objc_interop')
638+
636639
config.target_object_format = "macho"
637640
config.target_shared_library_prefix = 'lib'
638641
config.target_shared_library_suffix = ".dylib"

test/stdlib/Dispatch.swift

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %s -o %t/a.out
3-
// RUN: %target-codesign %t/a.out
4-
//
5-
// RUN: %target-run %t/a.out
1+
// RUN: %target-run-simple-swift
62
// REQUIRES: executable_test
7-
8-
// REQUIRES: objc_interop
3+
// REQUIRES: libdispatch
94

105
import Dispatch
11-
import Foundation
126
import StdlibUnittest
137

148

@@ -126,18 +120,6 @@ DispatchAPI.test("DispatchTime.addSubtract") {
126120

127121
then = DispatchTime.now() - Double.nan
128122
expectEqual(DispatchTime.distantFuture, then)
129-
130-
then = DispatchTime.now() + Date.distantFuture.timeIntervalSinceNow
131-
expectEqual(DispatchTime(uptimeNanoseconds: UInt64.max), then)
132-
133-
then = DispatchTime.now() + Date.distantPast.timeIntervalSinceNow
134-
expectEqual(DispatchTime(uptimeNanoseconds: 1), then)
135-
136-
then = DispatchTime.now() - Date.distantFuture.timeIntervalSinceNow
137-
expectEqual(DispatchTime(uptimeNanoseconds: 1), then)
138-
139-
then = DispatchTime.now() - Date.distantPast.timeIntervalSinceNow
140-
expectEqual(DispatchTime(uptimeNanoseconds: UInt64.max), then)
141123
}
142124

143125
DispatchAPI.test("DispatchWallTime.addSubtract") {
@@ -154,18 +136,6 @@ DispatchAPI.test("DispatchWallTime.addSubtract") {
154136

155137
then = DispatchWallTime.now() - Double.nan
156138
expectEqual(DispatchWallTime.distantFuture, then)
157-
158-
then = DispatchWallTime.now() + Date.distantFuture.timeIntervalSinceNow
159-
expectEqual(DispatchWallTime.distantFuture, then)
160-
161-
then = DispatchWallTime.now() + Date.distantPast.timeIntervalSinceNow
162-
expectEqual(distantPastRawValue, then.rawValue)
163-
164-
then = DispatchWallTime.now() - Date.distantFuture.timeIntervalSinceNow
165-
expectEqual(distantPastRawValue, then.rawValue)
166-
167-
then = DispatchWallTime.now() - Date.distantPast.timeIntervalSinceNow
168-
expectEqual(DispatchWallTime.distantFuture, then)
169139
}
170140

171141
DispatchAPI.test("DispatchTime.uptimeNanos") {

test/stdlib/DispatchData.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
// RUN: %target-build-swift -swift-version 4 %s -o %t/a.out-4 && %target-codesign %t/a.out-4 && %target-run %t/a.out-4
33
// RUN: %target-build-swift -swift-version 4.2 %s -o %t/a.out-4.2 && %target-codesign %t/a.out-4.2 && %target-run %t/a.out-4.2
44
// REQUIRES: executable_test
5-
// REQUIRES: objc_interop
5+
// REQUIRES: libdispatch
66

77
import Dispatch
8-
import Foundation
98
import StdlibUnittest
109

1110
defer { runAllTests() }

test/stdlib/DispatchDate.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// RUN: %target-run-simple-swift
2+
// REQUIRES: executable_test
3+
// REQUIRES: libdispatch
4+
// REQUIRES: foundation
5+
6+
import Dispatch
7+
import Foundation
8+
import StdlibUnittest
9+
10+
var DispatchAPI = TestSuite("DispatchAPI")
11+
12+
DispatchAPI.test("DispatchTime.addSubtractDateConstants") {
13+
var then = DispatchTime.now() + Date.distantFuture.timeIntervalSinceNow
14+
expectEqual(DispatchTime(uptimeNanoseconds: UInt64.max), then)
15+
16+
then = DispatchTime.now() + Date.distantPast.timeIntervalSinceNow
17+
expectEqual(DispatchTime(uptimeNanoseconds: 1), then)
18+
19+
then = DispatchTime.now() - Date.distantFuture.timeIntervalSinceNow
20+
expectEqual(DispatchTime(uptimeNanoseconds: 1), then)
21+
22+
then = DispatchTime.now() - Date.distantPast.timeIntervalSinceNow
23+
expectEqual(DispatchTime(uptimeNanoseconds: UInt64.max), then)
24+
}
25+
26+
DispatchAPI.test("DispatchWallTime.addSubtractDateConstants") {
27+
let distantPastRawValue = DispatchWallTime.distantFuture.rawValue - UInt64(1)
28+
29+
var then = DispatchWallTime.now() + Date.distantFuture.timeIntervalSinceNow
30+
expectEqual(DispatchWallTime.distantFuture, then)
31+
32+
then = DispatchWallTime.now() + Date.distantPast.timeIntervalSinceNow
33+
expectEqual(distantPastRawValue, then.rawValue)
34+
35+
then = DispatchWallTime.now() - Date.distantFuture.timeIntervalSinceNow
36+
expectEqual(distantPastRawValue, then.rawValue)
37+
38+
then = DispatchWallTime.now() - Date.distantPast.timeIntervalSinceNow
39+
expectEqual(DispatchWallTime.distantFuture, then)
40+
}
41+
42+
runAllTests()

test/stdlib/DispatchRenames.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-typecheck-verify-swift
2-
// REQUIRES: objc_interop
2+
// REQUIRES: libdispatch
33

44
import Dispatch
55

test/stdlib/DispatchTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -typecheck %s
22

3-
// REQUIRES: objc_interop
3+
// REQUIRES: libdispatch
44

55
import Dispatch
66

validation-test/Runtime/weak-reference-racetests-dispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
33
// REQUIRES: stress_test
4-
// REQUIRES: objc_interop
4+
// REQUIRES: libdispatch
55

66
import StdlibUnittest
77
import Dispatch

0 commit comments

Comments
 (0)