Skip to content

Commit fc7f5d2

Browse files
committed
ADD - test to verify clang is relative to the swift compiler path.
UPDATE - XCTestManifests.swift
1 parent 6640ed5 commit fc7f5d2

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

Sources/SwiftDriver/Toolchains/Toolchain.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ extension Toolchain {
114114
} else if let path = lookupExecutablePath(filename: exec, searchPaths: searchPaths) {
115115
return path
116116
} else {
117-
throw ToolchainError.unableToFind(tool: exec)
117+
// This is a hack so our tests work on linux. We need a better way for looking up tools in general.
118+
return AbsolutePath("/usr/bin/" + exec)
118119
}
119120
}
120121

@@ -126,8 +127,7 @@ extension Toolchain {
126127
).spm_chomp()
127128
return AbsolutePath(path)
128129
#else
129-
// This is a hack so our tests work on linux. We need a better way for looking up tools in general.
130-
return AbsolutePath("/usr/bin/" + exec)
130+
throw ToolchainError.unableToFind(tool: exec)
131131
#endif
132132
}
133133
}

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,21 @@ final class SwiftDriverTests: XCTestCase {
893893
assertString(swiftVersion, contains: "Swift version ")
894894
#endif
895895
}
896+
897+
func testToolchainClangPath() {
898+
// TODO: remove this conditional check once DarwinToolchain does not requires xcrun to look for clang.
899+
var toolchain: Toolchain
900+
#if os(macOS)
901+
toolchain = DarwinToolchain(env: ProcessEnv.vars)
902+
#else
903+
toolchain = GenericUnixToolchain(env: ProcessEnv.vars)
904+
#endif
905+
906+
XCTAssertEqual(
907+
try? toolchain.getToolPath(.swiftCompiler).parentDirectory,
908+
try? toolchain.getToolPath(.clang).parentDirectory
909+
)
910+
}
896911
}
897912

898913
func assertString(

Tests/SwiftDriverTests/XCTestManifests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ extension PrefixTrieTests {
5454
]
5555
}
5656

57+
extension StringAdditionsTests {
58+
// DO NOT MODIFY: This is autogenerated, use:
59+
// `swift test --generate-linuxmain`
60+
// to regenerate.
61+
static let __allTests__StringAdditionsTests = [
62+
("testBasicIdentifiers", testBasicIdentifiers),
63+
("testSwiftKeywordsAsIdentifiers", testSwiftKeywordsAsIdentifiers),
64+
("testUnicodeCharacters", testUnicodeCharacters),
65+
]
66+
}
67+
5768
extension SwiftDriverTests {
5869
// DO NOT MODIFY: This is autogenerated, use:
5970
// `swift test --generate-linuxmain`
@@ -70,16 +81,21 @@ extension SwiftDriverTests {
7081
("testMergeModulesOnly", testMergeModulesOnly),
7182
("testModuleNameFallbacks", testModuleNameFallbacks),
7283
("testModuleSettings", testModuleSettings),
84+
("testMultithreading", testMultithreading),
85+
("testMultithreadingDiagnostics", testMultithreadingDiagnostics),
7386
("testOutputFileMapLoading", testOutputFileMapLoading),
7487
("testOutputFileMapStoring", testOutputFileMapStoring),
7588
("testParseErrors", testParseErrors),
7689
("testParsing", testParsing),
7790
("testPrimaryOutputKinds", testPrimaryOutputKinds),
91+
("testPrimaryOutputKindsDiagnostics", testPrimaryOutputKindsDiagnostics),
7892
("testRegressions", testRegressions),
7993
("testResponseFileExpansion", testResponseFileExpansion),
94+
("testResponseFileTokenization", testResponseFileTokenization),
8095
("testSanitizerArgs", testSanitizerArgs),
8196
("testStandardCompileJobs", testStandardCompileJobs),
8297
("testTargetTriple", testTargetTriple),
98+
("testToolchainClangPath", testToolchainClangPath),
8399
("testToolchainUtilities", testToolchainUtilities),
84100
]
85101
}
@@ -109,6 +125,7 @@ public func __allTests() -> [XCTestCaseEntry] {
109125
testCase(JobExecutorTests.__allTests__JobExecutorTests),
110126
testCase(ParsableMessageTests.__allTests__ParsableMessageTests),
111127
testCase(PrefixTrieTests.__allTests__PrefixTrieTests),
128+
testCase(StringAdditionsTests.__allTests__StringAdditionsTests),
112129
testCase(SwiftDriverTests.__allTests__SwiftDriverTests),
113130
testCase(TripleTests.__allTests__TripleTests),
114131
]

0 commit comments

Comments
 (0)