@@ -241,9 +241,6 @@ final class SwiftToolTests: CommandsTestCase {
241
241
" /Pkg/Sources/exe/main.swift " ,
242
242
] )
243
243
244
- let explicitDwarfOptions = try GlobalOptions . parse ( [ " --triple " , " x86_64-unknown-windows-msvc " , " -debug-info-format " , " dwarf " ] )
245
- let explicitDwarf = try SwiftTool . createSwiftToolForTest ( options: explicitDwarfOptions)
246
-
247
244
let observer = ObservabilitySystem . makeForTesting ( )
248
245
let graph = try loadPackageGraph ( fileSystem: fs, manifests: [
249
246
Manifest . createRootManifest ( displayName: " Pkg " ,
@@ -253,6 +250,10 @@ final class SwiftToolTests: CommandsTestCase {
253
250
254
251
var plan : BuildPlan
255
252
253
+
254
+ /* -debug-info-format dwarf */
255
+ let explicitDwarfOptions = try GlobalOptions . parse ( [ " --triple " , " x86_64-unknown-windows-msvc " , " -debug-info-format " , " dwarf " ] )
256
+ let explicitDwarf = try SwiftTool . createSwiftToolForTest ( options: explicitDwarfOptions)
256
257
plan = try BuildPlan (
257
258
buildParameters: explicitDwarf. buildParameters ( ) ,
258
259
graph: graph,
@@ -262,6 +263,8 @@ final class SwiftToolTests: CommandsTestCase {
262
263
try XCTAssertMatch ( plan. buildProducts. compactMap { $0 as? Build . ProductBuildDescription } . first? . linkArguments ( ) ?? [ ] ,
263
264
[ . anySequence, " -g " , " -use-ld=lld " , " -Xlinker " , " -debug:dwarf " ] )
264
265
266
+
267
+ /* -debug-info-format codeview */
265
268
let explicitCodeViewOptions = try GlobalOptions . parse ( [ " --triple " , " x86_64-unknown-windows-msvc " , " -debug-info-format " , " codeview " ] )
266
269
let explicitCodeView = try SwiftTool . createSwiftToolForTest ( options: explicitCodeViewOptions)
267
270
@@ -274,6 +277,17 @@ final class SwiftToolTests: CommandsTestCase {
274
277
try XCTAssertMatch ( plan. buildProducts. compactMap { $0 as? Build . ProductBuildDescription } . first? . linkArguments ( ) ?? [ ] ,
275
278
[ . anySequence, " -g " , " -debug-info-format=codeview " , " -Xlinker " , " -debug " ] )
276
279
280
+ // Explicitly pass Linux as when the SwiftTool tests are enabled on
281
+ // Windows, this would fail otherwise as CodeView is supported on the
282
+ // native host.
283
+ let unsupportedCodeViewOptions = try GlobalOptions . parse ( [ " --triple " , " x86_64-unknown-linux-gnu " , " -debug-info-format " , " codeview " ] )
284
+ let unsupportedCodeView = try SwiftTool . createSwiftToolForTest ( options: unsupportedCodeViewOptions)
285
+
286
+ XCTAssertThrowsError ( try unsupportedCodeView. buildParameters ( ) ) {
287
+ XCTAssertEqual ( $0 as? StringError , StringError ( " CodeView debug information is currently not supported on linux " ) )
288
+ }
289
+
290
+ /* <<null>> */
277
291
let implicitDwarfOptions = try GlobalOptions . parse ( [ " --triple " , " x86_64-unknown-windows-msvc " ] )
278
292
let implicitDwarf = try SwiftTool . createSwiftToolForTest ( options: implicitDwarfOptions)
279
293
plan = try BuildPlan (
@@ -285,15 +299,17 @@ final class SwiftToolTests: CommandsTestCase {
285
299
try XCTAssertMatch ( plan. buildProducts. compactMap { $0 as? Build . ProductBuildDescription } . first? . linkArguments ( ) ?? [ ] ,
286
300
[ . anySequence, " -g " , " -use-ld=lld " , " -Xlinker " , " -debug:dwarf " ] )
287
301
288
- // Explicitly pass Linux as when the SwiftTool tests are enabled on
289
- // Windows, this would fail otherwise as CodeView is supported on the
290
- // native host.
291
- let unsupportedCodeViewOptions = try GlobalOptions . parse ( [ " --triple " , " x86_64-unknown-linux-gnu " , " -debug-info-format " , " codeview " ] )
292
- let unsupportedCodeView = try SwiftTool . createSwiftToolForTest ( options: unsupportedCodeViewOptions)
293
-
294
- XCTAssertThrowsError ( try unsupportedCodeView. buildParameters ( ) ) {
295
- XCTAssertEqual ( $0 as? StringError , StringError ( " CodeView debug information is currently not supported on linux " ) )
296
- }
302
+ /* -debug-info-format none */
303
+ let explicitNoDebugInfoOptions = try GlobalOptions . parse ( [ " --triple " , " x86_64-unknown-windows-msvc " , " -debug-info-format " , " none " ] )
304
+ let explicitNoDebugInfo = try SwiftTool . createSwiftToolForTest ( options: explicitNoDebugInfoOptions)
305
+ plan = try BuildPlan (
306
+ buildParameters: explicitNoDebugInfo. buildParameters ( ) ,
307
+ graph: graph,
308
+ fileSystem: fs,
309
+ observabilityScope: observer. topScope
310
+ )
311
+ try XCTAssertMatch ( plan. buildProducts. compactMap { $0 as? Build . ProductBuildDescription } . first? . linkArguments ( ) ?? [ ] ,
312
+ [ . anySequence, " -gnone " , . anySequence] )
297
313
}
298
314
}
299
315
0 commit comments