From f736764a0a64729f721f848851bf00d181fa5a40 Mon Sep 17 00:00:00 2001 From: Bassam Khouri Date: Mon, 3 Nov 2025 16:48:02 -0500 Subject: [PATCH] Unconditionally add test targets Since some test targets were being "guarded" behind an environment variable, they were not being executed and were hiding an issue in CI as these tests were being excluded from the Package manifest in the smoke tests pipelies, and were being skipped in the self-hosted pipelines. Since the impacted tests run an end-to-end tests, and the smoke tests pipeline does a partial toolchain build, let's ensure these tests are executed as part of the smoke tests. --- Package.swift | 40 ++++++++----------- .../SwiftTesting+TraitConditional.swift | 13 +++++- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Package.swift b/Package.swift index aa32ba1e384..a3aaa4c4ab7 100644 --- a/Package.swift +++ b/Package.swift @@ -991,28 +991,6 @@ let package = Package( name: "SwiftBuildSupportTests", dependencies: ["SwiftBuildSupport", "_InternalTestSupport", "_InternalBuildTestSupport"] ), - // Examples (These are built to ensure they stay up to date with the API.) - .executableTarget( - name: "package-info", - dependencies: ["Workspace"], - path: "Examples/package-info/Sources/package-info" - ) - ], - swiftLanguageModes: [.v5] -) - -#if canImport(Darwin) -package.targets.append(contentsOf: [ - .executableTarget( - name: "swiftpm-testing-helper" - ) -]) -#endif - -// rdar://101868275 "error: cannot find 'XCTAssertEqual' in scope" can affect almost any functional test, so we flat out -// disable them all until we know what is going on -if ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] == nil { - package.targets.append(contentsOf: [ .testTarget( name: "FunctionalTests", dependencies: [ @@ -1055,9 +1033,23 @@ if ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] == "dummy-swiftc", ] ), - ]) -} + // Examples (These are built to ensure they stay up to date with the API.) + .executableTarget( + name: "package-info", + dependencies: ["Workspace"], + path: "Examples/package-info/Sources/package-info" + ), + ], + swiftLanguageModes: [.v5] +) +#if canImport(Darwin) +package.targets.append(contentsOf: [ + .executableTarget( + name: "swiftpm-testing-helper" + ) +]) +#endif func swiftSyntaxDependencies(_ names: [String]) -> [Target.Dependency] { /// Whether swift-syntax is being built as a single dynamic library instead of as a separate library per module. diff --git a/Sources/_InternalTestSupport/SwiftTesting+TraitConditional.swift b/Sources/_InternalTestSupport/SwiftTesting+TraitConditional.swift index a46dfafe162..ba7edf39e6e 100644 --- a/Sources/_InternalTestSupport/SwiftTesting+TraitConditional.swift +++ b/Sources/_InternalTestSupport/SwiftTesting+TraitConditional.swift @@ -85,8 +85,17 @@ extension Trait where Self == Testing.ConditionTrait { // Enabled if the toolchain has supported features public static var supportsSupportedFeatures: Self { - enabled("skipping because test environment compiler doesn't support `-print-supported-features`") { - (try? UserToolchain.default)!.supportsSupportedFeatures + let isEnabled: Bool + let errorInfo: String + do { + isEnabled = try UserToolchain.default.supportsSupportedFeatures + errorInfo = "" + } catch { + isEnabled = false + errorInfo = "Error: \(error)" + } + return enabled("Skipping because test environment compiler doesn't support `-print-supported-features`.\(errorInfo)") { + isEnabled } }