From cc60da18e030e563785838ca966f8c0a20d2e77a Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 27 Jul 2023 03:39:37 +0900 Subject: [PATCH] wip --- .cirrus.yml | 174 ---------- .github/workflows/ci.yml | 694 ++++++++++++++++++++------------------- Cargo.toml | 3 +- Cross.toml | 22 -- src/imp/core_atomic.rs | 2 + tools/test.sh | 53 ++- 6 files changed, 390 insertions(+), 558 deletions(-) delete mode 100644 .cirrus.yml delete mode 100644 Cross.toml diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index ae406f44..00000000 --- a/.cirrus.yml +++ /dev/null @@ -1,174 +0,0 @@ -only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'main' || $CIRRUS_BRANCH == 'dev') -auto_cancellation: $CIRRUS_PR != '' -env: - CARGO_INCREMENTAL: '0' - CARGO_NET_RETRY: '10' - CARGO_TERM_COLOR: always - RUST_BACKTRACE: '1' - RUST_TEST_THREADS: '1' - RUSTDOCFLAGS: -D warnings - RUSTFLAGS: -D warnings - RUSTUP_MAX_RETRIES: '10' - -aarch64_linux_dynamic_linking_test_task: - matrix: - - name: test ($TARGET) - env: - TARGET: aarch64-unknown-linux-gnu - arm_container: - image: rust:latest - setup_script: - - set -ex - - lscpu - - rustup toolchain add nightly --no-self-update && rustup default nightly - - apt-get -o Acquire::Retries=10 -qq update && apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends moreutils - - name: test ($TARGET, glibc 2.17) - env: - TARGET: aarch64-unknown-linux-gnu - 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 - image: centos:7 - setup_script: - - set -ex - - lscpu - - yum install -y gcc moreutils - - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain nightly - - name: test ($TARGET, -C target-feature=-crt-static) - env: - TARGET: aarch64-unknown-linux-musl - RUSTDOCFLAGS: -D warnings -C target-feature=-crt-static - RUSTFLAGS: -D warnings -C target-feature=-crt-static - arm_container: - image: rust:alpine - setup_script: - - set -ex - - apk --no-cache add bash musl-dev util-linux moreutils - - lscpu - - rustup toolchain add nightly --no-self-update && rustup default nightly - test_script: - - | - [ ! -f $HOME/.cargo/env ] || . $HOME/.cargo/env - - set -ex - - ./tools/test.sh -vv - # We test doctest only once with the default build conditions because doctest is slow. Both api-test - # and src/tests have extended copies of doctest, so this will not reduce test coverage. - # outline-atomics is enabled by default on linux-gnu and linux-musl with dynamic linking. - - RUSTFLAGS="$RUSTFLAGS --cfg portable_atomic_no_outline_atomics" RUSTDOCFLAGS="$RUSTDOCFLAGS --cfg portable_atomic_no_outline_atomics" ./tools/test.sh -vv --tests - # +lse - # Neoverse N1 is ARMv8.2-a and doesn't support FEAT_LSE2. - # FEAT_LSE2 is tested on aarch64 macOS VM. - - RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" ./tools/test.sh -vv --tests - -aarch64_linux_static_linking_test_task: - name: test ($TARGET) - env: - TARGET: aarch64-unknown-linux-musl - arm_container: - image: rust:alpine - setup_script: - - set -ex - - apk --no-cache add bash musl-dev util-linux moreutils - - lscpu - - rustup toolchain add nightly --no-self-update && rustup default nightly - test_script: - - set -ex - - ./tools/test.sh -vv - # We test doctest only once with the default build conditions because doctest is slow. Both api-test - # and src/tests have extended copies of doctest, so this will not reduce test coverage. - # outline-atomics is disabled by default on linux-musl with static linking. - - RUSTFLAGS="$RUSTFLAGS --cfg portable_atomic_outline_atomics" RUSTDOCFLAGS="$RUSTDOCFLAGS --cfg portable_atomic_outline_atomics" ./tools/test.sh -vv --tests - # +lse - # Neoverse N1 is ARMv8.2-a and doesn't support FEAT_LSE2. - # FEAT_LSE2 is tested on aarch64 macOS VM. - - RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" ./tools/test.sh -vv --tests - -aarch64_macos_test_task: - name: test ($TARGET) - env: - TARGET: aarch64-apple-darwin - macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-xcode:latest - setup_script: - - set -ex - - sysctl hw.optional machdep.cpu - - brew install moreutils - - 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 - # macOS is +lse,+lse2 by default - # Cirrus CI's aarch64 macOS VM is fast enough, so run ignored tests too. - - ./tools/test.sh -vv -- --include-ignored - -aarch64_linux_valgrind_task: - name: valgrind ($TARGET) - env: - TARGET: aarch64-unknown-linux-gnu - 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: rust:bookworm - setup_script: - - set -ex - - rustup toolchain add nightly --no-self-update && rustup default nightly - - apt-get -o Acquire::Retries=10 -qq update && apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends moreutils valgrind - test_script: - - set -ex - - ./tools/test.sh valgrind -vv - # outline-atomics is enabled by default on linux-gnu and linux-musl with dynamic linking. - - RUSTFLAGS="$RUSTFLAGS --cfg portable_atomic_no_outline_atomics" RUSTDOCFLAGS="$RUSTDOCFLAGS --cfg portable_atomic_no_outline_atomics" ./tools/test.sh valgrind -vv --tests - # We test doctest only once with the default build conditions because doctest is slow. Both api-test - # and src/tests have extended copies of doctest, so this will not reduce test coverage. - # +lse - # As of Valgrind 3.19, Valgrind supports atomic instructions of ARMv8.0 and ARMv8.1 (FEAT_LSE). - - RUSTFLAGS="$RUSTFLAGS -C target-feature=+lse" RUSTDOCFLAGS="$RUSTDOCFLAGS -C target-feature=+lse" ./tools/test.sh valgrind -vv --tests -# -# aarch64_linux_bench_task: -# name: bench ($TARGET) -# env: -# TARGET: aarch64-unknown-linux-gnu -# arm_container: -# image: rust:latest -# cpu: 4 -# memory: 12G -# setup_script: -# - set -ex -# - lscpu -# - rustup toolchain add nightly --no-self-update && rustup default nightly -# bench_script: -# - set -ex -# - cargo bench -vv --manifest-path bench/Cargo.toml -# - RUSTFLAGS="${RUSTFLAGS} -C target-feature=-outline-atomics --cfg portable_atomic_no_outline_atomics" cargo bench -vv --manifest-path bench/Cargo.toml -# - RUSTFLAGS="${RUSTFLAGS} -C target-feature=+lse" cargo bench -vv --manifest-path bench/Cargo.toml - -# x86_64_linux_bench_task: -# name: bench ($TARGET) -# env: -# TARGET: x86_64-unknown-linux-gnu -# container: -# image: rust:latest -# cpu: 4 -# memory: 12G -# setup_script: -# - set -ex -# - lscpu -# - rustup toolchain add nightly --no-self-update && rustup default nightly -# bench_script: -# - set -ex -# - cargo bench -vv --manifest-path bench/Cargo.toml -# - RUSTFLAGS="${RUSTFLAGS} -C target-feature=+cmpxchg16b" cargo bench -vv --manifest-path bench/Cargo.toml - -# aarch64_macos_bench_task: -# name: bench ($TARGET) -# env: -# TARGET: aarch64-apple-darwin -# macos_instance: -# image: ghcr.io/cirruslabs/macos-ventura-xcode:latest -# 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 -# bench_script: -# - . $HOME/.cargo/env -# - set -ex -# - cargo bench -vv --manifest-path bench/Cargo.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e90e5386..76e0cc48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,157 +37,163 @@ concurrency: cancel-in-progress: true jobs: - check-external-types: - uses: taiki-e/workflows/.github/workflows/check-external-types.yml@main - deny: - uses: taiki-e/workflows/.github/workflows/deny.yml@main - docs: - uses: taiki-e/workflows/.github/workflows/docs.yml@main - with: - target: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,powerpc64le-unknown-linux-gnu,s390x-unknown-linux-gnu,armv5te-unknown-linux-gnueabi - msrv: - needs: tidy - uses: taiki-e/workflows/.github/workflows/msrv.yml@main - with: - event_name: ${{ github.event_name }} - # Exclude serde and critical-section features because the MSRV when it is enabled depends on the MSRV of them - args: -vvv --clean-per-version --feature-powerset --depth 2 --optional-deps --exclude-features serde,critical-section,unsafe-assume-single-core,s-mode,disable-fiq - tidy: - uses: taiki-e/workflows/.github/workflows/tidy.yml@main - with: - # clippy is covered by TESTS=1 ./tools/build.sh - clippy: false + # check-external-types: + # uses: taiki-e/workflows/.github/workflows/check-external-types.yml@main + # deny: + # uses: taiki-e/workflows/.github/workflows/deny.yml@main + # docs: + # uses: taiki-e/workflows/.github/workflows/docs.yml@main + # with: + # target: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,powerpc64le-unknown-linux-gnu,s390x-unknown-linux-gnu,armv5te-unknown-linux-gnueabi + # msrv: + # needs: tidy + # uses: taiki-e/workflows/.github/workflows/msrv.yml@main + # with: + # event_name: ${{ github.event_name }} + # # Exclude serde and critical-section features because the MSRV when it is enabled depends on the MSRV of them + # args: -vvv --clean-per-version --feature-powerset --depth 2 --optional-deps --exclude-features serde,critical-section,unsafe-assume-single-core,s-mode,disable-fiq + # tidy: + # uses: taiki-e/workflows/.github/workflows/tidy.yml@main + # with: + # # clippy is covered by TESTS=1 ./tools/build.sh + # clippy: false test: - needs: tidy - env: - cargo: cargo + # needs: tidy strategy: fail-fast: false matrix: include: - - rust: '1.56' - - rust: '1.59' # LLVM 13 - - rust: '1.64' # LLVM 14 - - rust: '1.69' # LLVM 15 - - rust: stable # LLVM 16 (as of 1.70) - - rust: beta - - rust: nightly - - rust: nightly - os: macos-latest - - rust: nightly - os: windows-latest - - rust: nightly-x86_64-pc-windows-gnu - os: windows-latest - - rust: nightly-i686-pc-windows-msvc - os: windows-latest - - rust: nightly-i686-pc-windows-gnu - os: windows-latest - - rust: nightly - flags: -C panic=abort -Z panic_abort_tests - - rust: '1.59' # LLVM 13 - target: aarch64-unknown-linux-gnu - - rust: '1.64' # LLVM 14 - target: aarch64-unknown-linux-gnu - - rust: '1.69' # LLVM 15 - target: aarch64-unknown-linux-gnu - - rust: stable - target: aarch64-unknown-linux-gnu - - rust: beta - target: aarch64-unknown-linux-gnu - - rust: nightly - target: aarch64-unknown-linux-gnu - # TODO: compiler-builtins bug https://github.com/rust-lang/compiler-builtins/pull/539 - - rust: nightly-2023-05-12 - target: aarch64_be-unknown-linux-gnu - - rust: stable - target: aarch64-unknown-linux-musl - - rust: stable - target: aarch64-unknown-linux-musl - flags: -C target-feature=-crt-static - - rust: nightly - target: aarch64-unknown-linux-musl - - rust: nightly - target: aarch64-unknown-linux-musl - flags: -C target-feature=-crt-static - - rust: stable - target: aarch64-linux-android - - rust: nightly - target: aarch64-linux-android - - rust: stable - target: armv5te-unknown-linux-gnueabi - - rust: nightly - target: armv5te-unknown-linux-gnueabi - - rust: nightly - target: arm-unknown-linux-gnueabi - - rust: nightly - target: armv7-unknown-linux-gnueabi - - rust: nightly - target: armv7-unknown-linux-gnueabihf + # - rust: '1.56' + # - rust: '1.59' # LLVM 13 + # - rust: '1.64' # LLVM 14 + # - rust: '1.69' # LLVM 15 + # - rust: stable # LLVM 16 (as of 1.70) + # - rust: beta + # - rust: nightly + # - rust: nightly + # os: macos-latest + # - rust: nightly + # os: windows-latest + # - rust: nightly-x86_64-pc-windows-gnu + # os: windows-latest + # - rust: nightly-i686-pc-windows-msvc + # os: windows-latest + # - rust: nightly-i686-pc-windows-gnu + # os: windows-latest + # - rust: nightly + # flags: -C panic=abort -Z panic_abort_tests + # - rust: '1.59' # LLVM 13 + # target: aarch64-unknown-linux-gnu + # - rust: '1.64' # LLVM 14 + # target: aarch64-unknown-linux-gnu + # - rust: '1.69' # LLVM 15 + # target: aarch64-unknown-linux-gnu + # - rust: stable + # target: aarch64-unknown-linux-gnu + # - rust: beta + # target: aarch64-unknown-linux-gnu + # - rust: nightly + # target: aarch64-unknown-linux-gnu + # # TODO: compiler-builtins bug https://github.com/rust-lang/compiler-builtins/pull/539 + # - rust: nightly-2023-05-12 + # target: aarch64_be-unknown-linux-gnu + # - rust: stable + # target: aarch64-unknown-linux-musl + # - rust: stable + # target: aarch64-unknown-linux-musl + # flags: -C target-feature=-crt-static + # - rust: nightly + # target: aarch64-unknown-linux-musl + # - rust: nightly + # target: aarch64-unknown-linux-musl + # flags: -C target-feature=-crt-static + # - rust: stable + # target: aarch64-linux-android + # - rust: nightly + # target: aarch64-linux-android + # - rust: stable + # target: armv5te-unknown-linux-gnueabi + # - rust: nightly + # target: armv5te-unknown-linux-gnueabi + # - rust: nightly + # target: arm-unknown-linux-gnueabi + # - rust: nightly + # target: armv7-unknown-linux-gnueabi + # - rust: nightly + # target: armv7-unknown-linux-gnueabihf - rust: nightly target: armeb-unknown-linux-gnueabi - - rust: nightly - target: arm-linux-androideabi - - rust: nightly - target: i586-unknown-linux-gnu - - rust: nightly - target: i686-unknown-linux-gnu - - rust: nightly - target: loongarch64-unknown-linux-gnu - - rust: nightly - target: mips-unknown-linux-gnu - - rust: nightly - target: mipsel-unknown-linux-gnu - - rust: nightly - target: mips64-unknown-linux-gnuabi64 - - rust: nightly - target: mips64el-unknown-linux-gnuabi64 - - rust: nightly - target: powerpc-unknown-linux-gnu - - rust: nightly - target: powerpc64-unknown-linux-gnu - # - rust: nightly-2023-03-26 # Rust 1.70, LLVM 16 + # - rust: nightly + # target: arm-linux-androideabi + # - rust: nightly + # target: i586-unknown-linux-gnu + # - rust: nightly + # target: i686-unknown-linux-gnu + # - rust: nightly + # target: loongarch64-unknown-linux-gnu + # - rust: nightly + # target: mips-unknown-linux-gnu + # - rust: nightly + # target: mipsel-unknown-linux-gnu + # - rust: nightly + # target: mips64-unknown-linux-gnuabi64 + # - rust: nightly + # target: mips64el-unknown-linux-gnuabi64 + - rust: nightly-2023-07-18 # TODO: https://github.com/rust-lang/rust/pull/112374 broke build-std due to https://github.com/rust-lang/libc/pull/3268 is not released yet + target: mipsisa32r6-unknown-linux-gnu + - rust: nightly-2023-07-18 # TODO: https://github.com/rust-lang/rust/pull/112374 broke build-std due to https://github.com/rust-lang/libc/pull/3268 is not released yet + target: mipsisa32r6el-unknown-linux-gnu + - rust: nightly-2023-07-18 # TODO: https://github.com/rust-lang/rust/pull/112374 broke build-std due to https://github.com/rust-lang/libc/pull/3268 is not released yet + target: mipsisa64r6-unknown-linux-gnuabi64 + - rust: nightly-2023-07-18 # TODO: https://github.com/rust-lang/rust/pull/112374 broke build-std due to https://github.com/rust-lang/libc/pull/3268 is not released yet + target: mipsisa64r6el-unknown-linux-gnuabi64 + # - rust: nightly + # target: powerpc-unknown-linux-gnu + # - rust: nightly # target: powerpc64-unknown-linux-gnu - - rust: nightly-2023-03-25 # Rust 1.70, LLVM 15 - target: powerpc64-unknown-linux-gnu - # - rust: nightly-2022-08-13 # Rust 1.65, LLVM 15 + # # - rust: nightly-2023-03-26 # Rust 1.70, LLVM 16 + # # target: powerpc64-unknown-linux-gnu + # - rust: nightly-2023-03-25 # Rust 1.70, LLVM 15 # target: powerpc64-unknown-linux-gnu - - rust: nightly-2022-08-12 # Rust 1.65, LLVM 14 - target: powerpc64-unknown-linux-gnu - # - rust: nightly-2022-02-18 # Rust 1.60, LLVM 14 + # # - rust: nightly-2022-08-13 # Rust 1.65, LLVM 15 + # # target: powerpc64-unknown-linux-gnu + # - rust: nightly-2022-08-12 # Rust 1.65, LLVM 14 # target: powerpc64-unknown-linux-gnu - # - rust: nightly-2022-02-17 # Rust 1.60, LLVM 13 + # # - rust: nightly-2022-02-18 # Rust 1.60, LLVM 14 + # # target: powerpc64-unknown-linux-gnu + # # - rust: nightly-2022-02-17 # Rust 1.60, LLVM 13 + # # target: powerpc64-unknown-linux-gnu + # - rust: nightly-2022-02-13 # Rust 1.60, LLVM 13 (oldest version we can use asm_experimental_arch on this target) # target: powerpc64-unknown-linux-gnu - - rust: nightly-2022-02-13 # Rust 1.60, LLVM 13 (oldest version we can use asm_experimental_arch on this target) - target: powerpc64-unknown-linux-gnu - - rust: nightly - target: powerpc64le-unknown-linux-gnu - # - rust: nightly-2023-03-26 # Rust 1.70, LLVM 16 + # - rust: nightly # target: powerpc64le-unknown-linux-gnu - - rust: nightly-2023-03-25 # Rust 1.70, LLVM 15 - target: powerpc64le-unknown-linux-gnu - # - rust: nightly-2022-08-13 # Rust 1.65, LLVM 15 + # # - rust: nightly-2023-03-26 # Rust 1.70, LLVM 16 + # # target: powerpc64le-unknown-linux-gnu + # - rust: nightly-2023-03-25 # Rust 1.70, LLVM 15 # target: powerpc64le-unknown-linux-gnu - - rust: nightly-2022-08-12 # Rust 1.65, LLVM 14 - target: powerpc64le-unknown-linux-gnu - # - rust: nightly-2022-02-18 # Rust 1.60, LLVM 14 + # # - rust: nightly-2022-08-13 # Rust 1.65, LLVM 15 + # # target: powerpc64le-unknown-linux-gnu + # - rust: nightly-2022-08-12 # Rust 1.65, LLVM 14 # target: powerpc64le-unknown-linux-gnu - # - rust: nightly-2022-02-17 # Rust 1.60, LLVM 13 + # # - rust: nightly-2022-02-18 # Rust 1.60, LLVM 14 + # # target: powerpc64le-unknown-linux-gnu + # # - rust: nightly-2022-02-17 # Rust 1.60, LLVM 13 + # # target: powerpc64le-unknown-linux-gnu + # - rust: nightly-2022-02-13 # Rust 1.60, LLVM 13 (oldest version we can use asm_experimental_arch on this target) # target: powerpc64le-unknown-linux-gnu - - rust: nightly-2022-02-13 # Rust 1.60, LLVM 13 (oldest version we can use asm_experimental_arch on this target) - target: powerpc64le-unknown-linux-gnu - - rust: nightly - target: riscv32gc-unknown-linux-gnu - - rust: nightly - target: riscv64gc-unknown-linux-gnu - - rust: nightly - target: s390x-unknown-linux-gnu - - rust: nightly-2023-05-09 # Rust 1.71, LLVM 16 (oldest version we can use asm_experimental_arch on this target) - target: s390x-unknown-linux-gnu - - rust: nightly - target: sparc64-unknown-linux-gnu - - rust: nightly - target: thumbv7neon-unknown-linux-gnueabihf + # - rust: nightly + # target: riscv32gc-unknown-linux-gnu + # - rust: nightly + # target: riscv64gc-unknown-linux-gnu + # - rust: nightly + # target: s390x-unknown-linux-gnu + # - rust: nightly-2023-05-09 # Rust 1.71, LLVM 16 (oldest version we can use asm_experimental_arch on this target) + # target: s390x-unknown-linux-gnu + # - rust: nightly + # target: sparc64-unknown-linux-gnu + # - rust: nightly + # target: thumbv7neon-unknown-linux-gnueabihf runs-on: ${{ matrix.os || 'ubuntu-latest' }} timeout-minutes: 90 steps: @@ -214,14 +220,10 @@ jobs: with: tool: cargo-careful if: startsWith(matrix.rust, 'nightly') - - uses: taiki-e/setup-cross-toolchain-action@v1 + - uses: taiki-e/setup-cross-toolchain-action@v1 #more # TODO: back to @v1 with: target: ${{ matrix.target }} - if: matrix.target != '' && !contains(matrix.target, '-android') - - uses: taiki-e/install-action@cross - if: contains(matrix.target, '-android') - - run: echo "cargo=cross" >>"${GITHUB_ENV}" - if: contains(matrix.target, '-android') + if: matrix.target != '' - run: echo "RUSTFLAGS=${RUSTFLAGS} --cfg qemu" >>"${GITHUB_ENV}" if: matrix.target != '' && !startsWith(matrix.target, 'i686') && !startsWith(matrix.target, 'x86_64') - run: | @@ -316,214 +318,214 @@ jobs: - run: cargo minimal-versions build -vvv --release --workspace --features $TEST_FEATURES --ignore-unknown-features --ignore-private $TARGET $BUILD_STD if: matrix.target == 'mips-unknown-linux-gnu' || matrix.target == 'mipsel-unknown-linux-gnu' - build: - needs: tidy - name: build (${{ matrix.name || matrix.rust }}) - strategy: - fail-fast: false - matrix: - include: - - rust: '1.34' - - rust: '1.59' - - rust: stable - - rust: beta - - rust: nightly - # The oldest nightly that can compile this crate is nightly-2019-01-27 - # which Atomic{I,U}{8,16,32,64} stabilized. - # https://github.com/rust-lang/rust/pull/57425 - # Note: Old nightly compilers are essentially fragile, so support for - # them is on a best-effort basis. - - rust: nightly-2019-01-27 - # https://github.com/taiki-e/portable-atomic/pull/52 - - rust: nightly-2020-06-21 - # for AVR: https://github.com/rust-lang/compiler-builtins/issues/400 - - rust: nightly-2020-12-26 - # Check that test suite can be built - - name: nightly, --tests - rust: nightly - tests: 1 - # Check that this crate can be built for all builtin targets - - name: stable, all tier1/tier2 - rust: stable - target-group: tier1/tier2 - - name: nightly, all tier1/tier2 - rust: nightly - target-group: tier1/tier2 - - name: nightly, all tier3 - rust: nightly - target-group: tier3 - runs-on: ubuntu-latest - timeout-minutes: 120 # TODO - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Install 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 - env: - TESTS: ${{ matrix.tests }} - TARGET_GROUP: ${{ matrix.target-group }} + # build: + # needs: tidy + # name: build (${{ matrix.name || matrix.rust }}) + # strategy: + # fail-fast: false + # matrix: + # include: + # - rust: '1.34' + # - rust: '1.59' + # - rust: stable + # - rust: beta + # - rust: nightly + # # The oldest nightly that can compile this crate is nightly-2019-01-27 + # # which Atomic{I,U}{8,16,32,64} stabilized. + # # https://github.com/rust-lang/rust/pull/57425 + # # Note: Old nightly compilers are essentially fragile, so support for + # # them is on a best-effort basis. + # - rust: nightly-2019-01-27 + # # https://github.com/taiki-e/portable-atomic/pull/52 + # - rust: nightly-2020-06-21 + # # for AVR: https://github.com/rust-lang/compiler-builtins/issues/400 + # - rust: nightly-2020-12-26 + # # Check that test suite can be built + # - name: nightly, --tests + # rust: nightly + # tests: 1 + # # Check that this crate can be built for all builtin targets + # - name: stable, all tier1/tier2 + # rust: stable + # target-group: tier1/tier2 + # - name: nightly, all tier1/tier2 + # rust: nightly + # target-group: tier1/tier2 + # - name: nightly, all tier3 + # rust: nightly + # target-group: tier3 + # runs-on: ubuntu-latest + # timeout-minutes: 120 # TODO + # steps: + # - uses: actions/checkout@v3 + # with: + # persist-credentials: false + # - name: Install 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 + # env: + # TESTS: ${{ matrix.tests }} + # TARGET_GROUP: ${{ matrix.target-group }} - no-std: - needs: tidy - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Install Rust - run: rustup toolchain add nightly --no-self-update && rustup default nightly - - uses: taiki-e/install-action@cargo-hack - - uses: taiki-e/install-action@v2 - with: - tool: espup - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: | - set -euxo pipefail - 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 \ - avr-libc \ - gcc-avr \ - qemu-system-arm \ - qemu-system-misc \ - simavr - # APT's qemu package doesn't provide firmware for riscv32: https://packages.ubuntu.com/en/jammy/all/qemu-system-data/filelist - OPENSBI_VERSION=1.2 - curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "https://github.com/riscv-software-src/opensbi/releases/download/v${OPENSBI_VERSION}/opensbi-${OPENSBI_VERSION}-rv-bin.tar.xz" \ - | tar xJf - - sudo mv "opensbi-${OPENSBI_VERSION}-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin" /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin - sudo mv "opensbi-${OPENSBI_VERSION}-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.elf" /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf - rm -rf "opensbi-${OPENSBI_VERSION}-rv-bin" - - run: espup install - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: tools/no-std.sh - - run: tools/build.sh +esp xtensa-esp32-none-elf - - run: tools/no-std.sh +esp xtensa-esp32-none-elf + # no-std: + # needs: tidy + # runs-on: ubuntu-latest + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v3 + # with: + # persist-credentials: false + # - name: Install Rust + # run: rustup toolchain add nightly --no-self-update && rustup default nightly + # - uses: taiki-e/install-action@cargo-hack + # - uses: taiki-e/install-action@v2 + # with: + # tool: espup + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - run: | + # set -euxo pipefail + # 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 \ + # avr-libc \ + # gcc-avr \ + # qemu-system-arm \ + # qemu-system-misc \ + # simavr + # # APT's qemu package doesn't provide firmware for riscv32: https://packages.ubuntu.com/en/jammy/all/qemu-system-data/filelist + # OPENSBI_VERSION=1.2 + # curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "https://github.com/riscv-software-src/opensbi/releases/download/v${OPENSBI_VERSION}/opensbi-${OPENSBI_VERSION}-rv-bin.tar.xz" \ + # | tar xJf - + # sudo mv "opensbi-${OPENSBI_VERSION}-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin" /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin + # sudo mv "opensbi-${OPENSBI_VERSION}-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.elf" /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf + # rm -rf "opensbi-${OPENSBI_VERSION}-rv-bin" + # - run: espup install + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - run: tools/no-std.sh + # - run: tools/build.sh +esp xtensa-esp32-none-elf + # - run: tools/no-std.sh +esp xtensa-esp32-none-elf - miri: - needs: tidy - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-unknown-linux-gnu - - target: x86_64-unknown-linux-gnu - flags: -C target-feature=+cmpxchg16b - - target: aarch64-unknown-linux-gnu - - target: i686-unknown-linux-gnu - - target: powerpc64le-unknown-linux-gnu - - target: s390x-unknown-linux-gnu - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Install Rust - run: rustup toolchain add nightly --no-self-update --component miri && 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 "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" - if: matrix.target != 'x86_64-unknown-linux-gnu' - - run: tools/test.sh miri $TARGET - env: - RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} ${{ matrix.flags }} - RUSTFLAGS: ${{ env.RUSTFLAGS }} ${{ matrix.flags }} + # miri: + # needs: tidy + # strategy: + # fail-fast: false + # matrix: + # include: + # - target: x86_64-unknown-linux-gnu + # - target: x86_64-unknown-linux-gnu + # flags: -C target-feature=+cmpxchg16b + # - target: aarch64-unknown-linux-gnu + # - target: i686-unknown-linux-gnu + # - target: powerpc64le-unknown-linux-gnu + # - target: s390x-unknown-linux-gnu + # runs-on: ubuntu-latest + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v3 + # with: + # persist-credentials: false + # - name: Install Rust + # run: rustup toolchain add nightly --no-self-update --component miri && 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 "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" + # if: matrix.target != 'x86_64-unknown-linux-gnu' + # - run: tools/test.sh miri $TARGET + # env: + # RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} ${{ matrix.flags }} + # RUSTFLAGS: ${{ env.RUSTFLAGS }} ${{ matrix.flags }} - san: - needs: tidy - strategy: - fail-fast: false - matrix: - sanitizer: - - address - - memory - - thread - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Install Rust - 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}" - echo "RUSTFLAGS=${RUSTFLAGS} -Z sanitizer=address" >>"${GITHUB_ENV}" - echo "RUSTDOCFLAGS=${RUSTDOCFLAGS} -Z sanitizer=address" >>"${GITHUB_ENV}" - if: matrix.sanitizer == 'address' - - run: | - echo "MSAN_OPTIONS=verbosity=2" >>"${GITHUB_ENV}" - echo "RUSTFLAGS=${RUSTFLAGS} -Z sanitizer=memory -Z sanitizer-memory-track-origins" >>"${GITHUB_ENV}" - echo "RUSTDOCFLAGS=${RUSTDOCFLAGS} -Z sanitizer=memory -Z sanitizer-memory-track-origins" >>"${GITHUB_ENV}" - if: matrix.sanitizer == 'memory' - - run: | - echo "RUSTFLAGS=${RUSTFLAGS} -Z sanitizer=thread" >>"${GITHUB_ENV}" - echo "RUSTDOCFLAGS=${RUSTDOCFLAGS} -Z sanitizer=thread" >>"${GITHUB_ENV}" - if: matrix.sanitizer == 'thread' - - run: tools/test.sh -Z build-std - # We test doctest only once with the default build conditions because doctest is slow. Both api-test - # and src/tests have extended copies of doctest, so this will not reduce test coverage. - # +cmpxchg16b - - run: tools/test.sh -Z build-std -vv --tests - env: - RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics - RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics + # san: + # needs: tidy + # strategy: + # fail-fast: false + # matrix: + # sanitizer: + # - address + # - memory + # - thread + # runs-on: ubuntu-latest + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v3 + # with: + # persist-credentials: false + # - name: Install Rust + # 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}" + # echo "RUSTFLAGS=${RUSTFLAGS} -Z sanitizer=address" >>"${GITHUB_ENV}" + # echo "RUSTDOCFLAGS=${RUSTDOCFLAGS} -Z sanitizer=address" >>"${GITHUB_ENV}" + # if: matrix.sanitizer == 'address' + # - run: | + # echo "MSAN_OPTIONS=verbosity=2" >>"${GITHUB_ENV}" + # echo "RUSTFLAGS=${RUSTFLAGS} -Z sanitizer=memory -Z sanitizer-memory-track-origins" >>"${GITHUB_ENV}" + # echo "RUSTDOCFLAGS=${RUSTDOCFLAGS} -Z sanitizer=memory -Z sanitizer-memory-track-origins" >>"${GITHUB_ENV}" + # if: matrix.sanitizer == 'memory' + # - run: | + # echo "RUSTFLAGS=${RUSTFLAGS} -Z sanitizer=thread" >>"${GITHUB_ENV}" + # echo "RUSTDOCFLAGS=${RUSTDOCFLAGS} -Z sanitizer=thread" >>"${GITHUB_ENV}" + # if: matrix.sanitizer == 'thread' + # - run: tools/test.sh -Z build-std + # # We test doctest only once with the default build conditions because doctest is slow. Both api-test + # # and src/tests have extended copies of doctest, so this will not reduce test coverage. + # # +cmpxchg16b + # - run: tools/test.sh -Z build-std -vv --tests + # env: + # RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics + # RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics - valgrind: - needs: tidy - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Install Rust - 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 valgrind -vv - # We test doctest only once with the default build conditions because doctest is slow. Both api-test - # and src/tests have extended copies of doctest, so this will not reduce test coverage. - # +cmpxchg16b - - run: tools/test.sh valgrind -vv --tests - env: - # vmovdqa load/store path has been tested above, disable outline-atomics and test cmpxchg16b load/store path. - RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics - RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics + # valgrind: + # needs: tidy + # runs-on: ubuntu-latest + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v3 + # with: + # persist-credentials: false + # - name: Install Rust + # 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 valgrind -vv + # # We test doctest only once with the default build conditions because doctest is slow. Both api-test + # # and src/tests have extended copies of doctest, so this will not reduce test coverage. + # # +cmpxchg16b + # - run: tools/test.sh valgrind -vv --tests + # env: + # # vmovdqa load/store path has been tested above, disable outline-atomics and test cmpxchg16b load/store path. + # RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics + # RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+cmpxchg16b --cfg portable_atomic_no_outline_atomics - codegen: - needs: tidy - runs-on: ubuntu-latest - timeout-minutes: 60 - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Install Rust - run: rustup toolchain add nightly --no-self-update --component rustfmt && rustup default nightly - - run: tools/no_atomic.sh - - run: tools/gen.sh - - id: diff - run: tools/ci/gen.sh - if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') - - uses: peter-evans/create-pull-request@v5 - with: - title: Update generated code - body: | - Auto-generated by [create-pull-request][1] - [Please close and immediately reopen this pull request to run CI.][2] + # codegen: + # needs: tidy + # runs-on: ubuntu-latest + # timeout-minutes: 60 + # permissions: + # contents: write + # pull-requests: write + # steps: + # - uses: actions/checkout@v3 + # with: + # persist-credentials: false + # - name: Install Rust + # run: rustup toolchain add nightly --no-self-update --component rustfmt && rustup default nightly + # - run: tools/no_atomic.sh + # - run: tools/gen.sh + # - id: diff + # run: tools/ci/gen.sh + # if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') + # - uses: peter-evans/create-pull-request@v5 + # with: + # title: Update generated code + # body: | + # Auto-generated by [create-pull-request][1] + # [Please close and immediately reopen this pull request to run CI.][2] - [1]: https://github.com/peter-evans/create-pull-request - [2]: https://github.com/peter-evans/create-pull-request/blob/HEAD/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs - branch: update-generated-code - if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' - - run: git add -N . && git diff --exit-code + # [1]: https://github.com/peter-evans/create-pull-request + # [2]: https://github.com/peter-evans/create-pull-request/blob/HEAD/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs + # branch: update-generated-code + # if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' + # - run: git add -N . && git diff --exit-code diff --git a/Cargo.toml b/Cargo.toml index aac270d5..4a273aa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,9 @@ rust-version = "1.34" license = "Apache-2.0 OR MIT" repository = "https://github.com/taiki-e/portable-atomic" keywords = ["atomic"] +# "no-std::no-alloc" categories = ["concurrency", "data-structures", "embedded", "hardware-support", "no-std"] -exclude = ["/.*", "/tools", "/target-specs", "/Cross.toml", "/DEVELOPMENT.md"] +exclude = ["/.*", "/tools", "/target-specs", "/DEVELOPMENT.md"] description = """ Portable atomic types including support for 128-bit atomics, atomic float, etc. """ diff --git a/Cross.toml b/Cross.toml deleted file mode 100644 index 9a1f6271..00000000 --- a/Cross.toml +++ /dev/null @@ -1,22 +0,0 @@ -[build.env] -passthrough = [ - "CARGO_INCREMENTAL", - "CARGO_NET_GIT_FETCH_WITH_CLI", - "CARGO_NET_RETRY", - "CARGO_PROFILE_RELEASE_CODEGEN_UNITS", - "CARGO_PROFILE_RELEASE_LTO", - "CARGO_TERM_COLOR", - "CI", - "RUST_BACKTRACE", - "RUST_TEST_THREADS", - "RUSTDOCFLAGS", - "RUSTFLAGS", - "RUSTUP_MAX_RETRIES", -] - -[target.aarch64-linux-android] -# Workaround https://github.com/cross-rs/cross/issues/1128 / https://github.com/rust-lang/rust/issues/103673 -image = "ghcr.io/cross-rs/aarch64-linux-android:edge" -[target.arm-linux-androideabi] -# Workaround https://github.com/cross-rs/cross/issues/1128 / https://github.com/rust-lang/rust/issues/103673 -image = "ghcr.io/cross-rs/arm-linux-androideabi:edge" diff --git a/src/imp/core_atomic.rs b/src/imp/core_atomic.rs index 9e041d3a..307e4a85 100644 --- a/src/imp/core_atomic.rs +++ b/src/imp/core_atomic.rs @@ -386,6 +386,7 @@ macro_rules! atomic_int { portable_atomic_target_feature = "v6", )), ), + // TODO: mips32r6, mips64r6? target_arch = "mips", target_arch = "mips64", target_arch = "powerpc", @@ -436,6 +437,7 @@ macro_rules! atomic_int { portable_atomic_target_feature = "v6", )), ), + // TODO: mips32r6, mips64r6? target_arch = "mips", target_arch = "mips64", target_arch = "powerpc", diff --git a/tools/test.sh b/tools/test.sh index 2b58f84a..c8c3ba58 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -67,7 +67,7 @@ case "${1:-}" in ;; esac target='' -build_std='' +build_std=() release=() tests=() cargo_options=() @@ -79,14 +79,37 @@ while [[ $# -gt 0 ]]; do break ;; --target) + if [[ -n "${target}" ]]; then + bail "multiple --target option" + fi shift target="$1" ;; - --target=*) target="${1#--target=}" ;; + --target=*) + if [[ -n "${target}" ]]; then + bail "multiple --target option" + fi + target="${1#--target=}" + ;; --tests) tests=("$1") ;; - -Zbuild-std | -Zbuild-std=* | build-std | build-std=*) - cargo_options+=("$1") - build_std=1 + -Z*) + arg="$1" + case "${arg}" in + -Z) + shift + arg="$1" + ;; + -Z*) arg="${arg#-Z}" ;; + esac + case "${arg}" in + build-std | build-std=*) + if [[ ${#build_std[@]} -gt 0 ]]; then + bail "multiple -Z build-std option" + fi + build_std=(-Z "${arg}") + ;; + *) cargo_options+=(-Z "${arg}") ;; + esac ;; --release) release=(--release) ;; *) cargo_options+=("$1") ;; @@ -120,7 +143,7 @@ if [[ -n "${CI:-}" ]]; then fi args=() -if [[ -z "${target}" ]] && [[ -n "${build_std}" ]]; then +if [[ -z "${target}" ]] && [[ ${#build_std[@]} -gt 0 ]]; then target="${target:-"${host}"}" fi if [[ -n "${target}" ]]; then @@ -137,8 +160,8 @@ if [[ -n "${target}" ]]; then if grep <<<"${rustup_target_list}" -Eq "^${target}$"; then rustup ${pre_args[@]+"${pre_args[@]}"} target add "${target}" &>/dev/null elif [[ -n "${nightly}" ]]; then - if [[ -z "${build_std}" ]]; then - args+=(-Z build-std) + if [[ ${#build_std[@]} -eq 0 ]]; then + build_std=(-Z build-std) fi else bail "target '${target}' requires nightly compiler" @@ -164,9 +187,9 @@ case "${cmd}" in build) TS='' args+=(--no-run ${release[@]+"${release[@]}"}) - x_cargo test ${cargo_options[@]+"${cargo_options[@]}"} "${args[@]}" >&2 + x_cargo test ${build_std[@]+"${build_std[@]}"} ${cargo_options[@]+"${cargo_options[@]}"} "${args[@]}" >&2 binary_path=$( - "${cargo}" ${pre_args[@]+"${pre_args[@]}"} test ${cargo_options[@]+"${cargo_options[@]}"} "${args[@]}" -q --message-format=json \ + "${cargo}" ${pre_args[@]+"${pre_args[@]}"} test ${build_std[@]+"${build_std[@]}"} ${cargo_options[@]+"${cargo_options[@]}"} "${args[@]}" -q --message-format=json \ | jq -r "select(.manifest_path == \"$(cargo ${pre_args[@]+"${pre_args[@]}"} locate-project --message-format=plain)\") | select(.executable != null) | .executable" ) echo "${binary_path}" @@ -197,9 +220,9 @@ run() { if [[ ${#release[@]} -eq 0 ]]; then if [[ "${RUSTFLAGS:-}" == *"-Z sanitizer="* ]] || [[ "${RUSTFLAGS:-}" == *"-Zsanitizer="* ]]; then # doctest with debug build on Sanitizer is slow - x_cargo test --tests "$@" + x_cargo test ${build_std[@]+"${build_std[@]}"} --tests "$@" else - x_cargo test ${tests[@]+"${tests[@]}"} "$@" + x_cargo test ${build_std[@]+"${build_std[@]}"} ${tests[@]+"${tests[@]}"} "$@" fi fi @@ -207,15 +230,15 @@ run() { if [[ "${RUSTFLAGS:-}" == *"-Z sanitizer=memory"* ]] || [[ "${RUSTFLAGS:-}" == *"-Zsanitizer=memory"* ]]; then # Workaround https://github.com/google/sanitizers/issues/558 CARGO_PROFILE_RELEASE_OPT_LEVEL=0 \ - x_cargo test --release --tests "$@" + x_cargo test ${build_std[@]+"${build_std[@]}"} --release --tests "$@" else - x_cargo test --release --tests "$@" + x_cargo test ${build_std[@]+"${build_std[@]}"} --release --tests "$@" fi # LTO + doctests is very slow on some platforms (probably related to the fact that they compile binaries for each example) CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \ CARGO_PROFILE_RELEASE_LTO=fat \ - x_cargo test --release --tests --target-dir target/fat-lto "$@" + x_cargo test ${build_std[@]+"${build_std[@]}"} --release --tests --target-dir target/fat-lto "$@" # cargo-careful only supports nightly. rustc-build-sysroot doesn't work on old nightly (at least on nightly-2022-08-12 - 1.65.0-nightly). if [[ "${rustc_minor_version}" -ge 66 ]] && [[ -n "${nightly}" ]] && type -P cargo-careful &>/dev/null && [[ "${cargo}" == "cargo" ]]; then