Skip to content

Commit a371efc

Browse files
committed
Cleanup
- Allow testing no outline-atomics and no parking_lot cases with --all-features - Use 128-bit atomic operation mappings same as LLVM on aarch64
1 parent 0e9b3e1 commit a371efc

File tree

15 files changed

+540
-535
lines changed

15 files changed

+540
-535
lines changed

.cirrus.yml

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ env:
22
CARGO_INCREMENTAL: '0'
33
CARGO_NET_RETRY: '10'
44
CARGO_TERM_COLOR: always
5-
RUST_BACKTRACE: '1'
5+
RUST_BACKTRACE: full
66
RUST_TEST_THREADS: '1'
77
RUSTDOCFLAGS: -D warnings
88
RUSTFLAGS: -D warnings
@@ -17,24 +17,21 @@ test_task:
1717
- rustup toolchain add nightly --component rust-src && rustup default nightly
1818
test_script:
1919
# all features
20-
- cargo test -vv --workspace --all-features -- -Z unstable-options --report-time
21-
- cargo test -vv --workspace --all-features --release -- -Z unstable-options --report-time
20+
- cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -- -Z unstable-options --report-time
21+
- cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -- -Z unstable-options --report-time
2222
# Use -Z build-std because the prebuilt libtest seems to be incompatible with LTO, causing miscompilation: https://gist.github.com/taiki-e/9713f8e02e8f9f852ccee8d6f089ec24
23-
- CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time
24-
# no outline-atomics, no parking_lot
25-
- cargo test -vv --workspace --features float,std,serde -- -Z unstable-options --report-time
26-
- cargo test -vv --workspace --features float,std,serde --release -- -Z unstable-options --report-time
27-
# Use -Z build-std because the prebuilt libtest seems to be incompatible with LTO, causing miscompilation: https://gist.github.com/taiki-e/9713f8e02e8f9f852ccee8d6f089ec24
28-
- CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --features float,std,serde --release --tests --target $TARGET -- -Z unstable-options --report-time
23+
- CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time
2924
# +lse
30-
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --all-features -- -Z unstable-options --report-time
31-
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --all-features --release -- -Z unstable-options --report-time
25+
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -- -Z unstable-options --report-time
26+
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -- -Z unstable-options --report-time
3227
# Use -Z build-std because the prebuilt libtest seems to be incompatible with LTO, causing miscompilation: https://gist.github.com/taiki-e/9713f8e02e8f9f852ccee8d6f089ec24
33-
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time
28+
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time
3429

3530
valgrind_task:
3631
env:
3732
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER: valgrind -v --error-exitcode=1 --error-limit=no --leak-check=full --show-leak-kinds=all --track-origins=yes
33+
RUSTDOCFLAGS: -D warnings --cfg valgrind
34+
RUSTFLAGS: -D warnings --cfg valgrind
3835
TARGET: aarch64-unknown-linux-gnu
3936
arm_container:
4037
image: rust:latest
@@ -56,17 +53,12 @@ valgrind_task:
5653
rm -rf valgrind
5754
test_script:
5855
# all features
59-
- cargo test -vv --workspace --all-features -Z doctest-xcompile -- -Z unstable-options --report-time
60-
- cargo test -vv --workspace --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
61-
# Use -Z build-std because the prebuilt libtest seems to be incompatible with LTO, causing miscompilation: https://gist.github.com/taiki-e/9713f8e02e8f9f852ccee8d6f089ec24
62-
- CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time
63-
# no outline-atomics, no parking_lot
64-
- cargo test -vv --workspace --features float,std,serde -- -Z unstable-options --report-time
65-
- cargo test -vv --workspace --features float,std,serde --release -- -Z unstable-options --report-time
56+
- cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -Z doctest-xcompile -- -Z unstable-options --report-time
57+
- cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
6658
# Use -Z build-std because the prebuilt libtest seems to be incompatible with LTO, causing miscompilation: https://gist.github.com/taiki-e/9713f8e02e8f9f852ccee8d6f089ec24
67-
- CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --features float,std,serde --release --tests --target $TARGET -- -Z unstable-options --report-time
68-
# +cmpxchg16b
69-
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --all-features -Z doctest-xcompile -- -Z unstable-options --report-time
70-
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
59+
- CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time
60+
# +lse
61+
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -Z doctest-xcompile -- -Z unstable-options --report-time
62+
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
7163
# Use -Z build-std because the prebuilt libtest seems to be incompatible with LTO, causing miscompilation: https://gist.github.com/taiki-e/9713f8e02e8f9f852ccee8d6f089ec24
72-
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time
64+
- RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_LTO=fat cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --release --tests --target $TARGET -- -Z unstable-options --report-time

