33 Commits
Author SHA1 Message Date
Karoy Lorentey cae5c18207 [test] Confess that Unmanaged’s hacky Equatable conformance is retroactive 2025-06-03 19:23:56 -07:00
Karoy Lorentey 1abcb9584a [test] Don’t report failures when weakCompareExchange to spuriously fails 2023-09-22 16:51:43 -07:00
Karoy Lorentey 5aad046da6 Update CMake test configuration 2023-03-31 15:19:33 -07:00
Karoy Lorentey bbee754adc ManagedAtomic[LazyReference]: Always access ivar through pointer
The deinit implementations used to access the ivar directly, but that can confuse the compiler into assuming the value never changes after its initialization, because it doesn’t see accesses that are done via the pointer.

Stop accessing the ivar directly once it has been initialized.
2023-03-31 15:19:02 -07:00
Karoy Lorentey e53eff6f17 Update file headers 2023-03-30 14:58:57 -07:00
Karoy Lorentey 0f07d9dcf8 Add a weakCompareExchange variant that only takes a single ordering
Resolves https://github.com/apple/swift-atomics/issues/75
2023-03-24 16:30:49 -07:00
Karoy Lorentey 7feb1c1791 Add support for using LLVM intrinsics instead of C atomics 2023-03-24 15:33:30 -07:00
Karoy Lorentey ca8a8fcc38 Merge pull request #58 from lorentey/fix-non-final-class-warnings
Fix support for non-final classes in AtomicReference
2023-03-20 16:41:41 -07:00
Karoy Lorentey e876381f7d Red tape for our lovely build systems 2023-03-19 20:15:06 -07:00
Karoy Lorentey f482c3098d Update AtomicOptionalWrappable support for RawRepresentable types
Also add some basic tests exercising these.
2023-03-19 19:59:46 -07:00
Karoy Lorentey 46e4e960ac [test] Fix basic tests to to actually cover weakCompareExchange 2023-03-19 19:50:52 -07:00
Karoy Lorentey f2c34f56f6 Simplify shims
Now that we can rely on https://reviews.llvm.org/D86218, we don’t need to tiptoe around the use of `_Atomic(struct dword)`.

Rip out the clumsy encode/decode mess and the use of __uint128_t.
2023-03-18 13:10:31 -07:00
Karoy Lorentey 8ca2dee2bf Split Basics.swift.gyb up into 26 different files
The original autogenerated swift file is so humongous that it causes problems for some folks.

Split it up into one file per XCTestCase.
2023-03-18 01:27:16 -07:00
Karoy Lorentey 45772d95ff Disable test registration outside of CMake builds 2023-03-18 00:49:15 -07:00
Karoy Lorentey 5730529b7f Replace AtomicValue._AtomicValue with AtomicReference._AtomicBase 2023-03-17 22:08:36 -07:00
Karoy Lorentey cb7a3b2d35 ManagedAtomicLazyReference: Properly dispose object on deinit 2023-03-17 15:11:58 -07:00
taylorswift 4c32a32a95 un-uncomment one of the tests 2023-02-17 02:26:28 +00:00
taylorswift 58e5a13f1c enable AtomicReference everywhere, and add some type annotations to tests 2023-02-17 02:22:39 +00:00
Karoy Lorentey 2e0f2aa421 SWIFT_ATOMIC_LONG_TEST → SWIFT_ATOMICS_LONG_TESTS 2021-09-23 11:51:32 -07:00
Karoy Lorentey d7b6750c6e [test] Scale down tests by default 2021-09-22 22:11:31 -07:00
Karoy Lorentey 0e51be5d3a Unmanaged.retain(by:)/release(by:): Remove @inlinable
These are only ever called from opaque function bodies, so there is no need to make them inlinable anyway.

This allows us to stop linking client code with _AtomicsShims. (Although I don't quite understand how it was necessary before.)
2021-09-22 14:53:32 -07:00
Karoy Lorentey 98a31b396d [cmake] Fix building with CMake
- Disable building tests on Darwin
- Fix test registration on Linux when double-wide atomics aren't available
- Unconditionally enable double-wide atomics
2021-09-22 14:53:32 -07:00
Karoy Lorentey 299d1251f1 Regenerate gybbed sources 2021-08-27 17:19:56 -07:00
Karoy Lorentey eb7e1335f8 [NFC] Update copyright notices 2021-08-27 17:13:03 -07:00
Saleem Abdulrasool 907a24f5f2 Add the ability to run tests via CMake
This adds the ability to run the test suite via CMake + Ninja.
2021-04-30 09:13:39 -07:00
Saleem Abdulrasool c711547ac1 Tests: add XCTest manifest for non-SPM based builds
This allows for testing without SPM on non-Darwin targets.  We
explicitly exclude the manifest in SPM based builds because we would
like to use the automatic test discovery functionality from SPM.
2021-04-29 14:43:21 -07:00
Karoy Lorentey 47c88d732f Work around some compiler issues in Swift 5.2
This allows the package to be built with the Swift 5.2.4 toolchain.

Resolves #15
2020-11-09 13:52:03 -08:00
Karoy Lorentey 7658766e61 Remove LinuxMain.swift
This package requires --enable-test-discovery.
2020-10-12 12:08:04 -07:00
Karoy Lorentey ed324ec42e generate-sources: Don’t invoke —generate-linuxmain
SPM’s --generate-linuxmain feature doesn’t support conditionally compiled tests.

To run tests on non-Darwin platforms, use `swift test --enable-test-discovery`.
2020-10-09 14:53:02 -07:00
Karoy Lorentey 9ad914d118 Make double-wide atomics conditional on platform support
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`.
2020-10-09 14:52:33 -07:00
Karoy Lorentey 34caa6fbd5 [test] Split basic tests into 25 separate test cases
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>.
2020-10-09 14:48:50 -07:00
Karoy Lorentey 4fb7f05a27 Register all tests 2020-10-01 18:25:07 -07:00
Karoy Lorentey b97750eb18 Initial commit. 2020-10-01 16:57:36 -07:00