Skip to content

Commit 01203f6

Browse files
neonichuMaxDesiatov
authored andcommitted
Disable IncrementalBuildTests in unsupported environments (#6885)
This is another set of tests that requires a fully functioning SDK on macOS, so they should be skipped based on `SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS`.
1 parent 452e1ee commit 01203f6

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ let package = Package(
548548
),
549549
.testTarget(
550550
name: "BuildTests",
551-
dependencies: ["Build", "SPMTestSupport"]
551+
dependencies: ["Build", "PackageModel", "SPMTestSupport"]
552552
),
553553
.testTarget(
554554
name: "WorkspaceTests",

Sources/SPMTestSupport/Toolchain.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,9 @@ extension UserToolchain {
110110
return false
111111
}
112112
}
113+
114+
/// Helper function to determine whether we should run SDK-dependent tests.
115+
public func supportsSDKDependentTests() -> Bool {
116+
return ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] == nil
117+
}
113118
}

Tests/BuildTests/IncrementalBuildTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Basics
14+
import PackageModel
1415
import SPMTestSupport
1516
import XCTest
1617

@@ -36,6 +37,7 @@ import XCTest
3637
final class IncrementalBuildTests: XCTestCase {
3738

3839
func testIncrementalSingleModuleCLibraryInSources() throws {
40+
try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test")
3941
try fixture(name: "CFamilyTargets/CLibrarySources") { fixturePath in
4042
// Build it once and capture the log (this will be a full build).
4143
let (fullLog, _) = try executeSwiftBuild(fixturePath)
@@ -93,6 +95,7 @@ final class IncrementalBuildTests: XCTestCase {
9395
}
9496

9597
func testBuildManifestCaching() throws {
98+
try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test")
9699
try fixture(name: "ValidLayouts/SingleModule/Library") { fixturePath in
97100
@discardableResult
98101
func build() throws -> String {
@@ -126,6 +129,7 @@ final class IncrementalBuildTests: XCTestCase {
126129
}
127130

128131
func testDisableBuildManifestCaching() throws {
132+
try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test")
129133
try fixture(name: "ValidLayouts/SingleModule/Library") { fixturePath in
130134
@discardableResult
131135
func build() throws -> String {

0 commit comments

Comments
 (0)