Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Apr 25, 2023
1 parent b928368 commit be5f5c3
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 45 deletions.
18 changes: 9 additions & 9 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ aarch64_linux_gnu_test_task:
setup_script:
- set -ex
- lscpu
- rustup toolchain add nightly --no-self-update --component rust-src && rustup default nightly
- rustup toolchain add nightly --no-self-update && rustup default nightly
- name: test ($TARGET, glibc 2.17)
arm_container:
# glibc 2.17 is the minimum glibc version that aarch64 support is available: https://sourceware.org/legacy-ml/libc-announce/2012/msg00001.html
Expand All @@ -31,7 +31,7 @@ aarch64_linux_gnu_test_task:
- set -ex
- lscpu
- yum install -y gcc git
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly --component rust-src
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly
test_script:
- |
[ ! -f $HOME/.cargo/env ] || . $HOME/.cargo/env
Expand All @@ -52,7 +52,7 @@ aarch64_linux_musl_test_task:
- set -ex
- apk --no-cache add bash git musl-dev util-linux
- lscpu
- rustup toolchain add nightly --no-self-update --component rust-src && rustup default nightly
- rustup toolchain add nightly --no-self-update && rustup default nightly
test_script:
- set -ex
- ./tools/test.sh -vv -- -Z unstable-options --report-time
Expand All @@ -77,7 +77,7 @@ arm_linux_test_task:
setup_script:
- set -ex
- lscpu
- rustup toolchain add nightly --no-self-update --component rust-src && rustup default nightly
- rustup toolchain add nightly --no-self-update && rustup default nightly
- dpkg --add-architecture "$DPKG_ARCH"
- apt-get -o Acquire::Retries=10 -qq update && apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends gcc-"${TARGET/*-unknown/arm}" libc6-dev-"$DPKG_ARCH"-cross libc6:"$DPKG_ARCH"
test_script:
Expand All @@ -95,7 +95,7 @@ aarch64_macos_test_task:
setup_script:
- set -ex
- sysctl hw.optional machdep.cpu
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly --component rust-src
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly
test_script:
- . $HOME/.cargo/env
- set -ex
Expand All @@ -105,16 +105,16 @@ aarch64_macos_test_task:
aarch64_linux_valgrind_task:
name: valgrind ($TARGET)
env:
VALGRIND: valgrind
TARGET: aarch64-unknown-linux-gnu
VALGRIND: valgrind
arm_container:
# Valgrind support ldxp/stxp on 3.19+: https://valgrind.org/docs/manual/dist.news.html
# However, current Debian stable's Valgrind is 3.16: https://packages.debian.org/en/stable/valgrind
image: debian:bookworm
setup_script:
- set -ex
- apt-get -o Acquire::Retries=10 -qq update && apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends ca-certificates curl gcc git libc6-dev valgrind moreutils
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly --component rust-src
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly
test_script:
- . $HOME/.cargo/env
- set -ex
Expand Down Expand Up @@ -174,7 +174,7 @@ aarch64_linux_valgrind_task:
# setup_script:
# - set -ex
# - lscpu
# - rustup toolchain add nightly --no-self-update --component rust-src && rustup default nightly
# - rustup toolchain add nightly --no-self-update && rustup default nightly
# - rustup target add "$TARGET"
# - dpkg --add-architecture "$DPKG_ARCH"
# - apt-get -o Acquire::Retries=10 -qq update && apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends gcc-"${TARGET/*-unknown/arm}" libc6-dev-"$DPKG_ARCH"-cross libc6:"$DPKG_ARCH"
Expand All @@ -193,7 +193,7 @@ aarch64_linux_valgrind_task:
# setup_script:
# - set -ex
# - sysctl hw.optional machdep.cpu
# - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly --component rust-src
# - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly
# bench_script:
# - . $HOME/.cargo/env
# - set -ex
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
- run: sysctl hw.optional machdep.cpu
if: startsWith(matrix.os, 'macos')
- name: Install Rust
run: rustup toolchain add ${{ matrix.rust }} --no-self-update --component rust-src && rustup default ${{ matrix.rust }}
run: rustup toolchain add ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
- run: rustup toolchain add nightly --no-self-update
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
with:
persist-credentials: false
- name: Install Rust
run: rustup toolchain add ${{ matrix.rust }} --no-self-update --component rust-src && rustup default ${{ matrix.rust }}
run: rustup toolchain add ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-no-dev-deps
- run: tools/build.sh
Expand Down Expand Up @@ -362,7 +362,7 @@ jobs:
with:
persist-credentials: false
- name: Install Rust
run: rustup toolchain add nightly --no-self-update --component rust-src && rustup default nightly
run: rustup toolchain add nightly --no-self-update && rustup default nightly
- run: sudo apt-get -o Acquire::Retries=10 -qq update && sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends moreutils
- run: |
echo "ASAN_OPTIONS=detect_stack_use_after_return=1" >>"${GITHUB_ENV}"
Expand Down Expand Up @@ -395,7 +395,7 @@ jobs:
with:
persist-credentials: false
- name: Install Rust
run: rustup toolchain add nightly --no-self-update --component rust-src && rustup default nightly
run: rustup toolchain add nightly --no-self-update && rustup default nightly
- run: sudo apt-get -o Acquire::Retries=10 -qq update && sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends moreutils
- uses: taiki-e/install-action@valgrind
- run: tools/test.sh -vv 2>&1 | ts -i '%.s '
Expand Down
8 changes: 2 additions & 6 deletions bench/benches/imp/spinlock_fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,7 @@ mod tests {
// load/store/swap implementation is not affected by signedness, so it is
// enough to test only unsigned types.
#[cfg(not(valgrind))] // Valgrind is slow.
stress_test_load_store!(u64);
stress_test!(u64);
#[cfg(not(valgrind))] // Valgrind is slow.
stress_test_load_swap!(u64);
#[cfg(not(valgrind))] // Valgrind is slow.
stress_test_load_store!(u128);
#[cfg(not(valgrind))] // Valgrind is slow.
stress_test_load_swap!(u128);
stress_test!(u128);
}
7 changes: 4 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fn main() {
// See https://github.com/taiki-e/atomic-maybe-uninit/blob/HEAD/build.rs for details
let mut is_mclass = false;
match subarch {
"v7" | "v7a" | "v7neon" | "v7s" | "v7k" | "v8a" => {} // aclass
"v7" | "v7a" | "v7neon" | "v7s" | "v7k" | "v8a" | "v9a" => {} // aclass
"v6m" | "v7em" | "v7m" | "v8m" => is_mclass = true,
"v7r" | "v8r" => {} // rclass
// arm-linux-androideabi is v5te
Expand All @@ -241,7 +241,8 @@ fn main() {
let v6 = known
&& (subarch.starts_with("v6")
|| subarch.starts_with("v7")
|| subarch.starts_with("v8"));
|| subarch.starts_with("v8")
|| subarch.starts_with("v9"));
target_feature_if("v6", v6, &version, None, true);
}
"powerpc64" => {
Expand All @@ -263,9 +264,9 @@ fn main() {
has_pwr8_features = cpu == "ppc64le" || cpu == "future";
}
}
// lqarx and stqcx.
// Note: As of rustc 1.69, target_feature "quadword-atomics" is not available on rustc side:
// https://github.com/rust-lang/rust/blob/1.69.0/compiler/rustc_codegen_ssa/src/target_features.rs#L226
// lqarx and stqcx.
target_feature_if("quadword-atomics", has_pwr8_features, &version, None, false);
}
_ => {}
Expand Down
3 changes: 1 addition & 2 deletions src/imp/arm_linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,5 @@ mod tests {

// load/store/swap implementation is not affected by signedness, so it is
// enough to test only unsigned types.
stress_test_load_store!(u64);
stress_test_load_swap!(u64);
stress_test!(u64);
}
3 changes: 1 addition & 2 deletions src/imp/atomic128/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,5 @@ mod tests {

// load/store/swap implementation is not affected by signedness, so it is
// enough to test only unsigned types.
stress_test_load_store!(u128);
stress_test_load_swap!(u128);
stress_test!(u128);
}
3 changes: 1 addition & 2 deletions src/imp/atomic128/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,5 @@ mod tests {

// load/store/swap implementation is not affected by signedness, so it is
// enough to test only unsigned types.
stress_test_load_store!(u128);
stress_test_load_swap!(u128);
stress_test!(u128);
}
3 changes: 1 addition & 2 deletions src/imp/atomic128/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,5 @@ mod tests {

// load/store/swap implementation is not affected by signedness, so it is
// enough to test only unsigned types.
stress_test_load_store!(u128);
stress_test_load_swap!(u128);
stress_test!(u128);
}
3 changes: 1 addition & 2 deletions src/imp/atomic128/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,5 @@ mod tests {

// load/store/swap implementation is not affected by signedness, so it is
// enough to test only unsigned types.
stress_test_load_store!(u128);
stress_test_load_swap!(u128);
stress_test!(u128);
}
3 changes: 1 addition & 2 deletions src/imp/atomic128/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,5 @@ mod tests {

// load/store/swap implementation is not affected by signedness, so it is
// enough to test only unsigned types.
stress_test_load_store!(u128);
stress_test_load_swap!(u128);
stress_test!(u128);
}
10 changes: 2 additions & 8 deletions src/imp/fallback/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,8 @@ mod tests {
// enough to test only unsigned types.
#[cfg(not(valgrind))] // Valgrind is slow.
cfg_no_fast_atomic_64! {
stress_test_load_store!(u64);
stress_test!(u64);
}
#[cfg(not(valgrind))] // Valgrind is slow.
cfg_no_fast_atomic_64! {
stress_test_load_swap!(u64);
}
#[cfg(not(valgrind))] // Valgrind is slow.
stress_test_load_store!(u128);
#[cfg(not(valgrind))] // Valgrind is slow.
stress_test_load_swap!(u128);
stress_test!(u128);
}
6 changes: 4 additions & 2 deletions src/imp/fallback/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use core::ops;
macro_rules! cfg_fast_atomic_64 {
($($tt:tt)*) => {
#[cfg(any(
not(any(target_pointer_width = "16", target_pointer_width = "32")),
not(any(target_pointer_width = "16", target_pointer_width = "32")), // i.e., 64-bit or greater
target_arch = "aarch64",
target_arch = "bpf",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "nvptx64",
target_arch = "powerpc64",
Expand All @@ -28,9 +29,10 @@ macro_rules! cfg_fast_atomic_64 {
macro_rules! cfg_no_fast_atomic_64 {
($($tt:tt)*) => {
#[cfg(not(any(
not(any(target_pointer_width = "16", target_pointer_width = "32")),
not(any(target_pointer_width = "16", target_pointer_width = "32")), // i.e., 64-bit or greater
target_arch = "aarch64",
target_arch = "bpf",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "nvptx64",
target_arch = "powerpc64",
Expand Down
3 changes: 2 additions & 1 deletion src/tests/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2305,8 +2305,9 @@ macro_rules! stress_test_load_store {
}
};
}
macro_rules! stress_test_load_swap {
macro_rules! stress_test {
($int_type:ident) => {
stress_test_load_store!($int_type);
// debug mode is slow.
#[cfg(any(not(debug_assertions), miri))]
paste::paste! {
Expand Down

0 comments on commit be5f5c3

Please sign in to comment.