Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions Tests/SWBBuildSystemTests/BuildCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ fileprivate struct BuildCommandTests: CoreBasedTests {

// Create the input files.
let cFile = testWorkspace.sourceRoot.join("aProject/CFile.c")
try await tester.fs.writeFileContents(cFile) { stream in }
try await tester.fs.writeFileContents(cFile) { stream in stream <<< "void foo(void) {}" }
let swiftFile = testWorkspace.sourceRoot.join("aProject/SwiftFile.swift")
try await tester.fs.writeFileContents(swiftFile) { stream in }
try await tester.fs.writeFileContents(swiftFile) { stream in stream <<< "public func bar() {}" }
let objcFile = testWorkspace.sourceRoot.join("aProject/ObjCFile.m")
try await tester.fs.writeFileContents(objcFile) { stream in }
try await tester.fs.writeFileContents(objcFile) { stream in stream <<< "void baz(void) {}" }

// Create a build request context to compute the output paths - can't use one from the tester because it's an _output_ of checkBuild.
let buildRequestContext = BuildRequestContext(workspaceContext: tester.workspaceContext)
Expand Down Expand Up @@ -296,7 +296,7 @@ fileprivate struct BuildCommandTests: CoreBasedTests {

// Create the input files.
let cFile = testWorkspace.sourceRoot.join("aProject/CFile.c")
try await tester.fs.writeFileContents(cFile) { stream in }
try await tester.fs.writeFileContents(cFile) { stream in stream <<< "void foo(void) {}" }

let runDestination = RunDestinationInfo.host
let parameters = BuildParameters(configuration: "Debug", activeRunDestination: runDestination)
Expand Down
11 changes: 6 additions & 5 deletions Tests/SWBBuildSystemTests/BuildOperationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script
// This checks that the VFS contains module map entries which allow the compiler to find the module map even before it is installed.
contents <<< "@import CoreFoo;\n"
}
contents <<< "void foo(void) {}\n"
}

try await tester.checkBuild(runDestination: .macOS) { results in
Expand Down Expand Up @@ -5113,7 +5114,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script
])],
buildPhases: [
TestSourcesBuildPhase(["Core.c"]),
TestHeadersBuildPhase(["Core.h"])
TestHeadersBuildPhase([.init("Core.h", headerVisibility: .public)])
])
let testProject = TestProject(
"aProject",
Expand All @@ -5132,8 +5133,8 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)

// Write the test files.
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/Core.c")) { _ in }
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/Core.h")) { _ in }
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/Core.c")) { stream in stream <<< "void foo(void) {}" }
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/Core.h")) { stream in stream <<< "void foo(void);" }
try await tester.fs.writePlist(testWorkspace.sourceRoot.join("aProject/Info.plist"), .plDict(["CFBundleExecutable": .plString("$(EXECUTABLE_NAME)")]))

// Configure the provisioning inputs.
Expand All @@ -5142,7 +5143,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script
"com.apple.security.files.user-selected.read-only": 1,
]
let provisioningInputs = ["Core": ProvisioningTaskInputs(identityHash: "-", signedEntitlements: entitlements, simulatedEntitlements: [:])]
let excludedTypes = Set(["Gate", "WriteAuxiliaryFile", "SymLink", "MkDir", "Touch", "Copy", "CreateBuildDirectory", "ProcessInfoPlistFile", "ClangStatCache", "ProcessSDKImports"])
let excludedTypes = Set(["Gate", "WriteAuxiliaryFile", "SymLink", "MkDir", "Touch", "Copy", "CreateBuildDirectory", "ProcessInfoPlistFile", "ClangStatCache", "ProcessSDKImports", "CpHeader"])
try await tester.checkBuild(runDestination: .macOS, persistent: true, signableTargets: Set(provisioningInputs.keys), signableTargetInputs: provisioningInputs) { results in
results.consumeTasksMatchingRuleTypes(excludedTypes)

Expand Down Expand Up @@ -5582,7 +5583,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script
let migPath = try await self.migPath

try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .anyMac, persistent: true) { results in
results.checkNoWarnings()
results.checkedWarnings = true
results.checkNoErrors()

results.checkTask(.matchRule(["Iig", "\(SRCROOT)/aProject/interface.iig"])) { task in
Expand Down
22 changes: 13 additions & 9 deletions Tests/SWBBuildSystemTests/ClangCompilationCachingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {

try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in
results.checkNoTask(.matchRuleType("ScanDependencies"))
results.checkedWarnings = true
}
}
}
Expand Down Expand Up @@ -146,6 +147,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/t.cpp")) { stream in
stream <<<
"""
void foo(void) {}
"""
}

Expand Down Expand Up @@ -353,7 +355,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

let arena = ArenaInfo.buildArena(derivedDataRoot: derivedDataPath)
Expand All @@ -370,7 +372,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

try await tester.checkBuild(runDestination: .macOS) { results in
Expand Down Expand Up @@ -440,7 +442,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

let arena = ArenaInfo.buildArena(derivedDataRoot: derivedDataPath)
Expand All @@ -459,7 +461,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

try await tester.checkBuild(runDestination: .macOS) { results in
Expand Down Expand Up @@ -541,7 +543,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

let arena = ArenaInfo.buildArena(derivedDataRoot: derivedDataPath)
Expand All @@ -562,7 +564,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

try await tester.checkBuild(runDestination: .macOS) { results in
Expand Down Expand Up @@ -618,7 +620,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

try await tester.fs.writeFileContents(blockListFilePath) { file in
Expand All @@ -644,7 +646,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
do {
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file.c")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

try await tester.fs.writeFileContents(blockListFilePath) { file in
Expand Down Expand Up @@ -1550,6 +1552,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
stream <<<
"""
#include "other.h"
void foo(void) {}
"""
}
try await tester.fs.writeFileContents(moduleDir.join("other.h")) { stream in
Expand Down Expand Up @@ -1762,7 +1765,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
"""
}
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/generated1.c.fake-customrule")) { stream in
stream <<< ""
stream <<< "void foo(void) {}"
}

try await tester.checkBuild(runDestination: .macOS) { results in
Expand Down Expand Up @@ -1813,6 +1816,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/t.c")) { stream in
stream <<<
"""
void foo(void) {}
"""
}

Expand Down
4 changes: 4 additions & 0 deletions Tests/SWBBuildSystemTests/ClangExplicitModulesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1224,13 +1224,15 @@ fileprivate struct ClangExplicitModulesTests: CoreBasedTests {
stream <<<
"""
#include "mod.h"
void foo(void) {}
"""
}

try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file_2.c")) { stream in
stream <<<
"""
#include "mod.h"
void bar(void) {}
"""
}

Expand Down Expand Up @@ -1345,13 +1347,15 @@ fileprivate struct ClangExplicitModulesTests: CoreBasedTests {
stream <<<
"""
#include "mod.h"
void foo(void) {}
"""
}

try await tester.fs.writeFileContents(testWorkspace.sourceRoot.join("aProject/file_2.c")) { stream in
stream <<<
"""
#include "mod.h"
void bar(void) {}
"""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ fileprivate struct SDKImportsBuildOperationTests: CoreBasedTests {
let destination: RunDestinationInfo = .host
try await tester.checkBuild(runDestination: destination, signableTargets: Set(provisioningInputs.keys), signableTargetInputs: provisioningInputs) { results in
results.checkNoErrors()
results.checkWarning(.prefix("-ld_classic is deprecated"))
results.checkWarning(.contains("-ld_classic is deprecated"))

let derivedData = tmpDir.join("build/Debug")
let appResources = derivedData.join("tool.app/Contents/Resources")
Expand Down