Skip to content

Fix Linux compatibility #12

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
Oct 12, 2020
Merged

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Oct 8, 2020

This PR resolves issues preventing this package from working as designed on Linux:

  • One of the test cases has grown to >1600 tests, which triggers a compiler timeout while type checking the test registry.
  • generate-sources is not compatible with GNU coreutils.
  • The package definition is lacking a conditional link dependency on libatomics.so on Linux. (Triggered by support for double-wide atomics -- see below.)
  • Double-wide atomics need to be disabled on Linux/x86_64 unless cmpxchg16b support is manually enabled via -Xcc -mcx16.

Closes #10.

This prevents an “unable to typecheck in reasonable time” error when compiling the test registry.

1612 tests under one test case is currently too many for swift-corelibs-xctest.

While we’re here, add explicit test cases for UnsafeRawPointer and Optional<UnsafeRawPointer>.
Linux on x86_64 unfortunately disables support for cmpxchg16 by default, making double-wide atomic operations fall back to using locks. We cannot currently override this on the package level, so stop providing double-wide atomics in this configuration by default.

To enable codegen support for double-wide atomics on Linux/x86_64, compile the package with `-Xcc -mcx16 -Xswiftc -DENABLE_DOUBLEWIDE_ATOMICS`.
SPM’s --generate-linuxmain feature doesn’t support conditionally compiled tests.

To run tests on non-Darwin platforms, use `swift test --enable-test-discovery`.
@lorentey lorentey force-pushed the restore-linux-support branch from 963e3a7 to ed324ec Compare October 9, 2020 22:22
@lorentey lorentey marked this pull request as ready for review October 9, 2020 22:59
@lorentey lorentey requested a review from stephentyrone October 9, 2020 23:00
@lorentey lorentey force-pushed the restore-linux-support branch from 82bfd8d to 230c1aa Compare October 10, 2020 00:18
This package requires --enable-test-discovery.
@lorentey lorentey merged commit 26e346c into apple:main Oct 12, 2020
@lorentey lorentey deleted the restore-linux-support branch October 12, 2020 19:27
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.

Linux Support?
1 participant