Skip to content

Commit

Permalink
Clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Mar 20, 2022
1 parent 684facf commit 55b3d49
Show file tree
Hide file tree
Showing 6 changed files with 310 additions and 203 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,31 +116,37 @@ jobs:

- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
if: matrix.target == '' || startsWith(matrix.target, 'x86_64')
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
if: matrix.target == '' || startsWith(matrix.target, 'x86_64')
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
if: matrix.target == '' || startsWith(matrix.target, 'x86_64')

- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse
if: startsWith(matrix.target, 'aarch64')
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse
if: startsWith(matrix.target, 'aarch64')
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse
if: startsWith(matrix.target, 'aarch64')

Expand Down Expand Up @@ -285,30 +291,19 @@ jobs:
CARGO_PROFILE_RELEASE_LTO: fat
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -Z doctest-xcompile
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile
env:
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b

cov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: taiki-e/github-actions/install-rust@main
with:
component: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --workspace --exclude asm-test --exclude bench --all-features
- run: cargo llvm-cov --workspace --exclude asm-test --exclude bench --all-features --text --no-run --hide-instantiations
- run: cargo llvm-cov --workspace --exclude asm-test --exclude bench --all-features --text --no-run

codegen:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -389,7 +384,6 @@ jobs:
- miri
- san
- valgrind
- cov
- codegen
- tidy
- docs
Expand Down
2 changes: 1 addition & 1 deletion src/imp/fallback/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ macro_rules! atomic {
// However, according to atomic-memcpy's asm test, there seems
// to be no tier 1 or tier 2 platform that generates such code
// for a pointer-width relaxed load + acquire fence:
// https://github.com/taiki-e/atomic-memcpy/tree/a8e78b99710b3b35ab123c1d3144cb618ae61a57/tests/asm-test/asm
// https://github.com/taiki-e/atomic-memcpy/tree/v0.1.3/tests/asm-test/asm
unsafe {
self.v.get().read()
}
Expand Down
16 changes: 11 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ On x86_64, when the `outline-atomics` optional feature is not enabled and `cmpxc
#![cfg_attr(not(portable_atomic_no_unsafe_op_in_unsafe_fn), warn(unsafe_op_in_unsafe_fn))] // unsafe_op_in_unsafe_fn requires Rust 1.52
#![cfg_attr(portable_atomic_no_unsafe_op_in_unsafe_fn, allow(unused_unsafe))]
#![warn(
clippy::default_union_representation,
clippy::exhaustive_enums,
clippy::exhaustive_structs,
clippy::inline_asm_x86_att_syntax,
clippy::missing_inline_in_public_items,
clippy::pedantic,
clippy::transmute_undefined_repr,
clippy::undocumented_unsafe_blocks
)]
#![allow(
Expand Down Expand Up @@ -1378,16 +1380,18 @@ atomic instructions or locks will be used.
any(portable_atomic_target_feature_lse, target_feature = "lse"),
),
portable_atomic_armv5te,
all(target_arch = "mips", target_endian = "little"),
all(target_arch = "mips64", target_endian = "little"),
target_arch = "mips",
target_arch = "mips64",
target_arch = "powerpc",
target_arch = "powerpc64",
))]
{
// HACK: the following operations are currently broken (at least on qemu):
// - aarch64+lse's `AtomicI{8,16}::fetch_{max,min}` (release mode)
// - aarch64's `AtomicI{8,16}::fetch_{max,min}` (release mode + lse)
// - armv5te's `Atomic{I,U}{8,16}::fetch_{max,min}`
// - mips's `AtomicI8::fetch_{max,min}` (release mode)
// - mipsel's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
// - mips64's `AtomicI8::fetch_{max,min}` (release mode)
// - mips64el's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
// - powerpc's `AtomicI{8,16}::fetch_{max,min}`
// - powerpc64's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
Expand Down Expand Up @@ -1445,16 +1449,18 @@ atomic instructions or locks will be used.
any(portable_atomic_target_feature_lse, target_feature = "lse"),
),
portable_atomic_armv5te,
all(target_arch = "mips", target_endian = "little"),
all(target_arch = "mips64", target_endian = "little"),
target_arch = "mips",
target_arch = "mips64",
target_arch = "powerpc",
target_arch = "powerpc64",
))]
{
// HACK: the following operations are currently broken (at least on qemu):
// - aarch64's `AtomicI{8,16}::fetch_{max,min}` (release mode + lse)
// - armv5te's `Atomic{I,U}{8,16}::fetch_{max,min}`
// - mips's `AtomicI8::fetch_{max,min}` (release mode)
// - mipsel's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
// - mips64's `AtomicI8::fetch_{max,min}` (release mode)
// - mips64el's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
// - powerpc's `AtomicI{8,16}::fetch_{max,min}`
// - powerpc64's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
Expand Down
Loading

0 comments on commit 55b3d49

Please sign in to comment.