@@ -875,6 +875,7 @@ func _childProcess() {
875875 }
876876}
877877
878+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
878879@inline ( never)
879880func _childProcessAsync( ) async {
880881 _installTrapInterceptor ( )
@@ -928,6 +929,7 @@ func _childProcessAsync() async {
928929 }
929930 }
930931}
932+ #endif
931933
932934class _ParentProcess {
933935#if os(Windows)
@@ -1367,6 +1369,7 @@ class _ParentProcess {
13671369 }
13681370 }
13691371
1372+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
13701373 internal func runOneTestAsync(
13711374 fullTestName: String ,
13721375 testSuite: TestSuite ,
@@ -1457,6 +1460,7 @@ class _ParentProcess {
14571460 return . xFail
14581461 }
14591462 }
1463+ #endif
14601464
14611465
14621466 func run( ) {
@@ -1531,6 +1535,7 @@ class _ParentProcess {
15311535 }
15321536 }
15331537
1538+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
15341539 func runAsync( ) async {
15351540 if let filter = _filter {
15361541 print ( " StdlibUnittest: using filter: \( filter) " )
@@ -1602,6 +1607,7 @@ class _ParentProcess {
16021607 _testSuiteFailedCallback ( )
16031608 }
16041609 }
1610+ #endif
16051611
16061612}
16071613
@@ -1713,6 +1719,7 @@ public func runAllTests() {
17131719 }
17141720}
17151721
1722+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
17161723public func runAllTestsAsync( ) async {
17171724 if PersistentState . runNoTestsWasCalled {
17181725 print ( " runAllTests() called after runNoTests(). Aborting. " )
@@ -1780,6 +1787,7 @@ public func runAllTestsAsync() async {
17801787 await parent. runAsync ( )
17811788 }
17821789}
1790+ #endif
17831791
17841792#if SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
17851793
@@ -1816,6 +1824,7 @@ public final class TestSuite {
18161824 . code ( testFunction)
18171825 }
18181826
1827+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
18191828 // This method is prohibited from inlining because inlining the test harness
18201829 // into the test is not interesting from the runtime performance perspective.
18211830 // And it does not really make the test cases more effectively at testing the
@@ -1830,6 +1839,7 @@ public final class TestSuite {
18301839 _TestBuilder ( testSuite: self , name: name, loc: SourceLoc ( file, line) )
18311840 . code ( testFunction)
18321841 }
1842+ #endif
18331843
18341844 // This method is prohibited from inlining because inlining the test harness
18351845 // into the test is not interesting from the runtime performance perspective.
@@ -1876,10 +1886,12 @@ public final class TestSuite {
18761886 code ( )
18771887 case . parameterized( code: let code, _) :
18781888 code ( parameter!)
1889+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
18791890 case . singleAsync( _) :
18801891 fatalError ( " Cannot call async code, use `runAllTestsAsync` " )
18811892 case . parameterizedAsync( code: _, _) :
18821893 fatalError ( " Cannot call async code, use `runAllTestsAsync` " )
1894+ #endif
18831895 }
18841896
18851897#if SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
@@ -1894,6 +1906,7 @@ public final class TestSuite {
18941906 file: test. testLoc. file, line: test. testLoc. line)
18951907 }
18961908
1909+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
18971910 func _runTestAsync( name testName: String , parameter: Int ? ) async {
18981911 PersistentState . ranSomething = true
18991912 for r in _allResettables {
@@ -1917,13 +1930,15 @@ public final class TestSuite {
19171930 code ( )
19181931 case . parameterized( code: let code, _) :
19191932 code ( parameter!)
1933+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
19201934 case . singleAsync( let code) :
19211935 precondition (
19221936 parameter == nil ,
19231937 " can't pass parameters to non-parameterized tests " )
19241938 await code ( )
19251939 case . parameterizedAsync( code: let code, _) :
19261940 await code ( parameter!)
1941+ #endif
19271942 }
19281943
19291944#if SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
@@ -1937,6 +1952,7 @@ public final class TestSuite {
19371952 0 , LifetimeTracked . instances, " Found leaked LifetimeTracked instances. " ,
19381953 file: test. testLoc. file, line: test. testLoc. line)
19391954 }
1955+ #endif
19401956
19411957 func _testByName( _ testName: String ) -> _Test {
19421958 return _tests [ _testNameToIndex [ testName] !]
@@ -1956,8 +1972,10 @@ public final class TestSuite {
19561972 internal enum _TestCode {
19571973 case single( code: ( ) -> Void )
19581974 case parameterized( code: ( Int ) -> Void , count: Int )
1975+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
19591976 case singleAsync( code: ( ) async -> Void )
19601977 case parameterizedAsync( code: ( Int ) async -> Void , count: Int )
1978+ #endif
19611979 }
19621980
19631981 internal struct _Test {
@@ -1991,10 +2009,12 @@ public final class TestSuite {
19912009 return [ nil ]
19922010 case . parameterized( code: _, count: let count) :
19932011 return Array ( 0 ..< count)
2012+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
19942013 case . singleAsync:
19952014 return [ nil ]
19962015 case . parameterizedAsync( code: _, count: let count) :
19972016 return Array ( 0 ..< count)
2017+ #endif
19982018 }
19992019 }
20002020 }
@@ -2063,9 +2083,11 @@ public final class TestSuite {
20632083 _build ( . single( code: testFunction) )
20642084 }
20652085
2086+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
20662087 public func code( _ testFunction: @escaping ( ) async -> Void ) {
20672088 _build ( . singleAsync( code: testFunction) )
20682089 }
2090+ #endif
20692091
20702092 public func forEach< Data> (
20712093 in parameterSets: [ Data ] ,
@@ -2076,6 +2098,7 @@ public final class TestSuite {
20762098 count: parameterSets. count) )
20772099 }
20782100
2101+ #if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
20792102 public func forEach< Data> (
20802103 in parameterSets: [ Data ] ,
20812104 testFunction: @escaping ( Data ) async -> Void
@@ -2084,6 +2107,7 @@ public final class TestSuite {
20842107 code: { ( i: Int ) in await testFunction ( parameterSets [ i] ) } ,
20852108 count: parameterSets. count) )
20862109 }
2110+ #endif
20872111
20882112 }
20892113
0 commit comments