Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: adjust LLBuildManifestTests expectations for Windows #5477

Merged
merged 1 commit into from
May 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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