From c03d08a01c6904872a85fb97769cebd4ff768df2 Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Sat, 12 Apr 2025 21:13:14 -0700 Subject: [PATCH 1/8] WIP: Unskipping BuildPlanSwiftBuildTests --- Tests/BuildTests/BuildPlanTests.swift | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index 914b46130a4..a1d01d64d8a 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -696,15 +696,17 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { fileSystem: localFileSystem ) try await fixture(name: "Miscellaneous/TargetPackageAccess") { fixturePath in - let (stdout, _) = try await executeSwiftBuild( + let (stdout, stderr) = try await executeSwiftBuild( fixturePath.appending("libPkg"), extraArgs: ["-v"], buildSystem: buildSystemProvider ) + let output = stdout + "\n" + stderr + if isFlagSupportedInDriver { - let moduleFlag1 = stdout.range(of: "-module-name DataModel") + let moduleFlag1 = output.range(of: "-module-name DataModel") XCTAssertNotNil(moduleFlag1) - let stdoutNext1 = stdout[moduleFlag1!.upperBound...] + let stdoutNext1 = output[moduleFlag1!.upperBound...] let packageFlag1 = stdoutNext1.range(of: "-package-name libpkg") XCTAssertNotNil(packageFlag1) @@ -736,9 +738,9 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { let packageFlag5 = stdoutNext5.range(of: "-package-name") XCTAssertNil(packageFlag5) } else { - XCTAssertNoMatch(stdout, .contains("-package-name")) + XCTAssertNoMatch(output, .contains("-package-name")) } - XCTAssertMatch(stdout, .contains("Build complete!")) + XCTAssertMatch(output, .contains("Build complete!")) } } @@ -7059,14 +7061,6 @@ class BuildPlanSwiftBuildTests: BuildPlanTestCase { try await super.testDuplicateProductNamesWithNonDefaultLibsThrowError() } - override func testTargetsWithPackageAccess() async throws { - throw XCTSkip("Skip until swift build system can support this case.") - } - - override func testTestModule() async throws { - throw XCTSkip("Skip until swift build system can support this case.") - } - override func testPackageNameFlag() async throws { #if os(Windows) throw XCTSkip("Skip until there is a resolution to the partial linking with Windows that results in a 'subsystem must be defined' error.") From f0144d9c0f3d0d210879e4446fa781158da8b58b Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Mon, 14 Apr 2025 19:24:25 -0700 Subject: [PATCH 2/8] Minor tweaks --- Tests/BuildTests/BuildPlanTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index a1d01d64d8a..e0969bb60fd 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -7062,18 +7062,18 @@ class BuildPlanSwiftBuildTests: BuildPlanTestCase { } override func testPackageNameFlag() async throws { -#if os(Windows) + #if os(Windows) throw XCTSkip("Skip until there is a resolution to the partial linking with Windows that results in a 'subsystem must be defined' error.") -#endif + #endif -#if os(Linux) + #if os(Linux) if FileManager.default.contents(atPath: "/etc/system-release").map { String(decoding: $0, as: UTF8.self) == "Amazon Linux release 2 (Karoo)\n" } ?? false { throw XCTSkip("Skipping Swift Build testing on Amazon Linux because of platform issues.") } // Linking error: "/usr/bin/ld.gold: fatal error: -pie and -static are incompatible". // Tracked by GitHub issue: https://github.com/swiftlang/swift-package-manager/issues/8499 throw XCTSkip("Skipping Swift Build testing on Linux because of linking issues.") -#endif + #endif try await super.testPackageNameFlag() } From 50e2952ea34e2de5dd7fa245b16a34e7e7012afe Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Mon, 14 Apr 2025 19:25:37 -0700 Subject: [PATCH 3/8] Another typo --- Tests/BuildTests/BuildPlanTests.swift | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index e0969bb60fd..0d3e497496c 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -706,36 +706,36 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { if isFlagSupportedInDriver { let moduleFlag1 = output.range(of: "-module-name DataModel") XCTAssertNotNil(moduleFlag1) - let stdoutNext1 = output[moduleFlag1!.upperBound...] - let packageFlag1 = stdoutNext1.range(of: "-package-name libpkg") + let outNext1 = output[moduleFlag1!.upperBound...] + let packageFlag1 = outNext1.range(of: "-package-name libpkg") XCTAssertNotNil(packageFlag1) - let moduleFlag2 = stdoutNext1.range(of: "-module-name DataManager") + let moduleFlag2 = outNext1.range(of: "-module-name DataManager") XCTAssertNotNil(moduleFlag2) XCTAssertTrue(packageFlag1!.upperBound < moduleFlag2!.lowerBound) - let stdoutNext2 = stdoutNext1[moduleFlag2!.upperBound...] - let packageFlag2 = stdoutNext2.range(of: "-package-name libpkg") + let outNext2 = outNext1[moduleFlag2!.upperBound...] + let packageFlag2 = outNext2.range(of: "-package-name libpkg") XCTAssertNotNil(packageFlag2) - let moduleFlag3 = stdoutNext2.range(of: "-module-name Core") + let moduleFlag3 = outNext2.range(of: "-module-name Core") XCTAssertNotNil(moduleFlag3) XCTAssertTrue(packageFlag2!.upperBound < moduleFlag3!.lowerBound) - let stdoutNext3 = stdoutNext2[moduleFlag3!.upperBound...] - let packageFlag3 = stdoutNext3.range(of: "-package-name libpkg") + let outNext3 = outNext2[moduleFlag3!.upperBound...] + let packageFlag3 = outNext3.range(of: "-package-name libpkg") XCTAssertNotNil(packageFlag3) - let moduleFlag4 = stdoutNext3.range(of: "-module-name MainLib") + let moduleFlag4 = outNext3.range(of: "-module-name MainLib") XCTAssertNotNil(moduleFlag4) XCTAssertTrue(packageFlag3!.upperBound < moduleFlag4!.lowerBound) - let stdoutNext4 = stdoutNext3[moduleFlag4!.upperBound...] - let packageFlag4 = stdoutNext4.range(of: "-package-name libpkg") + let outNext4 = outNext3[moduleFlag4!.upperBound...] + let packageFlag4 = outNext4.range(of: "-package-name libpkg") XCTAssertNotNil(packageFlag4) - let moduleFlag5 = stdoutNext4.range(of: "-module-name ExampleApp") + let moduleFlag5 = outNext4.range(of: "-module-name ExampleApp") XCTAssertNotNil(moduleFlag5) XCTAssertTrue(packageFlag4!.upperBound < moduleFlag5!.lowerBound) - let stdoutNext5 = stdoutNext4[moduleFlag5!.upperBound...] - let packageFlag5 = stdoutNext5.range(of: "-package-name") + let outNext5 = ou tNext4[moduleFlag5!.upperBound...] + let packageFlag5 = outNext5.range(of: "-package-name") XCTAssertNil(packageFlag5) } else { XCTAssertNoMatch(output, .contains("-package-name")) From 3281d0c3d06cefe92f15a65aadf09a32ba66fb96 Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Mon, 14 Apr 2025 22:39:21 -0700 Subject: [PATCH 4/8] PR feedback --- Tests/BuildTests/BuildPlanTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index 0d3e497496c..26a08635077 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -734,7 +734,7 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { let moduleFlag5 = outNext4.range(of: "-module-name ExampleApp") XCTAssertNotNil(moduleFlag5) XCTAssertTrue(packageFlag4!.upperBound < moduleFlag5!.lowerBound) - let outNext5 = ou tNext4[moduleFlag5!.upperBound...] + let outNext5 = outNext4[moduleFlag5!.upperBound...] let packageFlag5 = outNext5.range(of: "-package-name") XCTAssertNil(packageFlag5) } else { From d670ed053fbb05d581abc6c57f612efb1c704c20 Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Mon, 14 Apr 2025 22:42:46 -0700 Subject: [PATCH 5/8] Minor tweak --- Tests/BuildTests/BuildPlanTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index 26a08635077..bf028d2dcb6 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -740,7 +740,7 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { } else { XCTAssertNoMatch(output, .contains("-package-name")) } - XCTAssertMatch(output, .contains("Build complete!")) + XCTAssertMatch(stdout, .contains("Build complete!")) } } From 5e7ed21e10df38e73e40bde90c7ceddb9ed78504 Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Mon, 14 Apr 2025 22:48:41 -0700 Subject: [PATCH 6/8] Code formatting --- Tests/BuildTests/BuildPlanTests.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index bf028d2dcb6..69048a13aea 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -48,7 +48,10 @@ extension Build.BuildPlan { class BuildPlanTestCase: BuildSystemProviderTestCase { override func setUpWithError() throws { - try XCTSkipIf(type(of: self) == BuildPlanTestCase.self, "Skipping this test since it will be run in subclasses that will provide different build systems to test.") + try XCTSkipIf( + type(of: self) == BuildPlanTestCase.self, + "Skipping this test since it will be run in subclasses that will provide different build systems to test." + ) } let inputsDir = AbsolutePath(#file).parentDirectory.appending(components: "Inputs") From cca858a9246f02407324b4eb8ffb9808105d5280 Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Mon, 14 Apr 2025 23:00:36 -0700 Subject: [PATCH 7/8] Minor cleanup --- Tests/BuildTests/BuildPlanTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index 69048a13aea..44831fe9147 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -49,7 +49,7 @@ extension Build.BuildPlan { class BuildPlanTestCase: BuildSystemProviderTestCase { override func setUpWithError() throws { try XCTSkipIf( - type(of: self) == BuildPlanTestCase.self, + Self.self == BuildPlanTestCase.self, "Skipping this test since it will be run in subclasses that will provide different build systems to test." ) } From cffbb4a8a5e8ba7aaa85afc751b121fee56d709b Mon Sep 17 00:00:00 2001 From: Paulo Mattos Date: Tue, 15 Apr 2025 11:01:49 -0700 Subject: [PATCH 8/8] Add link to GitHub issue --- Tests/BuildTests/BuildPlanTests.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index 44831fe9147..17172e98b91 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -7066,6 +7066,7 @@ class BuildPlanSwiftBuildTests: BuildPlanTestCase { override func testPackageNameFlag() async throws { #if os(Windows) + // * GitHub issue: https://github.com/swiftlang/swift-package-manager/issues/8380 throw XCTSkip("Skip until there is a resolution to the partial linking with Windows that results in a 'subsystem must be defined' error.") #endif @@ -7074,7 +7075,7 @@ class BuildPlanSwiftBuildTests: BuildPlanTestCase { throw XCTSkip("Skipping Swift Build testing on Amazon Linux because of platform issues.") } // Linking error: "/usr/bin/ld.gold: fatal error: -pie and -static are incompatible". - // Tracked by GitHub issue: https://github.com/swiftlang/swift-package-manager/issues/8499 + // * GitHub issue: https://github.com/swiftlang/swift-package-manager/issues/8499 throw XCTSkip("Skipping Swift Build testing on Linux because of linking issues.") #endif