diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index 2f7a1d79..00000000 --- a/.cirrus.yml +++ /dev/null @@ -1,78 +0,0 @@ -only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'main') -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 --cfg portable_atomic_unstable_f16 --cfg quickcheck_unstable_f16 --cfg rand_unstable_f16 --cfg portable_atomic_unstable_f128 --cfg quickcheck_unstable_f128 --cfg rand_unstable_f128 - RUSTUP_MAX_RETRIES: '10' - PORTABLE_ATOMIC_DENY_WARNINGS: '1' - -aarch64_linux_test_task: - name: test ($TARGET) - env: - TARGET: aarch64-unknown-linux-gnu - arm_container: - image: rust - setup_script: - - set -CeEuxo pipefail - - | - retry() { - for i in {1..10}; do - if "$@"; then - return 0 - else - sleep "${i}" - fi - done - "$@" - } - - lscpu - - retry rustup toolchain add nightly --no-self-update && rustup default nightly - # - retry apt-get -o Acquire::Retries=10 -qq update && retry apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends moreutils - - retry curl --proto '=https' --tlsv1.2 -fsSL "https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${TARGET}.tar.gz" | tar xzf - -C "${CARGO_HOME}/bin" - test_script: - - set -CeEuxo pipefail - - ./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 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_valgrind_task: - name: valgrind ($TARGET) - env: - TARGET: aarch64-unknown-linux-gnu - arm_container: - image: rust - setup_script: - - set -CeEuxo pipefail - - | - retry() { - for i in {1..10}; do - if "$@"; then - return 0 - else - sleep "${i}" - fi - done - "$@" - } - - retry rustup toolchain add nightly --no-self-update && rustup default nightly - - retry apt-get -o Acquire::Retries=10 -qq update && retry apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends valgrind # moreutils - - retry curl --proto '=https' --tlsv1.2 -fsSL "https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${TARGET}.tar.gz" | tar xzf - -C "${CARGO_HOME}/bin" - test_script: - - set -CeEuxo pipefail - - ./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 - # +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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1237b363..982579b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,9 +69,9 @@ jobs: # - LLVM 7 : stable 1.29, ? - ? # - LLVM 8 : stable 1.30 - 1.37, ? - ? # - LLVM 9 : stable 1.38 - 1.44, ? - ? - # - LLVM 10 : stable 1.45 - 1.46, ? - ? - # - LLVM 11 : stable 1.47 - 1.51, ? - ? - # - LLVM 12 : stable 1.52 - 1.55, ? - nightly-2021-08-21 (1.56) + # - LLVM 10 : stable 1.45 - 1.46, ? - nightly-2020-08-23 (1.47) + # - LLVM 11 : stable 1.47 - 1.51, nightly-2020-08-24 (1.47) - nightly-2021-03-04 (1.52) + # - LLVM 12 : stable 1.52 - 1.55, nightly-2021-03-05 (1.52) - nightly-2021-08-21 (1.56) # - LLVM 13 : stable 1.56 - 1.59, nightly-2021-08-22 (1.56) - nightly-2022-02-17 (1.60) # - LLVM 14 : stable 1.60 - 1.64, nightly-2022-02-18 (1.60) - nightly-2022-08-12 (1.65) # - LLVM 15 : stable 1.65 - 1.69, nightly-2022-08-13 (1.65) - nightly-2023-03-25 (1.70) @@ -95,71 +95,150 @@ jobs: # - LLVM 16 : stable 1.76 - 1.78, since https://github.com/rust-lang/rust/pull/117947 # - LLVM 17 : stable 1.79 - 1.82, since https://github.com/rust-lang/rust/pull/122649 # - LLVM 18 : stable 1.83 - , since https://github.com/rust-lang/rust/pull/130487 - # NOTE that some commented-out LLVM version entries are kept here, which may be temporarily uncommented if + # Note that some commented-out LLVM version entries are kept here, which may be temporarily uncommented if # needed to investigate possible issues that may arise between LLVM and code generated for certain targets. include: - - rust: '1.56' + # ------------------------------------------------------------ + # x86_64-unknown-linux-gnu + - rust: '1.56' # LLVM 13 + target: x86_64-unknown-linux-gnu - rust: nightly-2021-08-21 # Rust 1.56, LLVM 12 + target: x86_64-unknown-linux-gnu - rust: '1.59' # LLVM 13 + target: x86_64-unknown-linux-gnu # - rust: '1.64' # LLVM 14 + # target: x86_64-unknown-linux-gnu # - rust: '1.69' # LLVM 15 + # target: x86_64-unknown-linux-gnu # - rust: '1.72' # LLVM 16 + # target: x86_64-unknown-linux-gnu # - rust: '1.77' # LLVM 17 + # target: x86_64-unknown-linux-gnu # - rust: '1.81' # LLVM 18 + # target: x86_64-unknown-linux-gnu - rust: stable + target: x86_64-unknown-linux-gnu - rust: beta + target: x86_64-unknown-linux-gnu - rust: nightly + target: x86_64-unknown-linux-gnu - rust: nightly + target: x86_64-unknown-linux-gnu flags: -C panic=abort -Z panic_abort_tests - rust: nightly + target: x86_64-unknown-linux-gnu flags: -Z codegen-backend=cranelift + # ------------------------------------------------------------ + # x86_64-apple-darwin - rust: nightly - # target: x86_64-apple-darwin - os: macos-13 # x86_64 + target: x86_64-apple-darwin + os: macos-13 - rust: nightly - # target: x86_64-pc-windows-msvc + target: x86_64-apple-darwin + os: macos-latest # Rosetta on AArch64 + # ------------------------------------------------------------ + # x86_64-pc-windows-msvc + - rust: nightly + target: x86_64-pc-windows-msvc os: windows-latest + # ------------------------------------------------------------ + # x86_64-pc-windows-gnu - rust: nightly-x86_64-pc-windows-gnu - # target: x86_64-pc-windows-gnu + target: x86_64-pc-windows-gnu os: windows-latest + # ------------------------------------------------------------ + # i686-pc-windows-msvc - rust: nightly-i686-pc-windows-msvc - # target: i686-pc-windows-msvc + target: i686-pc-windows-msvc os: windows-latest + # ------------------------------------------------------------ + # i686-pc-windows-gnu - rust: nightly-i686-pc-windows-gnu - # target: i686-pc-windows-gnu + target: i686-pc-windows-gnu os: windows-latest - - rust: nightly - target: aarch64-apple-darwin - os: macos-latest # AArch64 - - rust: nightly - target: aarch64-apple-ios-macabi - os: macos-latest # AArch64 + # ------------------------------------------------------------ + # aarch64-unknown-linux-gnu - rust: nightly-2021-08-21 # Rust 1.56, LLVM 12 target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm - rust: '1.59' # LLVM 13 target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm # - rust: '1.64' # LLVM 14 # target: aarch64-unknown-linux-gnu + # os: ubuntu-24.04-arm # - rust: '1.69' # LLVM 15 # target: aarch64-unknown-linux-gnu + # os: ubuntu-24.04-arm # - rust: '1.72' # LLVM 16 # target: aarch64-unknown-linux-gnu + # os: ubuntu-24.04-arm # - rust: '1.77' # LLVM 17 # target: aarch64-unknown-linux-gnu + # os: ubuntu-24.04-arm # - rust: '1.81' # LLVM 18 # target: aarch64-unknown-linux-gnu + # os: ubuntu-24.04-arm - rust: stable target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm - rust: beta target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm - rust: nightly target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm - rust: nightly target: aarch64-unknown-linux-gnu + os: ubuntu-latest # QEMU on x86_64 + - rust: nightly + target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm flags: -Z codegen-backend=cranelift + # ------------------------------------------------------------ + # aarch64-apple-darwin + - rust: nightly-2021-08-21 # Rust 1.56, LLVM 12 + target: aarch64-apple-darwin + os: macos-latest + - rust: '1.59' # LLVM 13 + target: aarch64-apple-darwin + os: macos-latest + # - rust: '1.64' # LLVM 14 + # target: aarch64-apple-darwin + # os: macos-latest + # - rust: '1.69' # LLVM 15 + # target: aarch64-apple-darwin + # os: macos-latest + # - rust: '1.72' # LLVM 16 + # target: aarch64-apple-darwin + # os: macos-latest + # - rust: '1.77' # LLVM 17 + # target: aarch64-apple-darwin + # os: macos-latest + # - rust: '1.81' # LLVM 18 + # target: aarch64-apple-darwin + # os: macos-latest + - rust: stable + target: aarch64-apple-darwin + os: macos-latest + - rust: beta + target: aarch64-apple-darwin + os: macos-latest + - rust: nightly + target: aarch64-apple-darwin + os: macos-latest + # ------------------------------------------------------------ + # aarch64-apple-ios-macabi + - rust: nightly + target: aarch64-apple-ios-macabi + os: macos-latest + # ------------------------------------------------------------ + # aarch64_be-unknown-linux-gnu - rust: nightly-2024-11-07 # TODO: https://github.com/BurntSushi/memchr/pull/162 target: aarch64_be-unknown-linux-gnu os: ubuntu-22.04 + # ------------------------------------------------------------ + # aarch64-unknown-linux-musl - rust: stable target: aarch64-unknown-linux-musl - rust: stable @@ -170,63 +249,129 @@ jobs: - rust: nightly target: aarch64-unknown-linux-musl flags: -C target-feature=-crt-static + # ------------------------------------------------------------ + # aarch64-linux-android - rust: stable target: aarch64-linux-android - rust: nightly target: aarch64-linux-android + # ------------------------------------------------------------ + # aarch64-pc-windows-gnullvm # TODO: flaky # - rust: nightly # target: aarch64-pc-windows-gnullvm + # ------------------------------------------------------------ + # armv5te-unknown-linux-gnueabi - rust: nightly-2021-08-21 # Rust 1.56, LLVM 12 target: armv5te-unknown-linux-gnueabi - rust: '1.59' # LLVM 13 target: armv5te-unknown-linux-gnueabi + # - rust: '1.64' # LLVM 14 + # target: armv5te-unknown-linux-gnueabi + # - rust: '1.69' # LLVM 15 + # target: armv5te-unknown-linux-gnueabi + # - rust: '1.72' # LLVM 16 + # target: armv5te-unknown-linux-gnueabi + # - rust: '1.77' # LLVM 17 + # target: armv5te-unknown-linux-gnueabi + # - rust: '1.81' # LLVM 18 + # target: armv5te-unknown-linux-gnueabi - rust: stable target: armv5te-unknown-linux-gnueabi + # - rust: beta + # target: armv5te-unknown-linux-gnueabi - rust: nightly-2024-11-27 # TODO: LLVM bug with release build target: armv5te-unknown-linux-gnueabi + # ------------------------------------------------------------ + # arm-unknown-linux-gnueabi - rust: nightly target: arm-unknown-linux-gnueabi + # ------------------------------------------------------------ + # armv7-unknown-linux-gnueabi - rust: nightly target: armv7-unknown-linux-gnueabi + # ------------------------------------------------------------ + # armv7-unknown-linux-gnueabihf - rust: nightly target: armv7-unknown-linux-gnueabihf + # ------------------------------------------------------------ + # armeb-unknown-linux-gnueabi - rust: nightly target: armeb-unknown-linux-gnueabi os: ubuntu-22.04 + # ------------------------------------------------------------ + # arm-linux-androideabi # TODO: backtrace bug: panicked at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/../../backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs:48:30: - rust: nightly-2024-08-30 target: arm-linux-androideabi + # ------------------------------------------------------------ + # i586-unknown-linux-gnu - rust: nightly target: i586-unknown-linux-gnu + # ------------------------------------------------------------ + # i686-unknown-linux-gnu - rust: nightly-2021-08-21 # Rust 1.56, LLVM 12 target: i686-unknown-linux-gnu - rust: '1.59' # LLVM 13 target: i686-unknown-linux-gnu + # - rust: '1.64' # LLVM 14 + # target: i686-unknown-linux-gnu + # - rust: '1.69' # LLVM 15 + # target: i686-unknown-linux-gnu + # - rust: '1.72' # LLVM 16 + # target: i686-unknown-linux-gnu + # - rust: '1.77' # LLVM 17 + # target: i686-unknown-linux-gnu + # - rust: '1.81' # LLVM 18 + # target: i686-unknown-linux-gnu - rust: stable target: i686-unknown-linux-gnu + # - rust: beta + # target: i686-unknown-linux-gnu - rust: nightly target: i686-unknown-linux-gnu + # ------------------------------------------------------------ + # loongarch64-unknown-linux-gnu - rust: nightly target: loongarch64-unknown-linux-gnu + # ------------------------------------------------------------ + # mips-unknown-linux-gnu - rust: nightly target: mips-unknown-linux-gnu + # ------------------------------------------------------------ + # mipsel-unknown-linux-gnu - rust: nightly target: mipsel-unknown-linux-gnu + # ------------------------------------------------------------ + # mips64-unknown-linux-gnuabi64 - rust: nightly target: mips64-unknown-linux-gnuabi64 + # ------------------------------------------------------------ + # mips64el-unknown-linux-gnuabi64 - rust: nightly target: mips64el-unknown-linux-gnuabi64 + # ------------------------------------------------------------ + # mipsisa32r6-unknown-linux-gnu - rust: nightly target: mipsisa32r6-unknown-linux-gnu + # ------------------------------------------------------------ + # mipsisa32r6el-unknown-linux-gnu - rust: nightly target: mipsisa32r6el-unknown-linux-gnu + # ------------------------------------------------------------ + # mipsisa64r6-unknown-linux-gnuabi64 - rust: nightly target: mipsisa64r6-unknown-linux-gnuabi64 + # ------------------------------------------------------------ + # mipsisa64r6el-unknown-linux-gnuabi64 - rust: nightly target: mipsisa64r6el-unknown-linux-gnuabi64 + # ------------------------------------------------------------ + # powerpc-unknown-linux-gnu - rust: nightly target: powerpc-unknown-linux-gnu + # ------------------------------------------------------------ + # 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-08-12 # Rust 1.65, LLVM 14 @@ -241,6 +386,8 @@ jobs: # target: powerpc64-unknown-linux-gnu - rust: nightly target: powerpc64-unknown-linux-gnu + # ------------------------------------------------------------ + # 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-08-12 # Rust 1.65, LLVM 14 @@ -255,6 +402,8 @@ jobs: # target: powerpc64le-unknown-linux-gnu - rust: nightly target: powerpc64le-unknown-linux-gnu + # ------------------------------------------------------------ + # riscv32gc-unknown-linux-gnu - rust: nightly-2022-08-12 # Rust 1.65, LLVM 14 target: riscv32gc-unknown-linux-gnu # - rust: nightly-2023-03-25 # Rust 1.70, LLVM 15 @@ -267,6 +416,8 @@ jobs: # target: riscv32gc-unknown-linux-gnu - rust: nightly target: riscv32gc-unknown-linux-gnu + # ------------------------------------------------------------ + # riscv64gc-unknown-linux-gnu - rust: nightly-2021-08-21 # Rust 1.56, LLVM 12 target: riscv64gc-unknown-linux-gnu - rust: '1.59' # LLVM 13 @@ -283,28 +434,44 @@ jobs: # target: riscv64gc-unknown-linux-gnu - rust: stable target: riscv64gc-unknown-linux-gnu + # - rust: beta + # target: riscv64gc-unknown-linux-gnu - rust: nightly target: riscv64gc-unknown-linux-gnu - rust: nightly target: riscv64gc-unknown-linux-gnu flags: -Z codegen-backend=cranelift - # - rust: '1.84' # LLVM 19 (oldest stable version we can use asm on this target) - # target: s390x-unknown-linux-gnu + # ------------------------------------------------------------ + # 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-2024-02-13 # Rust 1.78, LLVM 17 # target: s390x-unknown-linux-gnu # - rust: nightly-2024-07-31 # Rust 1.82, LLVM 18 # target: s390x-unknown-linux-gnu + - rust: '1.84' # LLVM 19 (inline asm for s390x has been stabilized in Rust 1.84) + target: s390x-unknown-linux-gnu + - rust: stable + target: s390x-unknown-linux-gnu + # - rust: beta + # target: s390x-unknown-linux-gnu - rust: nightly target: s390x-unknown-linux-gnu + # ------------------------------------------------------------ + # sparc64-unknown-linux-gnu - rust: nightly target: sparc64-unknown-linux-gnu + # ------------------------------------------------------------ + # thumbv7neon-unknown-linux-gnueabihf - rust: nightly target: thumbv7neon-unknown-linux-gnueabihf runs-on: ${{ matrix.os || 'ubuntu-latest' }} timeout-minutes: 60 steps: + # https://github.com/orgs/community/discussions/148648#discussioncomment-11867019 + - name: Workaround for AArch64 Linux runner bug + run: for var in PATH XDG_CONFIG_HOME; do sed -Ee "s/^/${var}=/" -e 's/(runner)admin/\1/g' <<< "${!var}"; done | tee -a -- "${GITHUB_ENV}" + if: endsWith(matrix.os, '-arm') - uses: taiki-e/checkout-action@v1 - run: | lscpu @@ -320,6 +487,17 @@ jobs: - uses: taiki-e/github-actions/install-rust@main with: toolchain: ${{ matrix.rust }} + - id: prepare + run: | + if [[ "${{ matrix.target }}" == '' ]]; then + printf 'matrix.target must be set\n' + exit 1 + fi + host="$(rustc -vV | grep -E '^host:' | cut -d' ' -f2)" + if [[ "${host}" != "${{ matrix.target }}" ]]; then + printf '%s\n' "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" + printf '%s\n' "target-not-host=true" >>"${GITHUB_OUTPUT}" + fi - uses: taiki-e/install-action@cargo-hack - uses: taiki-e/install-action@cargo-minimal-versions - uses: taiki-e/install-action@cargo-careful @@ -327,25 +505,31 @@ jobs: - uses: taiki-e/setup-cross-toolchain-action@v1 with: target: ${{ matrix.target }} - if: matrix.target != '' - - run: printf '%s\n' "RUSTFLAGS=${RUSTFLAGS} --cfg qemu" >>"${GITHUB_ENV}" - if: matrix.target != '' && !startsWith(matrix.target, 'i686') && !startsWith(matrix.target, 'x86_64') && !startsWith(matrix.os, 'macos') + if: steps.prepare.outputs.target-not-host == 'true' + - run: | + target="${{ matrix.target }}" + target_lower="${target//-/_}" + target_lower="${target_lower//./_}" + target_upper=$(tr '[:lower:]' '[:upper:]' <<<"${target_lower}") + if [[ "$(eval "printf '%s\n' \${CARGO_TARGET_${target_upper}_RUNNER}")" == *"qemu"* ]]; then + printf '%s\n' "RUSTFLAGS=${RUSTFLAGS} --cfg qemu" >>"${GITHUB_ENV}" + fi - run: | printf '%s\n' "RUSTFLAGS=${RUSTFLAGS} ${{ matrix.flags }}" >>"${GITHUB_ENV}" printf '%s\n' "RUSTDOCFLAGS=${RUSTDOCFLAGS} ${{ matrix.flags }}" >>"${GITHUB_ENV}" if: matrix.flags != '' - - run: printf '%s\n' "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" - if: matrix.target != '' && !contains(matrix.target, '-darwin') # TODO: LLVM bug: Undefined temporary symbol error when building std. - - run: printf 'RELEASE=--release\n' >>"${GITHUB_ENV}" + - name: Workaround for LLVM bug about MIPS32 + run: printf 'RELEASE=--release\n' >>"${GITHUB_ENV}" if: startsWith(matrix.target, 'mips-') || startsWith(matrix.target, 'mipsel-') # for f16 and f128 # https://github.com/rust-lang/compiler-builtins/blob/compiler_builtins-v0.1.142/configure.rs#L60 + # https://github.com/rust-lang/rustc_codegen_cranelift/issues/1461 - run: printf '%s\n' "RUSTFLAGS=${RUSTFLAGS} --cfg portable_atomic_unstable_f16 --cfg quickcheck_unstable_f16 --cfg rand_unstable_f16" >>"${GITHUB_ENV}" if: matrix.rust == 'nightly' && !(startsWith(matrix.target, 'arm64ec') || startsWith(matrix.target, 'csky') || startsWith(matrix.target, 'hexagon') || startsWith(matrix.target, 'i586') || startsWith(matrix.target, 'i686') || startsWith(matrix.target, 'loongarch64') || startsWith(matrix.target, 'mips') || startsWith(matrix.target, 'powerpc') || startsWith(matrix.target, 's390x') || startsWith(matrix.target, 'sparc') || startsWith(matrix.target, 'wasm') || contains(matrix.flags, 'codegen-backend=cranelift')) - run: printf '%s\n' "RUSTFLAGS=${RUSTFLAGS} --cfg portable_atomic_unstable_f128 --cfg quickcheck_unstable_f128 --cfg rand_unstable_f128" >>"${GITHUB_ENV}" if: matrix.rust == 'nightly' && !(startsWith(matrix.target, 'arm64ec') || startsWith(matrix.target, 'i586') || startsWith(matrix.target, 'i686') || startsWith(matrix.target, 'mips64') || startsWith(matrix.target, 'mipsisa64') || startsWith(matrix.target, 'powerpc-') || startsWith(matrix.target, 'powerpc64-') || startsWith(matrix.target, 'sparc') || contains(matrix.flags, 'codegen-backend=cranelift')) - # for serde + # for serde on old nightly - run: printf '%s\n' "RUSTFLAGS=${RUSTFLAGS} --cfg no_diagnostic_namespace" >>"${GITHUB_ENV}" if: matrix.rust == 'nightly-2024-02-13' @@ -358,13 +542,16 @@ jobs: # and src/tests have extended copies of doctest, so this will not reduce test coverage. # portable_atomic_no_outline_atomics only affects x86_64, AArch64, Arm, powerpc64, and RISC-V Linux. # outline-atomics is disabled by default on AArch64/powerpc64 musl with static linking + # AArch64 macOS is skipped because it is +lse,+lse2 by default # powerpc64le- (little-endian) is skipped because it is pwr8 by default # RISC-V Linux is skipped because outline-atomics is currently disabled by default on riscv. - run: tools/test.sh -vv --tests ${TARGET:-} ${BUILD_STD:-} ${RELEASE:-} env: RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg portable_atomic_no_outline_atomics RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg portable_atomic_no_outline_atomics - if: (matrix.target == '' && !contains(matrix.rust, 'i686') || startsWith(matrix.target, 'x86_64')) || (startsWith(matrix.target, 'aarch64') || startsWith(matrix.target, 'powerpc64-')) && !(contains(matrix.target, '-musl') && matrix.flags == '') || startsWith(matrix.target, 'armv5te') || matrix.target == 'arm-linux-androideabi' + if: startsWith(matrix.target, 'x86_64') || (startsWith(matrix.target, 'aarch64') || startsWith(matrix.target, 'powerpc64-')) && !(contains(matrix.target, '-musl') && matrix.flags == '') || startsWith(matrix.target, 'armv5te') || matrix.target == 'arm-linux-androideabi' + # powerpc64 is skipped because tested below. + # AArch64 macOS is skipped because it is +lse,+lse2 by default - run: tools/test.sh -vv --tests ${TARGET:-} ${BUILD_STD:-} ${RELEASE:-} env: # Note: detect_false cfg is intended to make it easy for portable-atomic developers to @@ -372,9 +559,8 @@ jobs: # __kuser_helper_version < 5, etc., and is not a public API. RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg portable_atomic_test_outline_atomics_detect_false RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg portable_atomic_test_outline_atomics_detect_false - # powerpc64 is skipped because tested below. # TODO: arm-linux-androideabi is removed due to an issue between Rust nightly & QEMU in CI testing - needs investigation - if: (matrix.target == '' && !contains(matrix.rust, 'i686') || startsWith(matrix.target, 'x86_64')) || startsWith(matrix.target, 'aarch64') && !(contains(matrix.target, '-musl') && matrix.flags == '') || startsWith(matrix.target, 'armv5te') + if: startsWith(matrix.target, 'x86_64') || startsWith(matrix.target, 'aarch64') && !(contains(matrix.target, '-musl') && matrix.flags == '') || startsWith(matrix.target, 'armv5te') - run: tools/test.sh -vv --tests ${TARGET:-} ${BUILD_STD:-} ${RELEASE:-} env: QEMU_CPU: power7 # no quadword-atomics @@ -414,26 +600,27 @@ jobs: QEMU_CPU: sifive-u54 # no zacas if: startsWith(matrix.target, 'riscv64') # x86_64 +cmpxchg16b + # macOS is skipped because it is +cmpxchg16b by default - run: tools/test.sh -vv --tests ${TARGET:-} ${BUILD_STD:-} ${RELEASE:-} env: # cmpxchg16b + outline-atomics (vmovdqa load/store) path is tested in first 2 runs on macOS. 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 - if: matrix.target == '' && !contains(matrix.rust, 'i686') || startsWith(matrix.target, 'x86_64') + if: startsWith(matrix.target, 'x86_64') && !contains(matrix.target, '-darwin') # aarch64 +lse + # macOS is skipped because it is +lse,+lse2 by default - run: tools/test.sh -vv --tests ${TARGET:-} ${BUILD_STD:-} ${RELEASE:-} env: RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse - # macOS is skipped because it is +lse,+lse2 by default # QEMU + Wine is slow so test only cases where OS-specific code is called. if: startsWith(matrix.target, 'aarch64') && !contains(matrix.target, '-darwin') && matrix.target != 'aarch64-pc-windows-gnullvm' # aarch64 +lse,+lse2 + # macOS is skipped because it is +lse,+lse2 by default - run: tools/test.sh -vv --tests ${TARGET:-} ${BUILD_STD:-} ${RELEASE:-} env: RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse,+lse2 RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse,+lse2 - # macOS is skipped because it is +lse,+lse2 by default # QEMU + Wine is slow so test only cases where OS-specific code is called. if: startsWith(matrix.target, 'aarch64') && !contains(matrix.target, '-darwin') && matrix.target != 'aarch64-pc-windows-gnullvm' # powerpc64 pwr7 @@ -615,6 +802,11 @@ jobs: # - '1.77' # LLVM 17 # - '1.81' # LLVM 18 - stable + - nightly-2022-08-12 # Rust 1.65, LLVM 14 + # - nightly-2023-03-25 # Rust 1.70, LLVM 15 + # - nightly-2023-08-08 # Rust 1.73, LLVM 16 + # - nightly-2024-02-13 # Rust 1.78, LLVM 17 + # - nightly-2024-07-31 # Rust 1.82, LLVM 18 - nightly runs-on: ubuntu-latest timeout-minutes: 60 @@ -713,6 +905,8 @@ jobs: steps: - uses: taiki-e/checkout-action@v1 - uses: taiki-e/github-actions/install-rust@nightly + with: + component: miri - uses: taiki-e/install-action@cargo-hack # - 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: printf '%s\n' "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" @@ -767,21 +961,57 @@ jobs: valgrind: needs: tidy - runs-on: ubuntu-latest + name: valgrind (${{ matrix.target }}) + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-gnu + - target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm + runs-on: ${{ matrix.os || 'ubuntu-latest' }} timeout-minutes: 60 steps: + # https://github.com/orgs/community/discussions/148648#discussioncomment-11867019 + - name: Workaround for AArch64 Linux runner bug + run: for var in PATH XDG_CONFIG_HOME; do sed -Ee "s/^/${var}=/" -e 's/(runner)admin/\1/g' <<< "${!var}"; done | tee -a -- "${GITHUB_ENV}" + if: endsWith(matrix.os, '-arm') - uses: taiki-e/checkout-action@v1 - uses: taiki-e/github-actions/install-rust@nightly + - run: | + if [[ "${{ matrix.target }}" == '' ]]; then + printf 'matrix.target must be set\n' + exit 1 + fi + host="$(rustc -vV | grep -E '^host:' | cut -d' ' -f2)" + if [[ "${host}" != "${{ matrix.target }}" ]]; then + printf 'matrix.target must be the same as host\n' + exit 1 + fi - uses: taiki-e/install-action@cargo-hack # - 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 - # +cmpxchg16b + # x86_64 +cmpxchg16b - run: tools/test.sh valgrind -vv 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 + if: startsWith(matrix.target, 'x86_64') + # On AArch64 linux-gnu, outline-atomics is enabled by default. + - run: tools/test.sh valgrind -vv + env: + RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg portable_atomic_no_outline_atomics + RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg portable_atomic_no_outline_atomics + if: startsWith(matrix.target, 'aarch64') + # aarch64 +lse + # As of Valgrind 3.19, Valgrind supports atomic instructions of Armv8.0 and Armv8.1 (FEAT_LSE). + - run: tools/test.sh valgrind -vv + env: + RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -C target-feature=+lse + RUSTFLAGS: ${{ env.RUSTFLAGS }} -C target-feature=+lse + if: startsWith(matrix.target, 'aarch64') codegen: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 86fa52d5..4c944086 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ [![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license) [![msrv](https://img.shields.io/badge/msrv-1.34-blue?style=flat-square&logo=rust)](https://www.rust-lang.org) [![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/portable-atomic/ci.yml?branch=main&style=flat-square&logo=github)](https://github.com/taiki-e/portable-atomic/actions) -[![cirrus ci](https://img.shields.io/cirrus/github/taiki-e/portable-atomic/main?style=flat-square&logo=cirrusci)](https://cirrus-ci.com/github/taiki-e/portable-atomic) Portable atomic types including support for 128-bit atomics, atomic float, etc. diff --git a/portable-atomic-util/README.md b/portable-atomic-util/README.md index 199d10d9..b131e16e 100644 --- a/portable-atomic-util/README.md +++ b/portable-atomic-util/README.md @@ -5,7 +5,6 @@ [![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license) [![msrv](https://img.shields.io/badge/msrv-1.34-blue?style=flat-square&logo=rust)](https://www.rust-lang.org) [![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/portable-atomic/ci.yml?branch=main&style=flat-square&logo=github)](https://github.com/taiki-e/portable-atomic/actions) -[![cirrus ci](https://img.shields.io/cirrus/github/taiki-e/portable-atomic/main?style=flat-square&logo=cirrusci)](https://cirrus-ci.com/github/taiki-e/portable-atomic) Synchronization primitives built with [portable-atomic].