Skip to content

Commit 0cd961d

Browse files
author
Luke Daley
committed
Expand build operation test
1 parent 0feb027 commit 0cd961d

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

Tests/SWBBuildSystemTests/DependencyVerificationBuildOperationTests.swift

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fileprivate struct DependencyVerificationBuildOperationTests: CoreBasedTests {
4343
"PRODUCT_NAME": "$(TARGET_NAME)",
4444
"CLANG_ENABLE_MODULES": "NO",
4545
"GENERATE_INFOPLIST_FILE": "YES",
46-
"DEPENDENCIES": "Foundation UIKit",
46+
"DEPENDENCIES": "Foundation",
4747
// Disable the SetOwnerAndGroup action by setting them to empty values.
4848
"INSTALL_GROUP": "",
4949
"INSTALL_OWNER": "",
@@ -54,7 +54,8 @@ fileprivate struct DependencyVerificationBuildOperationTests: CoreBasedTests {
5454
TestStandardTarget(
5555
"CoreFoo", type: .framework,
5656
buildPhases: [
57-
TestSourcesBuildPhase(["CoreFoo.m"])
57+
TestSourcesBuildPhase(["CoreFoo.m"]),
58+
TestFrameworksBuildPhase()
5859
])
5960
])
6061
]
@@ -66,22 +67,36 @@ fileprivate struct DependencyVerificationBuildOperationTests: CoreBasedTests {
6667
// Write the source files.
6768
try await tester.fs.writeFileContents(SRCROOT.join("Sources/CoreFoo.m")) { contents in
6869
contents <<< """
69-
#include <Foundation/Foundation.h>
70-
#include <Accelerate/Accelerate.h>
70+
#include <Foundation/Foundation.h>
71+
#include <Accelerate/Accelerate.h>
7172
72-
void f0(void) { };
73-
"""
73+
void f0(void) { };
74+
"""
7475
}
7576

76-
let parameters = BuildParameters(
77-
action: .install, configuration: "Debug",
78-
overrides: [
79-
"DSTROOT": tmpDirPath.join("dst").str
80-
])
77+
func parameters(_ overrides: [String: String] = [:]) -> BuildParameters {
78+
return BuildParameters(
79+
action: .install, configuration: "Debug",
80+
overrides: [
81+
"DSTROOT": tmpDirPath.join("dst").str
82+
].merging(overrides, uniquingKeysWith: { _, new in new })
83+
)
84+
}
8185

82-
try await tester.checkBuild(parameters: parameters, runDestination: .macOS, persistent: true) { results in
86+
// Non-modular clang complains about undeclared dependency
87+
try await tester.checkBuild(parameters: parameters(), runDestination: .macOS, persistent: true) { results in
8388
results.checkError(.contains("Undeclared dependencies: \n Accelerate"))
8489
}
90+
91+
// Declaring dependency resolves problem
92+
try await tester.checkBuild(parameters: parameters(["DEPENDENCIES": "Foundation Accelerate"]), runDestination: .macOS, persistent: true) { results in
93+
results.checkNoErrors()
94+
}
95+
96+
// Linker complains about undeclared dependency
97+
try await tester.checkBuild(parameters: parameters(["OTHER_LDFLAGS": "-framework CoreData", "DEPENDENCIES": "Foundation Accelerate"]), runDestination: .macOS, persistent: true) { results in
98+
results.checkError(.contains("Undeclared dependencies: \n CoreData"))
99+
}
85100
}
86101
}
87102
}

0 commit comments

Comments
 (0)