@@ -196,7 +196,6 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
196
196
case . runSerial:
197
197
let toolchain = try getToolchain ( )
198
198
let testProducts = try buildTestsIfNeeded ( )
199
- var ranSuccessfully = true
200
199
let buildParameters = try self . buildParameters ( )
201
200
202
201
// Clean out the code coverage directory that may contain stale
@@ -205,18 +204,11 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
205
204
try localFileSystem. removeFileTree ( buildParameters. codeCovPath)
206
205
}
207
206
207
+ let xctestArg : String ?
208
+
208
209
switch options. testCaseSpecifier {
209
210
case . none:
210
- let runner = TestRunner (
211
- bundlePaths: testProducts. map { $0. bundlePath } ,
212
- xctestArg: nil ,
213
- processSet: processSet,
214
- toolchain: toolchain,
215
- diagnostics: diagnostics,
216
- options: self . options,
217
- buildParameters: buildParameters
218
- )
219
- ranSuccessfully = runner. test ( )
211
+ xctestArg = nil
220
212
221
213
case . regex, . specific, . skip:
222
214
// If old specifier `-s` option was used, emit deprecation notice.
@@ -233,21 +225,21 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
233
225
diagnostics. emit ( . noMatchingTests)
234
226
}
235
227
236
- // Finally, run the tests.
237
- for test in tests {
238
- let runner = TestRunner (
239
- bundlePaths: [ test. productPath] ,
240
- xctestArg: test. specifier,
241
- processSet: processSet,
242
- toolchain: toolchain,
243
- diagnostics: diagnostics,
244
- options: self . options,
245
- buildParameters: try self . buildParameters ( )
246
- )
247
- ranSuccessfully = runner. test ( ) && ranSuccessfully
248
- }
228
+ xctestArg = tests. map { $0. specifier } . joined ( separator: " , " )
249
229
}
250
230
231
+ let runner = TestRunner (
232
+ bundlePaths: testProducts. map { $0. bundlePath } ,
233
+ xctestArg: xctestArg,
234
+ processSet: processSet,
235
+ toolchain: toolchain,
236
+ diagnostics: diagnostics,
237
+ options: self . options,
238
+ buildParameters: buildParameters
239
+ )
240
+
241
+ // Finally, run the tests.
242
+ let ranSuccessfully : Bool = runner. test ( )
251
243
if !ranSuccessfully {
252
244
executionStatus = . failure
253
245
}
0 commit comments