Skip to content

Commit 6f569c3

Browse files
committed
Specify -swift-version in tests that emit swiftinterfaces.
swiftlang/swift#84244 introduces the requirement that `swift-frontend` jobs emitting a swiftinterface must explicitly specify either `-language-mode` or `-swift-version` to avoid mis-compilation of the interface. Add the necessary arguments to various tests that form their own `swift-frontend` invocations.
1 parent 7eae6e7 commit 6f569c3

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Tests/SwiftDriverTests/CachingBuildTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ final class CachingBuildTests: XCTestCase {
368368
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
369369
let dependencyOracle = InterModuleDependencyOracle()
370370
var driver = try Driver(args: ["swiftc",
371+
"-swift-version", "5",
371372
"-module-name", "ModuleOnly",
372373
"-I", cHeadersPath.nativePathString(escaped: true),
373374
"-I", swiftModuleInterfacesPath.nativePathString(escaped: true),
@@ -424,6 +425,7 @@ final class CachingBuildTests: XCTestCase {
424425
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
425426
let dependencyOracle = InterModuleDependencyOracle()
426427
var driver = try Driver(args: ["swiftc",
428+
"-swift-version", "5",
427429
"-module-name", "SeparateModuleJob",
428430
"-I", cHeadersPath.nativePathString(escaped: true),
429431
"-I", swiftModuleInterfacesPath.nativePathString(escaped: true),
@@ -481,6 +483,7 @@ final class CachingBuildTests: XCTestCase {
481483
let privateSwiftInterfacePath: AbsolutePath = path.appending(component: "testExplicitModuleVerifyInterfaceJobs.private.swiftinterface")
482484
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
483485
var driver = try Driver(args: ["swiftc",
486+
"-swift-version", "5",
484487
"-I", cHeadersPath.nativePathString(escaped: true),
485488
"-I", swiftModuleInterfacesPath.nativePathString(escaped: true),
486489
"-I", stdlibPath.nativePathString(escaped: true),

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
906906
.appending(component: "Swift")
907907
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
908908
let invocationArguments = ["swiftc",
909+
"-swift-version", "5",
909910
"-incremental", "-c",
910911
"-emit-module",
911912
"-enable-library-evolution", "-emit-module-interface", "-driver-show-incremental",
@@ -963,6 +964,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
963964
let privateSwiftInterfacePath: AbsolutePath = path.appending(component: "testExplicitModuleVerifyInterfaceJobs.private.swiftinterface")
964965
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
965966
var driver = try Driver(args: ["swiftc",
967+
"-swift-version", "5",
966968
"-I", cHeadersPath.nativePathString(escaped: true),
967969
"-I", swiftModuleInterfacesPath.nativePathString(escaped: true),
968970
"-I", stdlibPath.nativePathString(escaped: true),
@@ -2801,6 +2803,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28012803
"""
28022804
)
28032805
var driver = try Driver(args: ["swiftc",
2806+
"-swift-version", "5",
28042807
"-experimental-emit-variant-module",
28052808
"-target", "x86_64-apple-macosx10.14",
28062809
"-target-variant", "x86_64-apple-ios13.1-macabi",

Tests/SwiftDriverTests/SwiftDriverToolingInterfaceTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ final class SwiftDriverToolingInterfaceTests: XCTestCase {
5959
diagnosticCallback: {_,_ in }))
6060
}
6161
do { // Force no outputs
62-
let testCommand = "-module-name foo -emit-module -emit-module-path /tmp/foo.swiftmodule -emit-objc-header -emit-objc-header-path /tmp/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path /tmp/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path /tmp/foo.tbd -emit-dependencies -serialize-diagnostics " + inputFile.description
62+
let testCommand = "-swift-version 5 -module-name foo -emit-module -emit-module-path /tmp/foo.swiftmodule -emit-objc-header -emit-objc-header-path /tmp/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path /tmp/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path /tmp/foo.tbd -emit-dependencies -serialize-diagnostics " + inputFile.description
6363
var resultingFrontendArgs: [String] = []
6464
var emittedDiagnostics: [Diagnostic] = []
6565
XCTAssertFalse(getSingleFrontendInvocationFromDriverArgumentsV2(driverPath: "swiftc",
@@ -149,7 +149,7 @@ final class SwiftDriverToolingInterfaceTests: XCTestCase {
149149
executor: executor))
150150
}
151151
do { // Force no outputs
152-
let testCommand = "-module-name foo -emit-module -emit-module-path /tmp/foo.swiftmodule -emit-objc-header -emit-objc-header-path /tmp/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path /tmp/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path /tmp/foo.tbd -emit-dependencies -serialize-diagnostics " + inputFile.description
152+
let testCommand = "-swift-version 5 -module-name foo -emit-module -emit-module-path /tmp/foo.swiftmodule -emit-objc-header -emit-objc-header-path /tmp/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path /tmp/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path /tmp/foo.tbd -emit-dependencies -serialize-diagnostics " + inputFile.description
153153
var resultingFrontendArgs: [String] = []
154154
var emittedDiagnostics: [Diagnostic] = []
155155
XCTAssertFalse(getSingleFrontendInvocationFromDriverArgumentsV3(driverPath: "swiftc",
@@ -336,7 +336,7 @@ final class SwiftDriverToolingInterfaceTests: XCTestCase {
336336
executor: executor))
337337
}
338338
do { // Force no outputs
339-
let testCommand = "-module-name foo -emit-module -emit-module-path /tmp/foo.swiftmodule -emit-objc-header -emit-objc-header-path /tmp/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path /tmp/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path /tmp/foo.tbd -emit-dependencies -serialize-diagnostics " + inputFile.description
339+
let testCommand = "-swift-version 5 -module-name foo -emit-module -emit-module-path /tmp/foo.swiftmodule -emit-objc-header -emit-objc-header-path /tmp/foo.h -enable-library-evolution -emit-module-interface -emit-module-interface-path /tmp/foo.swiftinterface -emit-library -emit-tbd -emit-tbd-path /tmp/foo.tbd -emit-dependencies -serialize-diagnostics " + inputFile.description
340340
var resultingFrontendArgs: [String] = []
341341
var emittedDiagnostics: [Diagnostic] = []
342342
XCTAssertFalse(getSingleFrontendInvocationFromDriverArgumentsV5(driverPath: "swiftc",

0 commit comments

Comments
 (0)