Skip to content

Commit 47f9eb3

Browse files
committed
Tests: adjust LLBuildManifestTests expectations for Windows
This adjusts the expectations to allow Windows to be supported as well with the use of the paths more thoroughly. This identified an issue in the path handling in the manifest generation (tracked as swiftlang#5475).
1 parent 0481abf commit 47f9eb3

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

Tests/BuildTests/LLBuildManifestTests.swift

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ final class LLBuildManifestTests: XCTestCase {
2020
func testBasics() throws {
2121
var manifest = BuildManifest()
2222

23+
let root: AbsolutePath = AbsolutePath("/some")
24+
2325
manifest.defaultTarget = "main"
2426
manifest.addPhonyCmd(
2527
name: "C.Foo",
2628
inputs: [
27-
.file(AbsolutePath("/some/file.c")),
28-
.directory(AbsolutePath("/some/dir")),
29-
.directoryStructure(AbsolutePath("/some/dir/structure")),
29+
.file(root.appending(components: "file.c")),
30+
.directory(root.appending(components: "dir")),
31+
.directoryStructure(root.appending(components: "dir", "structure")),
3032
],
3133
outputs: [.virtual("Foo")]
3234
)
@@ -38,20 +40,22 @@ final class LLBuildManifestTests: XCTestCase {
3840

3941
let contents: String = try fs.readFileContents(AbsolutePath("/manifest.yaml"))
4042

41-
XCTAssertEqual(contents, """
43+
// FIXME(#5475) - use the platform's preferred separator for directory
44+
// indicators
45+
XCTAssertEqual(contents.replacingOccurrences(of: "\\\\", with: "\\"), """
4246
client:
4347
name: basic
4448
tools: {}
4549
targets:
4650
"main": ["<Foo>"]
4751
default: "main"
4852
nodes:
49-
"/some/dir/structure/":
53+
"\(root.appending(components: "dir", "structure"))/":
5054
is-directory-structure: true
5155
commands:
5256
"C.Foo":
5357
tool: phony
54-
inputs: ["/some/file.c","/some/dir/","/some/dir/structure/"]
58+
inputs: ["\(root.appending(components: "file.c"))","\(root.appending(components: "dir"))/","\(root.appending(components: "dir", "structure"))/"]
5559
outputs: ["<Foo>"]
5660
5761
@@ -61,15 +65,17 @@ final class LLBuildManifestTests: XCTestCase {
6165
func testShellCommands() throws {
6266
var manifest = BuildManifest()
6367

68+
let root: AbsolutePath = AbsolutePath.root
69+
6470
manifest.defaultTarget = "main"
6571
manifest.addShellCmd(
6672
name: "shelley",
6773
description: "Shelley, Keats, and Byron",
6874
inputs: [
69-
.file(AbsolutePath("/file.in]"))
75+
.file(root.appending(components: "file.in"))
7076
],
7177
outputs: [
72-
.file(AbsolutePath("/file.out"))
78+
.file(root.appending(components: "file.out"))
7379
],
7480
arguments: [
7581
"foo", "bar", "baz"
@@ -89,18 +95,18 @@ final class LLBuildManifestTests: XCTestCase {
8995

9096
let contents: String = try fs.readFileContents(AbsolutePath("/manifest.yaml"))
9197

92-
XCTAssertEqual(contents, """
98+
XCTAssertEqual(contents.replacingOccurrences(of: "\\\\", with: "\\"), """
9399
client:
94100
name: basic
95101
tools: {}
96102
targets:
97-
"main": ["/file.out"]
103+
"main": ["\(root.appending(components: "file.out"))"]
98104
default: "main"
99105
commands:
100106
"shelley":
101107
tool: shell
102-
inputs: ["/file.in]"]
103-
outputs: ["/file.out"]
108+
inputs: ["\(root.appending(components: "file.in"))"]
109+
outputs: ["\(root.appending(components: "file.out"))"]
104110
description: "Shelley, Keats, and Byron"
105111
args: ["foo","bar","baz"]
106112
env:

0 commit comments

Comments
 (0)