Skip to content

Commit

Permalink
Tests: adjust LLBuildManifestTests expectations for Windows
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
compnerd committed May 8, 2022
1 parent 0481abf commit 47f9eb3
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions Tests/BuildTests/LLBuildManifestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ final class LLBuildManifestTests: XCTestCase {
func testBasics() throws {
var manifest = BuildManifest()

let root: AbsolutePath = AbsolutePath("/some")

manifest.defaultTarget = "main"
manifest.addPhonyCmd(
name: "C.Foo",
inputs: [
.file(AbsolutePath("/some/file.c")),
.directory(AbsolutePath("/some/dir")),
.directoryStructure(AbsolutePath("/some/dir/structure")),
.file(root.appending(components: "file.c")),
.directory(root.appending(components: "dir")),
.directoryStructure(root.appending(components: "dir", "structure")),
],
outputs: [.virtual("Foo")]
)
Expand All @@ -38,20 +40,22 @@ final class LLBuildManifestTests: XCTestCase {

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

XCTAssertEqual(contents, """
// FIXME(#5475) - use the platform's preferred separator for directory
// indicators
XCTAssertEqual(contents.replacingOccurrences(of: "\\\\", with: "\\"), """
client:
name: basic
tools: {}
targets:
"main": ["<Foo>"]
default: "main"
nodes:
"/some/dir/structure/":
"\(root.appending(components: "dir", "structure"))/":
is-directory-structure: true
commands:
"C.Foo":
tool: phony
inputs: ["/some/file.c","/some/dir/","/some/dir/structure/"]
inputs: ["\(root.appending(components: "file.c"))","\(root.appending(components: "dir"))/","\(root.appending(components: "dir", "structure"))/"]
outputs: ["<Foo>"]
Expand All @@ -61,15 +65,17 @@ final class LLBuildManifestTests: XCTestCase {
func testShellCommands() throws {
var manifest = BuildManifest()

let root: AbsolutePath = AbsolutePath.root

manifest.defaultTarget = "main"
manifest.addShellCmd(
name: "shelley",
description: "Shelley, Keats, and Byron",
inputs: [
.file(AbsolutePath("/file.in]"))
.file(root.appending(components: "file.in"))
],
outputs: [
.file(AbsolutePath("/file.out"))
.file(root.appending(components: "file.out"))
],
arguments: [
"foo", "bar", "baz"
Expand All @@ -89,18 +95,18 @@ final class LLBuildManifestTests: XCTestCase {

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

XCTAssertEqual(contents, """
XCTAssertEqual(contents.replacingOccurrences(of: "\\\\", with: "\\"), """
client:
name: basic
tools: {}
targets:
"main": ["/file.out"]
"main": ["\(root.appending(components: "file.out"))"]
default: "main"
commands:
"shelley":
tool: shell
inputs: ["/file.in]"]
outputs: ["/file.out"]
inputs: ["\(root.appending(components: "file.in"))"]
outputs: ["\(root.appending(components: "file.out"))"]
description: "Shelley, Keats, and Byron"
args: ["foo","bar","baz"]
env:
Expand Down

0 comments on commit 47f9eb3

Please sign in to comment.