Skip to content

Commit dbc03b4

Browse files
committed
Re-enable disabled tests
* Re-enable disabled tests This re-enables a bunch of disabled tests, the hope is that they should now work that we have a newer superior Xcode installed on CI. If that happens to not be the case, we have `SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS` to disable these tests specifically for the macOS CI if needed. This change introduces the variable where expected to be needed, but doesn't set it. * Removed back deployment rpaths * Removed more Darwin rpaths into the toolchain A macOS that contains the dyld issue worked around by swiftlang/swift#37978 has been deployed by Swift CI, so we can't do this anymore on Darwin. * Do not include Swift runtime libs in `DYLD_LIBRARY_PATH` on Darwin (cherry picked from commit 16fb1d2)
1 parent 65ad69b commit dbc03b4

File tree

9 files changed

+68
-88
lines changed

9 files changed

+68
-88
lines changed

Examples/package-info/Sources/package-info/example.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#if swift(>=5.7)
2-
@preconcurrency import Basics
3-
#else
41
import Basics
5-
#endif
62
import TSCBasic
73
import Workspace
84

Package.swift

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -579,47 +579,10 @@ let package = Package(
579579
name: "BuildTests",
580580
dependencies: ["Build", "SPMTestSupport"]
581581
),
582-
.testTarget(
583-
name: "CommandsTests",
584-
dependencies: [
585-
"swift-build",
586-
"swift-package",
587-
"swift-test",
588-
"swift-run",
589-
"Basics",
590-
"Build",
591-
"Commands",
592-
"PackageModel",
593-
"PackageRegistryTool",
594-
"SourceControl",
595-
"SPMTestSupport",
596-
"Workspace",
597-
]
598-
),
599582
.testTarget(
600583
name: "WorkspaceTests",
601584
dependencies: ["Workspace", "SPMTestSupport"]
602585
),
603-
// 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
604-
/*.testTarget(
605-
name: "FunctionalTests",
606-
dependencies: [
607-
"swift-build",
608-
"swift-package",
609-
"swift-test",
610-
"PackageModel",
611-
"SPMTestSupport"
612-
]
613-
),*/
614-
.testTarget(
615-
name: "FunctionalPerformanceTests",
616-
dependencies: [
617-
"swift-build",
618-
"swift-package",
619-
"swift-test",
620-
"SPMTestSupport"
621-
]
622-
),
623586
.testTarget(
624587
name: "PackageDescriptionTests",
625588
dependencies: ["PackageDescription"]
@@ -703,6 +666,56 @@ let package = Package(
703666
swiftLanguageVersions: [.v5]
704667
)
705668

669+
// Workaround SPM's attempt to link in executables which does not work on all
670+
// platforms.
671+
#if !os(Windows)
672+
package.targets.append(contentsOf: [
673+
.testTarget(
674+
name: "CommandsTests",
675+
dependencies: [
676+
"swift-build",
677+
"swift-package",
678+
"swift-test",
679+
"swift-run",
680+
"Basics",
681+
"Build",
682+
"Commands",
683+
"PackageModel",
684+
"PackageRegistryTool",
685+
"SourceControl",
686+
"SPMTestSupport",
687+
"Workspace",
688+
]
689+
),
690+
691+
.testTarget(
692+
name: "FunctionalPerformanceTests",
693+
dependencies: [
694+
"swift-build",
695+
"swift-package",
696+
"swift-test",
697+
"SPMTestSupport"
698+
]
699+
),
700+
])
701+
702+
// 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
703+
if ProcessInfo.processInfo.environment["SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS"] == nil {
704+
package.targets.append(contentsOf: [
705+
.testTarget(
706+
name: "FunctionalTests",
707+
dependencies: [
708+
"swift-build",
709+
"swift-package",
710+
"swift-test",
711+
"PackageModel",
712+
"SPMTestSupport"
713+
]
714+
),
715+
])
716+
}
717+
#endif
718+
706719
// Add package dependency on llbuild when not bootstrapping.
707720
//
708721
// When bootstrapping SwiftPM, we can't use llbuild as a package dependency it

Sources/Build/BuildPlan.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,10 +770,6 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
770770
case.unknown:
771771
throw InternalError("unknown binary target '\(target.name)' type")
772772
}
773-
case .macro:
774-
if product.type == .macro {
775-
staticTargets.append(target)
776-
}
777773
case .plugin:
778774
continue
779775
}

