Skip to content

Re-enable disabled tests #6422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 15, 2023
Merged

Re-enable disabled tests #6422

merged 6 commits into from
Apr 15, 2023

Conversation

neonichu
Copy link
Contributor

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.

rdar://96920453

@neonichu neonichu self-assigned this Apr 13, 2023
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@@ -78,6 +78,8 @@ class DependencyResolutionTests: XCTestCase {
}

func testMirrors() throws {
try XCTSkipIf(true, "test is broken and needs investigation rdar://107970938")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test has broken while FunctionalTests were disabled and it wasn't clear to me what to do, so it remains disabled for now.

@@ -1022,7 +1024,7 @@ class PluginTests: XCTestCase {
let (stdout, _) = try executeSwiftBuild(
fixturePath.appending(component: "MySourceGenPlugin"),
configuration: .Debug,
extraArgs: ["--product", "MyLocalTool", "-Xbuild-tools-swiftc", "-DUSE_CREATING"]
extraArgs: ["--product", "MyLocalTool", "-Xbuild-tools-swiftc", "-DUSE_CREATE"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was not working, the source code uses USE_CREATE.

#else
XCTAssertBuilds(packageRoot)
#endif
XCTAssertBuilds(packageRoot)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executable templates no longer contain tests.

@@ -4948,8 +4948,6 @@ final class WorkspaceTests: XCTestCase {

// This verifies that the simplest possible loading APIs are available for package clients.
func testSimpleAPI() throws {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses an executable template which doesn't contain tests anymore, so the original flaky failure should not be possible anymore regardless of whether the newer superior Xcode fixed it or not.

@neonichu
Copy link
Contributor Author

Test Suite 'Selected tests' started at 2023-04-13 04:44:02.153Test Suite 'SwiftPMPackageTests.xctest' started at 2023-04-13 04:44:02.154Test Suite 'ResourcesTests' started at 2023-04-13 04:44:02.154Test Case '-[FunctionalTests.ResourcesTests testMovedBinaryResources]' started./Users/ec2-user/jenkins/workspace/swift-package-manager-PR-macos-smoke-test/branch-main/swift-tools-support-core/Sources/TSCBasic/Process.swift:1166: error: -[FunctionalTests.ResourcesTests testMovedBinaryResources] : failed: caught error: "signalled(6): /var/folders/7n/r31lzfjx6556jgc6vg55_cg80000gn/T/SwiftyResource.wmt1iS/SwiftyResource output:
    2023-04-13 04:44:11.816 SwiftyResource[59548:2909256] -[Swift.__SharedStringStorage hasSuffix:]: unrecognized selector sent to instance 0x6000014ec030
    2023-04-13 04:44:11.817 SwiftyResource[59548:2909256] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Swift.__SharedStringStorage hasSuffix:]: unrecognized selector sent to instance 0x6000014ec030'

@neonichu
Copy link
Contributor Author

This actually looks familiar, IIRC this was an issue when using inferior Swift libs but Foundation from the OS?

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

2 similar comments
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

neonichu commented Apr 13, 2023

¯\_(ツ)_/¯

@neonichu
Copy link
Contributor Author

[1173/1235] Emitting module PackageCollectionsSigning
/home/build-user/swiftpm/Sources/PackageCollectionsSigning/Certificate/Certificate.swift:187:55: error: cannot find type 'EVP_PKEY' in scope
    private func keyType(of key: UnsafeMutablePointer<EVP_PKEY>) throws -> KeyType {
                                                      ^~~~~~~~

@yim-lee
Copy link
Contributor

yim-lee commented Apr 13, 2023

Changes in swift-crypto 2.4.1 cause the issue. Might need to force exact version 2.4.0 until we figure out how to fix it.

@neonichu
Copy link
Contributor Author

neonichu commented Apr 13, 2023

We're still hitting the rpath/dyld issue :/

@neonichu
Copy link
Contributor Author

Oh, I wonder whether we may need the macOS 12 deployment target update first?

@neonichu
Copy link
Contributor Author

I should probably use SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS in this PR. The main goal is to finally restore coverage for these tests with a workaround that we hand't thought of before. Making them work on macOS Swift CI is secondary and can happen on a follow-up PR.

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.

rdar://96920453
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.
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

Looks like deployment target didn't make a difference, so I'll update this to set SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS on macOS when using bootstrap.

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for applying the cleanups as well!

@neonichu
Copy link
Contributor Author

Actually found one more way how the inferior Swift runtime could be sneaking in on macOS, so trying to run tests once more.

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

Looks like DYLD_LIBRARY_PATH was indeed the final piece to avoid the dynamic linker issue. There's still

[1543/1543] Testing WorkspaceTests.WorkspaceTests/testStateModified
Test Suite 'Selected tests' started at 2023-04-14 06:45:46.798
Test Suite 'SwiftPMPackageTests.xctest' started at 2023-04-14 06:45:46.799Test Suite 'WorkspaceTests' started at 2023-04-14 06:45:46.799Test Case '-[WorkspaceTests.WorkspaceTests testSimpleAPI]' started./Users/ec2-user/jenkins/workspace/swift-package-manager-PR-macos-smoke-test/branch-main/swiftpm/Tests/WorkspaceTests/WorkspaceTests.swift:4967: error: -[WorkspaceTests.WorkspaceTests testSimpleAPI] : failed: caught error: "fatalError"Test Case '-[WorkspaceTests.WorkspaceTests testSimpleAPI]' failed (2.746 seconds).Test Suite 'WorkspaceTests' failed at 2023-04-14 06:45:49.545.
	 Executed 1 test, with 1 failure (1 unexpected) in 2.746 (2.746) secondsTest Suite 'SwiftPMPackageTests.xctest' failed at 2023-04-14 06:45:49.545.
	 Executed 1 test, with 1 failure (1 unexpected) in 2.746 (2.746) seconds
Test Suite 'Selected tests' failed at 2023-04-14 06:45:49.545.
	 Executed 1 test, with 1 failure (1 unexpected) in 2.746 (2.747) seconds[debug]: evaluating manifest for 'mypkg' v. unknown
[error]: Invalid manifest (compiled with: ["/Users/ec2-user/jenkins/workspace/swift-package-manager-PR-macos-smoke-test/branch-main/build/buildbot_incremental/toolchain-macosx-x86_64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-vfsoverlay", "/var/folders/7n/r31lzfjx6556jgc6vg55_cg80000gn/T/TemporaryDirectory.1QDKFO/vfs.yaml", "-L", "/Users/ec2-user/jenkins/workspace/swift-package-manager-PR-macos-smoke-test/branch-main/build/buildbot_incremental/toolchain-macosx-x86_64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Users/ec2-user/jenkins/workspace/swift-package-manager-PR-macos-smoke-test/branch-main/build/buildbot_incremental/toolchain-macosx-x86_64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-target", "x86_64-apple-macosx10.15", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk", "-F", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-I", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-L", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-swift-version", "5", "-I", "/Users/ec2-user/jenkins/workspace/swift-package-manager-PR-macos-smoke-test/branch-main/build/buildbot_incremental/toolchain-macosx-x86_64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk", "-package-description-version", "5.9.0", "/var/folders/7n/r31lzfjx6556jgc6vg55_cg80000gn/T/spm-tests-testSimpleAPI.t47rAD/MyPkg/Package.swift", "-o", "/var/folders/7n/r31lzfjx6556jgc6vg55_cg80000gn/T/TemporaryDirectory.J3kZ4K/mypkg-manifest"])
/var/folders/7n/r31lzfjx6556jgc6vg55_cg80000gn/T/spm-tests-testSimpleAPI.t47rAD/MyPkg/Package.swift:4:8: error: no such module 'PackageDescription'
import PackageDescription
       ^

and I wonder if this might explain why I had to make a change to PackageDescriptionSerialization to make this test work locally. It looks like we may not really be using the correct PD library when running this test.

@neonichu
Copy link
Contributor Author

I also introduced an issue in bootstrap specific to non-Darwin:

TypeError: can only concatenate str (not "list") to str

@tomerd tomerd mentioned this pull request Apr 14, 2023
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

@swift-ci please smoke test windows

@neonichu
Copy link
Contributor Author

Tests are passing 🎉

@neonichu neonichu enabled auto-merge (squash) April 15, 2023 00:06
@tomerd
Copy link
Contributor

tomerd commented Apr 15, 2023

\o/

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

# Add a relative rpath to find Swift libraries in toolchains.
# On non-Darwin platforms, a relative rpath is necessary because Swift
# libraries are not part of the OS.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment should actually stay since we're only changing this for Darwin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I had automerge enabled, going to restore this comment in a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we moved the non-Darwin part out of bootstrap and put it behind SWIFTCI_INSTALL_RPATH_OS, so this it is correct for the comment to be gone.

@yim-lee
Copy link
Contributor

yim-lee commented Apr 15, 2023

@swift-ci please test Windows platform

@neonichu neonichu merged commit 16fb1d2 into main Apr 15, 2023
@neonichu neonichu deleted the 96920453 branch April 17, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants