Skip to content

Commit 781e40c

Browse files
[TEST-ONLY] Update compilation caching tests for latest compilers
Update compilation caching tests to work with latest compiler. This involves relaxing some tests to check for both old and new command-line and also encoding less compiler implementation details in the build system tests.
1 parent d8aff2e commit 781e40c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Tests/SWBBuildSystemTests/ClangCompilationCachingTests.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
15791579
func checkModuleCommandLine(task: Task, results: BuildOperationTester.BuildResults, name: String) {
15801580
// The final command-line is only known to the dynamic task, but it's printed to output so we can check that.
15811581
results.checkTaskOutput(task) { output in
1582-
XCTAssertMatch(output.stringValue, .contains(#"\#(name)\=/\^mod"#))
1582+
XCTAssertMatch(output.stringValue, .or(.contains(#"\#(name)\=/\^mod"#), .contains(#"\#(name) /\^mod"#)))
15831583
checkCommandLineCommon(output: output)
15841584
}
15851585
}
@@ -1842,6 +1842,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
18421842
"CLANG_ENABLE_COMPILE_CACHE": enableCaching ? "YES" : "NO",
18431843
"CLANG_ENABLE_MODULES": "NO",
18441844
"COMPILATION_CACHE_CAS_PATH": casPath.str,
1845+
"DSTROOT": tmpDirPath.join("dstroot").str,
18451846
]
18461847
if usePlugin {
18471848
buildSettings["COMPILATION_CACHE_ENABLE_PLUGIN"] = "YES"
@@ -1966,7 +1967,11 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
19661967
// Ignore output for plugin CAS since it may not yet support validation.
19671968
try await checkBuild("validated successfully\n")
19681969
// Create an error and trigger revalidation by messing with the validation data.
1969-
try tester.fs.move(casPath.join("builtin/v1.1/v8.data"), to: casPath.join("builtin/v1.1/v8.data.moved"))
1970+
let dataDir = casPath.join("builtin").join("v1.1")
1971+
let dataFile = try #require(tester.fs.listdir(dataDir).first {
1972+
$0.hasSuffix(".data") && $0.hasPrefix("v")
1973+
})
1974+
try tester.fs.move(dataDir.join(dataFile), to: dataDir.join("moved"))
19701975
try await tester.fs.writeFileContents(casPath.join("builtin/v1.validation")) { stream in
19711976
stream <<< "0"
19721977
}

0 commit comments

Comments
 (0)