Tests/FunctionalTests/DependencyResolutionTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class DependencyResolutionTests: XCTestCase {
7878
}
7979

8080
func testMirrors() throws {
81+
try XCTSkipIf(true, "test is broken and needs investigation rdar://107970938")
82+
8183
try fixture(name: "DependencyResolution/External/Mirror") { fixturePath in
8284
let prefix = try resolveSymlinks(fixturePath)
8385
let appPath = prefix.appending("App")

Tests/FunctionalTests/PluginTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ class PluginTests: XCTestCase {
463463
accessibleTools: [:],
464464
writableDirectories: [pluginDir.appending("output")],
465465
readOnlyDirectories: [package.path],
466+
allowNetworkConnections: [],
466467
pkgConfigDirectories: [],
467468
fileSystem: localFileSystem,
468469
observabilityScope: observability.topScope,
@@ -729,6 +730,7 @@ class PluginTests: XCTestCase {
729730
accessibleTools: [:],
730731
writableDirectories: [pluginDir.appending("output")],
731732
readOnlyDirectories: [package.path],
733+
allowNetworkConnections: [],
732734
pkgConfigDirectories: [],
733735
fileSystem: localFileSystem,
734736
observabilityScope: observability.topScope,
@@ -1022,7 +1024,7 @@ class PluginTests: XCTestCase {
10221024
let (stdout, _) = try executeSwiftBuild(
10231025
fixturePath.appending(component: "MySourceGenPlugin"),
10241026
configuration: .Debug,
1025-
extraArgs: ["--product", "MyLocalTool", "-Xbuild-tools-swiftc", "-DUSE_CREATING"]
1027+
extraArgs: ["--product", "MyLocalTool", "-Xbuild-tools-swiftc", "-DUSE_CREATE"]
10261028
)
10271029
XCTAssert(stdout.contains("Linking MySourceGenBuildTool"), "stdout:\n\(stdout)")
10281030
XCTAssert(stdout.contains("Creating foo.swift from foo.dat"), "stdout:\n\(stdout)")

Tests/FunctionalTests/ResourcesTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
import XCTest
1414
import SPMTestSupport
1515

16-
import TSCBasic
16+
import struct TSCBasic.AbsolutePath
17+
import var TSCBasic.localFileSystem
18+
import func TSCBasic.withTemporaryDirectory
1719

1820
class ResourcesTests: XCTestCase {
1921
func testSimpleResources() throws {

Tests/WorkspaceTests/InitTests.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ class InitTests: XCTestCase {
248248
}
249249

250250
func testNonC99NameExecutablePackage() throws {
251-
throw XCTSkip("This test fails to find XCTAssertEqual; rdar://101868275")
252-
253251
try withTemporaryDirectory(removeTreeOnDeinit: true) { tempDirPath in
254252
XCTAssertDirectoryExists(tempDirPath)
255253

@@ -266,11 +264,7 @@ class InitTests: XCTestCase {
266264
)
267265
try initPackage.writePackageStructure()
268266

269-
#if os(macOS)
270-
XCTAssertSwiftTest(packageRoot)
271-
#else
272-
XCTAssertBuilds(packageRoot)
273-
#endif
267+
XCTAssertBuilds(packageRoot)
274268
}
275269
}
276270

Tests/WorkspaceTests/WorkspaceTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4948,8 +4948,6 @@ final class WorkspaceTests: XCTestCase {
49484948

49494949
// This verifies that the simplest possible loading APIs are available for package clients.
49504950
func testSimpleAPI() throws {
4951-
throw XCTSkip("This test fails to find XCTAssertEqual; rdar://101868275")
4952-
49534951
try testWithTemporaryDirectory { path in
49544952
// Create a temporary package as a test case.
49554953
let packagePath = path.appending("MyPkg")
@@ -4963,7 +4961,10 @@ final class WorkspaceTests: XCTestCase {
49634961

49644962
// Load the workspace.
49654963
let observability = ObservabilitySystem.makeForTesting()
4966-
let workspace = try Workspace(forRootPackage: packagePath)
4964+
let workspace = try Workspace(
4965+
forRootPackage: packagePath,
4966+
customHostToolchain: UserToolchain.default
4967+
)
49674968

49684969
// From here the API should be simple and straightforward:
49694970
let manifest = try tsc_await {

Utilities/bootstrap

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,7 @@ def add_rpath_for_cmake_build(args, rpath):
583583

584584
def get_swift_backdeploy_library_paths(args):
585585
if platform.system() == 'Darwin':
586-
# Need to include backwards compatibility libraries for Concurrency
587-
if args.release:
588-
# For release builds, we need a relative path that finds the compatibility libs in the current toolchain.
589-
backdeploy_path = '@executable_path/../lib/swift-5.5/macosx'
590-
else:
591-
# FIXME: Would be nice if we could get this from `swiftc -print-target-info`
592-
backdeploy_path = args.target_info["paths"]["runtimeLibraryPaths"][0] + '/../../swift-5.5/macosx'
593-
return ['/usr/lib/swift', backdeploy_path]
586+
return ['/usr/lib/swift']
594587
else:
595588
return []
596589

@@ -750,7 +743,7 @@ def get_swiftpm_env_cmd(args):
750743
env_cmd.append("SWIFTCI_INSTALL_RPATH_OS=%s" % args.platform_path.group(2))
751744

752745
if args.bootstrap:
753-
libs_joined = ":".join([
746+
libs = [
754747
os.path.join(args.bootstrap_dir, "lib"),
755748
os.path.join(args.build_dirs["tsc"], "lib"),
756749
os.path.join(args.build_dirs["llbuild"], "lib"),
@@ -762,11 +755,12 @@ def get_swiftpm_env_cmd(args):
762755
os.path.join(args.build_dirs["swift-collections"], "lib"),
763756
os.path.join(args.build_dirs["swift-asn1"], "lib"),
764757
os.path.join(args.build_dirs["swift-certificates"], "lib"),
765-
] + args.target_info["paths"]["runtimeLibraryPaths"])
758+
]
766759

767760
if platform.system() == 'Darwin':
768-
env_cmd.append("DYLD_LIBRARY_PATH=%s" % libs_joined)
761+
env_cmd.append("DYLD_LIBRARY_PATH=%s" % ":".join(libs))
769762
else:
763+
libs_joined = ":".join(libs + args.target_info["paths"]["runtimeLibraryPaths"])
770764
env_cmd.append("LD_LIBRARY_PATH=%s" % libs_joined)
771765

772766
return env_cmd
@@ -799,26 +793,6 @@ def get_swiftpm_flags(args):
799793
"-Xlinker", "@executable_path/../lib/swift/pm/llbuild",
800794
])
801795

802-
# Add a relative rpath to find Swift libraries in toolchains.
803-
# On non-Darwin platforms, a relative rpath is necessary because Swift
804-
# libraries are not part of the OS.
805-
# On Darwin platforms, a relative rpath is necessary for experimental
806-
# toolchains that include libraries not part of the OS (e.g. PythonKit or
807-
# TensorFlow).
808-
if '-macosx' in args.build_target:
809-
# rpaths for compatibility libraries
810-
for lib_path in get_swift_backdeploy_library_paths(args):
811-
build_flags.extend(["-Xlinker", "-rpath", "-Xlinker", lib_path])
812-
813-
build_flags.extend(
814-
[
815-
"-Xlinker",
816-
"-rpath",
817-
"-Xlinker",
818-
"@executable_path/../" + args.platform_path.group(1),
819-
]
820-
)
821-
822796
if '-openbsd' in args.build_target:
823797
build_flags.extend(["-Xlinker", "-z", "-Xlinker", "origin"])
824798
build_flags.extend(["-Xcc", "-I/usr/local/include"])

0 commit comments

Comments
 (0)