.github/workflows/ci.yml

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,6 @@ jobs:
110110
env:
111111
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
112112
CARGO_PROFILE_RELEASE_LTO: fat
113-
# no outline-atomics, no parking_lot
114-
- run: cargo test -vv --features float,std,serde $DOCTEST_XCOMPILE -- $REPORT_TIME
115-
- run: cargo test -vv --features float,std,serde --release $DOCTEST_XCOMPILE -- $REPORT_TIME
116-
- run: cargo test -vv --features float,std,serde --release $DOCTEST_XCOMPILE -- $REPORT_TIME
117-
env:
118-
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
119-
CARGO_PROFILE_RELEASE_LTO: fat
120113
# +cmpxchg16b
121114
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -- $REPORT_TIME
122115
env:
@@ -252,21 +245,13 @@ jobs:
252245
cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
253246
- run: |
254247
cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
248+
if: matrix.sanitizer != 'memory' # https://github.com/google/sanitizers/issues/558
255249
- run: |
256250
cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
257251
env:
258252
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
259253
CARGO_PROFILE_RELEASE_LTO: fat
260-
# no outline-atomics, no parking_lot
261-
- run: |
262-
cargo -Z build-std test -vv --features float,std,serde --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
263-
- run: |
264-
cargo -Z build-std test -vv --features float,std,serde --release --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
265-
- run: |
266-
cargo -Z build-std test -vv --features float,std,serde --release --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
267-
env:
268-
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
269-
CARGO_PROFILE_RELEASE_LTO: fat
254+
if: matrix.sanitizer != 'memory' # https://github.com/google/sanitizers/issues/558
270255
# +cmpxchg16b
271256
- run: |
272257
cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
@@ -278,13 +263,15 @@ jobs:
278263
env:
279264
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
280265
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
266+
if: matrix.sanitizer != 'memory' # https://github.com/google/sanitizers/issues/558
281267
- run: |
282268
cargo -Z build-std test -vv --workspace --exclude asm-test --exclude bench --all-features --release --target "$(rustc -Vv | grep host | sed 's/host: //')" -- -Z unstable-options --report-time
283269
env:
284270
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
285271
CARGO_PROFILE_RELEASE_LTO: fat
286272
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
287273
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
274+
if: matrix.sanitizer != 'memory' # https://github.com/google/sanitizers/issues/558
288275
289276
valgrind:
290277
env:
@@ -300,33 +287,34 @@ jobs:
300287
- uses: taiki-e/install-action@valgrind
301288
# all features
302289
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -Z doctest-xcompile -- -Z unstable-options --report-time
303-
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
290+
env:
291+
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg valgrind
292+
RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg valgrind
304293
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
305294
env:
306-
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
307-
CARGO_PROFILE_RELEASE_LTO: fat
308-
# no outline-atomics, no parking_lot
309-
- run: cargo test -vv --features float,std,serde -Z doctest-xcompile -- -Z unstable-options --report-time
310-
- run: cargo test -vv --features float,std,serde --release -Z doctest-xcompile -- -Z unstable-options --report-time
311-
- run: cargo test -vv --features float,std,serde --release -Z doctest-xcompile -- -Z unstable-options --report-time
295+
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg valgrind
296+
RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg valgrind
297+
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
312298
env:
313299
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
314300
CARGO_PROFILE_RELEASE_LTO: fat
301+
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg valgrind
302+
RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg valgrind
315303
# +cmpxchg16b
316304
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features -Z doctest-xcompile -- -Z unstable-options --report-time
317305
env:
318-
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
319-
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
306+
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
307+
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
320308
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
321309
env:
322-
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
323-
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
310+
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
311+
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
324312
- run: cargo test -vv --workspace --exclude asm-test --exclude bench --all-features --release -Z doctest-xcompile -- -Z unstable-options --report-time
325313
env:
326314
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
327315
CARGO_PROFILE_RELEASE_LTO: fat
328-
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b
329-
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b
316+
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
317+
RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg valgrind
330318

331319
codegen:
332320
runs-on: ubuntu-latest
@@ -392,15 +380,11 @@ jobs:
392380
env:
393381
RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg docsrs
394382

395-
# This job doesn't actually test anything, but they're used to tell bors the
396-
# build completed, as there is no practical way to detect when a workflow is
397-
# successful listening to webhooks only.
398-
#
399383
# ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
400384

401385
ci-success:
402386
name: ci
403-
if: github.event_name == 'push' && success()
387+
if: success()
404388
needs:
405389
- test
406390
- build

bench/benches/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(rust_2018_idioms, single_use_lifetimes, unsafe_op_in_unsafe_fn)]
2-
#![allow(dead_code)]
2+
#![allow(dead_code, unused_extern_crates)]
33
#![allow(clippy::only_used_in_recursion)]
44
#![feature(cmpxchg16b_target_feature, stdsimd, core_intrinsics)]
55

build.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ fn main() {
155155
println!("cargo:rustc-cfg=portable_atomic_nightly");
156156

157157
// `cfg(sanitize = "..")` is not stabilized.
158-
let tsan = std::env::var("CARGO_CFG_SANITIZE").unwrap_or_default().contains("thread");
159-
if tsan {
158+
let sanitize = std::env::var("CARGO_CFG_SANITIZE").unwrap_or_default();
159+
if sanitize.contains("thread") {
160160
println!("cargo:rustc-cfg=sanitize_thread");
161161
}
162162

@@ -255,7 +255,8 @@ fn probe(code: &str, target: &str) -> Option<bool> {
255255
.arg("--crate-type=lib")
256256
.arg("--out-dir")
257257
.arg(out_dir)
258-
.arg("--emit=llvm-ir");
258+
.arg("--emit=llvm-ir")
259+
.arg("--cap-lints=warn");
259260

260261
cmd.arg("--target").arg(target);
261262

0 commit comments

Comments
 (0)