From 24345a78cc33fbe03961295ec5588c641a87c335 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 5 May 2024 19:46:54 +0800 Subject: [PATCH 1/7] refactor: correct wrong cfg value && remove ones that do not exist --- build.rs | 11 +++++++++++ src/sys/signal.rs | 2 +- test/sys/test_signal.rs | 2 +- test/test.rs | 2 +- test/test_fcntl.rs | 4 ---- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index 70adacbd1f..226a32cccb 100644 --- a/build.rs +++ b/build.rs @@ -26,4 +26,15 @@ fn main() { netbsdlike: { any(netbsd, openbsd) }, solarish: { any(illumos, solaris) }, } + + // Below are Nix's custom cfg values that we need to let the compiler know + println!("cargo:rustc-check-cfg=cfg(apple_targets)"); + println!("cargo:rustc-check-cfg=cfg(bsd)"); + println!("cargo:rustc-check-cfg=cfg(bsd_without_apple)"); + println!("cargo:rustc-check-cfg=cfg(linux_android)"); + println!("cargo:rustc-check-cfg=cfg(freebsdlike)"); + println!("cargo:rustc-check-cfg=cfg(netbsdlike)"); + println!("cargo:rustc-check-cfg=cfg(solarish)"); + println!("cargo:rustc-check-cfg=cfg(fbsd14)"); + println!("cargo:rustc-check-cfg=cfg(qemu)"); } diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 2a9c0027a9..8f41127e27 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -597,7 +597,7 @@ impl SigSet { target_os = "haiku", target_os = "hurd", target_os = "aix", - target_os = "fushsia" + target_os = "fuchsia" ))] #[doc(alias("sigsuspend"))] pub fn suspend(&self) -> Result<()> { diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs index 7494b71234..cd4bc3d9b9 100644 --- a/test/sys/test_signal.rs +++ b/test/sys/test_signal.rs @@ -350,7 +350,7 @@ fn test_sigwait() { target_os = "haiku", target_os = "hurd", target_os = "aix", - target_os = "fushsia" + target_os = "fuchsia" ))] #[test] fn test_sigsuspend() { diff --git a/test/test.rs b/test/test.rs index 4e0ffc8f9a..c2bcb4723e 100644 --- a/test/test.rs +++ b/test/test.rs @@ -15,7 +15,7 @@ mod test_fcntl; mod test_kmod; #[cfg(any( freebsdlike, - target_os = "fushsia", + target_os = "fuchsia", target_os = "linux", target_os = "netbsd" ))] diff --git a/test/test_fcntl.rs b/test/test_fcntl.rs index 1d05b1e250..2131f46c5c 100644 --- a/test/test_fcntl.rs +++ b/test/test_fcntl.rs @@ -13,7 +13,6 @@ use nix::fcntl::{openat2, OpenHow, ResolveFlag}; target_env = "gnu", any( target_arch = "x86_64", - target_arch = "x32", target_arch = "powerpc", target_arch = "s390x" ) @@ -146,7 +145,6 @@ fn test_renameat() { target_env = "gnu", any( target_arch = "x86_64", - target_arch = "x32", target_arch = "powerpc", target_arch = "s390x" ) @@ -190,7 +188,6 @@ fn test_renameat2_behaves_like_renameat_with_no_flags() { target_env = "gnu", any( target_arch = "x86_64", - target_arch = "x32", target_arch = "powerpc", target_arch = "s390x" ) @@ -238,7 +235,6 @@ fn test_renameat2_exchange() { target_env = "gnu", any( target_arch = "x86_64", - target_arch = "x32", target_arch = "powerpc", target_arch = "s390x" ) From 9db99d55826a21bb8ed889f67bb46ad0f40ae239 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 5 May 2024 20:09:51 +0800 Subject: [PATCH 2/7] debug ci --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a56e7d2b7..5c14d6ef19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,7 +162,10 @@ jobs: TARGET: '${{ matrix.TARGET }}' - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index + run: | + id; + tree -uga ~/.cargo/registry/index | head -n 100; + rm -rf $CARGO_HOME/registry/index; rust_stable: runs-on: ubuntu-20.04 From 45ad2f5bc35f7ec9b026dd4eba3d0a20235925d0 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 5 May 2024 20:24:14 +0800 Subject: [PATCH 3/7] debug ci --- .github/workflows/ci.yml | 605 ++++++++++++++++++++------------------- 1 file changed, 303 insertions(+), 302 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c14d6ef19..08df117253 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,113 +16,113 @@ env: MSRV: 1.69.0 jobs: - macos: - runs-on: macos-13 - env: - TARGET: x86_64-apple-darwin - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: '${{ env.MSRV }}' - components: clippy - - - name: build - uses: ./.github/actions/build - with: - TARGET: '${{ env.TARGET }}' - - - name: test - uses: ./.github/actions/test - with: - TARGET: '${{ env.TARGET }}' - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index - - macos-aarch64: - runs-on: macos-14 - env: - TARGET: aarch64-apple-darwin - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: '${{ env.MSRV }}' - components: clippy - - - name: build - uses: ./.github/actions/build - with: - TARGET: "${{ env.TARGET }}" - - - name: test - uses: ./.github/actions/test - with: - TARGET: "${{ env.TARGET }}" - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index - - # Use cross for QEMU-based testing - # cross needs to execute Docker, GitHub Action already has it installed - cross: - runs-on: ubuntu-20.04 - needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] - strategy: - fail-fast: false - matrix: - target: [ - arm-unknown-linux-gnueabi, - armv7-unknown-linux-gnueabihf, - i686-unknown-linux-gnu, - i686-unknown-linux-musl, - mips-unknown-linux-gnu, - mips64-unknown-linux-gnuabi64, - mips64el-unknown-linux-gnuabi64, - mipsel-unknown-linux-gnu, - powerpc64le-unknown-linux-gnu, - ] - - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: '${{ env.MSRV }}' - components: clippy - - # cross relies on docker or podman, GitHub Acton already has it installed. - - name: Set up cross - uses: taiki-e/install-action@v2 - with: - tool: cross@0.2.5 - - - name: build - uses: ./.github/actions/build - with: - TARGET: '${{ matrix.target }}' - TOOL: cross - RUSTFLAGS: --cfg qemu -D warnings - - - name: test - uses: ./.github/actions/test - with: - TARGET: '${{ matrix.target }}' - SUDO: "" - TOOL: cross - RUSTFLAGS: --cfg qemu -D warnings - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index + # macos: + # runs-on: macos-13 + # env: + # TARGET: x86_64-apple-darwin + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # uses: dtolnay/rust-toolchain@master + # with: + # toolchain: '${{ env.MSRV }}' + # components: clippy + + # - name: build + # uses: ./.github/actions/build + # with: + # TARGET: '${{ env.TARGET }}' + + # - name: test + # uses: ./.github/actions/test + # with: + # TARGET: '${{ env.TARGET }}' + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index + + # macos-aarch64: + # runs-on: macos-14 + # env: + # TARGET: aarch64-apple-darwin + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # uses: dtolnay/rust-toolchain@master + # with: + # toolchain: '${{ env.MSRV }}' + # components: clippy + + # - name: build + # uses: ./.github/actions/build + # with: + # TARGET: "${{ env.TARGET }}" + + # - name: test + # uses: ./.github/actions/test + # with: + # TARGET: "${{ env.TARGET }}" + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index + + # # Use cross for QEMU-based testing + # # cross needs to execute Docker, GitHub Action already has it installed + # cross: + # runs-on: ubuntu-20.04 + # needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] + # strategy: + # fail-fast: false + # matrix: + # target: [ + # arm-unknown-linux-gnueabi, + # armv7-unknown-linux-gnueabihf, + # i686-unknown-linux-gnu, + # i686-unknown-linux-musl, + # mips-unknown-linux-gnu, + # mips64-unknown-linux-gnuabi64, + # mips64el-unknown-linux-gnuabi64, + # mipsel-unknown-linux-gnu, + # powerpc64le-unknown-linux-gnu, + # ] + + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # uses: dtolnay/rust-toolchain@master + # with: + # toolchain: '${{ env.MSRV }}' + # components: clippy + + # # cross relies on docker or podman, GitHub Acton already has it installed. + # - name: Set up cross + # uses: taiki-e/install-action@v2 + # with: + # tool: cross@0.2.5 + + # - name: build + # uses: ./.github/actions/build + # with: + # TARGET: '${{ matrix.target }}' + # TOOL: cross + # RUSTFLAGS: --cfg qemu -D warnings + + # - name: test + # uses: ./.github/actions/test + # with: + # TARGET: '${{ matrix.target }}' + # SUDO: "" + # TOOL: cross + # RUSTFLAGS: --cfg qemu -D warnings + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index @@ -135,7 +135,7 @@ jobs: matrix: target: [ x86_64-unknown-linux-gnu, - x86_64-unknown-linux-musl, + # x86_64-unknown-linux-musl, ] steps: @@ -165,206 +165,207 @@ jobs: run: | id; tree -uga ~/.cargo/registry/index | head -n 100; + /usr/bin/ls -al ~/.cargo/registry/index/github.com-1ecc6299db9ec823/.cache |head -n 10; rm -rf $CARGO_HOME/registry/index; - rust_stable: - runs-on: ubuntu-20.04 - env: - TARGET: x86_64-unknown-linux-gnu - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - uses: dtolnay/rust-toolchain@stable - with: - components: clippy - - - name: build - uses: ./.github/actions/build - with: - TARGET: '${{ env.TARGET }}' - - - name: test - uses: ./.github/actions/test - with: - TARGET: '${{ env.TARGET }}' - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index - - - - # Tasks for cross-compiling, but no testing - cross_compiling: - runs-on: ubuntu-20.04 - needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] - env: - BUILD: check - strategy: - fail-fast: false - matrix: - include: - # Cross claims to support Android, but when it tries to run Nix's tests it - # reports undefined symbol references. - - target: aarch64-linux-android - - target: arm-linux-androideabi - - target: armv7-linux-androideabi - - target: i686-linux-android - - target: x86_64-linux-android - - target: arm-unknown-linux-musleabi - - target: x86_64-unknown-fuchsia - - target: x86_64-unknown-illumos - # Cross claims to support running tests on iOS, but it actually doesn't. - # https://github.com/rust-embedded/cross/issues/535 - - target: aarch64-apple-ios - # cargo hack tries to invoke the iphonesimulator SDK for iOS - NOHACK: true - # Cross claims to support Linux powerpc64, but it really doesn't. - # https://github.com/rust-embedded/cross/issues/441 - - target: powerpc64-unknown-linux-gnu - - target: s390x-unknown-linux-gnu - - target: x86_64-unknown-linux-gnux32 - - target: x86_64-unknown-netbsd - - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: '${{ env.MSRV }}' - components: clippy - - - name: install targets - run: rustup target add ${{ matrix.target }} - - - name: build - uses: ./.github/actions/build - with: - TARGET: '${{ matrix.target }}' - BUILD: '${{ env.BUILD }}' - NOHACK: '${{ matrix.NOHACK }}' - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index + # rust_stable: + # runs-on: ubuntu-20.04 + # env: + # TARGET: x86_64-unknown-linux-gnu + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # uses: dtolnay/rust-toolchain@stable + # with: + # components: clippy + + # - name: build + # uses: ./.github/actions/build + # with: + # TARGET: '${{ env.TARGET }}' + + # - name: test + # uses: ./.github/actions/test + # with: + # TARGET: '${{ env.TARGET }}' + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index + + + + # # Tasks for cross-compiling, but no testing + # cross_compiling: + # runs-on: ubuntu-20.04 + # needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] + # env: + # BUILD: check + # strategy: + # fail-fast: false + # matrix: + # include: + # # Cross claims to support Android, but when it tries to run Nix's tests it + # # reports undefined symbol references. + # - target: aarch64-linux-android + # - target: arm-linux-androideabi + # - target: armv7-linux-androideabi + # - target: i686-linux-android + # - target: x86_64-linux-android + # - target: arm-unknown-linux-musleabi + # - target: x86_64-unknown-fuchsia + # - target: x86_64-unknown-illumos + # # Cross claims to support running tests on iOS, but it actually doesn't. + # # https://github.com/rust-embedded/cross/issues/535 + # - target: aarch64-apple-ios + # # cargo hack tries to invoke the iphonesimulator SDK for iOS + # NOHACK: true + # # Cross claims to support Linux powerpc64, but it really doesn't. + # # https://github.com/rust-embedded/cross/issues/441 + # - target: powerpc64-unknown-linux-gnu + # - target: s390x-unknown-linux-gnu + # - target: x86_64-unknown-linux-gnux32 + # - target: x86_64-unknown-netbsd + + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # uses: dtolnay/rust-toolchain@master + # with: + # toolchain: '${{ env.MSRV }}' + # components: clippy + + # - name: install targets + # run: rustup target add ${{ matrix.target }} + + # - name: build + # uses: ./.github/actions/build + # with: + # TARGET: '${{ matrix.target }}' + # BUILD: '${{ env.BUILD }}' + # NOHACK: '${{ matrix.NOHACK }}' + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index - redox: - runs-on: ubuntu-20.04 - needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] - env: - TARGET: x86_64-unknown-redox - CLIPPYFLAGS: -D warnings - BUILD: check - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - # Redox's MSRV policy is unclear. Until they define it, use nightly. - uses: dtolnay/rust-toolchain@nightly - with: - components: clippy + # redox: + # runs-on: ubuntu-20.04 + # needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] + # env: + # TARGET: x86_64-unknown-redox + # CLIPPYFLAGS: -D warnings + # BUILD: check + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # # Redox's MSRV policy is unclear. Until they define it, use nightly. + # uses: dtolnay/rust-toolchain@nightly + # with: + # components: clippy - - name: install targets - run: rustup target add ${{ env.TARGET }} - - - name: build - uses: ./.github/actions/build - with: - TARGET: '${{ env.TARGET }}' - BUILD: '${{ env.BUILD }}' - CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index + # - name: install targets + # run: rustup target add ${{ env.TARGET }} + + # - name: build + # uses: ./.github/actions/build + # with: + # TARGET: '${{ env.TARGET }}' + # BUILD: '${{ env.BUILD }}' + # CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index - # Rust Tier 3 targets can't use Rustup - tier3: - runs-on: ubuntu-20.04 - env: - BUILD: check - ZFLAGS: -Zbuild-std - CLIPPYFLAGS: -D warnings - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-unknown-dragonfly - - target: x86_64-unknown-openbsd - # Temporarily disable armv7-unknown-linux-uclibceabihf - # https://github.com/nix-rust/nix/issues/2200 - #- target: armv7-unknown-linux-uclibceabihf - - target: x86_64-unknown-haiku - # Disable hurd due to - # https://github.com/nix-rust/nix/issues/2306 - # - target: i686-unknown-hurd-gnu - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - uses: dtolnay/rust-toolchain@nightly - with: - components: clippy - - - name: install src - run: rustup component add rust-src - - - name: build - uses: ./.github/actions/build - with: - TARGET: '${{ matrix.target }}' - BUILD: '${{ env.BUILD }}' - ZFLAGS: '${{ env.ZFLAGS }}' - CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index - - - # Test that we can build with the lowest version of all dependencies. - # "cargo test" doesn't work because some of our dev-dependencies, like - # rand, can't build with their own minimal dependencies. - minver: - runs-on: ubuntu-20.04 - env: - TARGET: x86_64-unknown-linux-gnu - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: setup Rust - uses: dtolnay/rust-toolchain@nightly - - - name: setup - run: cargo update -Zminimal-versions - - - name: check - run: cargo check - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index - - # Tasks that checks if the code is formatted right using `cargo fmt` tool - rustfmt: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt - - - name: Check format - run: cargo fmt --all -- --check **/*.rs - - - name: before_cache_script - run: rm -rf $CARGO_HOME/registry/index + # # Rust Tier 3 targets can't use Rustup + # tier3: + # runs-on: ubuntu-20.04 + # env: + # BUILD: check + # ZFLAGS: -Zbuild-std + # CLIPPYFLAGS: -D warnings + # strategy: + # fail-fast: false + # matrix: + # include: + # - target: x86_64-unknown-dragonfly + # - target: x86_64-unknown-openbsd + # # Temporarily disable armv7-unknown-linux-uclibceabihf + # # https://github.com/nix-rust/nix/issues/2200 + # #- target: armv7-unknown-linux-uclibceabihf + # - target: x86_64-unknown-haiku + # # Disable hurd due to + # # https://github.com/nix-rust/nix/issues/2306 + # # - target: i686-unknown-hurd-gnu + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # uses: dtolnay/rust-toolchain@nightly + # with: + # components: clippy + + # - name: install src + # run: rustup component add rust-src + + # - name: build + # uses: ./.github/actions/build + # with: + # TARGET: '${{ matrix.target }}' + # BUILD: '${{ env.BUILD }}' + # ZFLAGS: '${{ env.ZFLAGS }}' + # CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index + + + # # Test that we can build with the lowest version of all dependencies. + # # "cargo test" doesn't work because some of our dev-dependencies, like + # # rand, can't build with their own minimal dependencies. + # minver: + # runs-on: ubuntu-20.04 + # env: + # TARGET: x86_64-unknown-linux-gnu + # steps: + # - name: checkout + # uses: actions/checkout@v4 + + # - name: setup Rust + # uses: dtolnay/rust-toolchain@nightly + + # - name: setup + # run: cargo update -Zminimal-versions + + # - name: check + # run: cargo check + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index + + # # Tasks that checks if the code is formatted right using `cargo fmt` tool + # rustfmt: + # runs-on: ubuntu-20.04 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Setup Rust + # uses: dtolnay/rust-toolchain@stable + # with: + # components: rustfmt + + # - name: Check format + # run: cargo fmt --all -- --check **/*.rs + + # - name: before_cache_script + # run: rm -rf $CARGO_HOME/registry/index From 3476c66ccd64bdf4d0fad52878d42d8904377f3a Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 5 May 2024 20:41:48 +0800 Subject: [PATCH 4/7] debug ci --- .github/workflows/ci.yml | 610 +++++++++++++++++++-------------------- 1 file changed, 303 insertions(+), 307 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08df117253..0271c5e1cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,113 +16,113 @@ env: MSRV: 1.69.0 jobs: - # macos: - # runs-on: macos-13 - # env: - # TARGET: x86_64-apple-darwin - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # uses: dtolnay/rust-toolchain@master - # with: - # toolchain: '${{ env.MSRV }}' - # components: clippy - - # - name: build - # uses: ./.github/actions/build - # with: - # TARGET: '${{ env.TARGET }}' - - # - name: test - # uses: ./.github/actions/test - # with: - # TARGET: '${{ env.TARGET }}' - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index - - # macos-aarch64: - # runs-on: macos-14 - # env: - # TARGET: aarch64-apple-darwin - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # uses: dtolnay/rust-toolchain@master - # with: - # toolchain: '${{ env.MSRV }}' - # components: clippy - - # - name: build - # uses: ./.github/actions/build - # with: - # TARGET: "${{ env.TARGET }}" - - # - name: test - # uses: ./.github/actions/test - # with: - # TARGET: "${{ env.TARGET }}" - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index - - # # Use cross for QEMU-based testing - # # cross needs to execute Docker, GitHub Action already has it installed - # cross: - # runs-on: ubuntu-20.04 - # needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] - # strategy: - # fail-fast: false - # matrix: - # target: [ - # arm-unknown-linux-gnueabi, - # armv7-unknown-linux-gnueabihf, - # i686-unknown-linux-gnu, - # i686-unknown-linux-musl, - # mips-unknown-linux-gnu, - # mips64-unknown-linux-gnuabi64, - # mips64el-unknown-linux-gnuabi64, - # mipsel-unknown-linux-gnu, - # powerpc64le-unknown-linux-gnu, - # ] - - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # uses: dtolnay/rust-toolchain@master - # with: - # toolchain: '${{ env.MSRV }}' - # components: clippy - - # # cross relies on docker or podman, GitHub Acton already has it installed. - # - name: Set up cross - # uses: taiki-e/install-action@v2 - # with: - # tool: cross@0.2.5 - - # - name: build - # uses: ./.github/actions/build - # with: - # TARGET: '${{ matrix.target }}' - # TOOL: cross - # RUSTFLAGS: --cfg qemu -D warnings - - # - name: test - # uses: ./.github/actions/test - # with: - # TARGET: '${{ matrix.target }}' - # SUDO: "" - # TOOL: cross - # RUSTFLAGS: --cfg qemu -D warnings - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index + macos: + runs-on: macos-13 + env: + TARGET: x86_64-apple-darwin + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: '${{ env.MSRV }}' + components: clippy + + - name: build + uses: ./.github/actions/build + with: + TARGET: '${{ env.TARGET }}' + + - name: test + uses: ./.github/actions/test + with: + TARGET: '${{ env.TARGET }}' + + - name: before_cache_script + run: sudo rm -rf $CARGO_HOME/registry/index + + macos-aarch64: + runs-on: macos-14 + env: + TARGET: aarch64-apple-darwin + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: '${{ env.MSRV }}' + components: clippy + + - name: build + uses: ./.github/actions/build + with: + TARGET: "${{ env.TARGET }}" + + - name: test + uses: ./.github/actions/test + with: + TARGET: "${{ env.TARGET }}" + + - name: before_cache_script + run: sudo rm -rf $CARGO_HOME/registry/index + + # Use cross for QEMU-based testing + # cross needs to execute Docker, GitHub Action already has it installed + cross: + runs-on: ubuntu-20.04 + needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] + strategy: + fail-fast: false + matrix: + target: [ + arm-unknown-linux-gnueabi, + armv7-unknown-linux-gnueabihf, + i686-unknown-linux-gnu, + i686-unknown-linux-musl, + mips-unknown-linux-gnu, + mips64-unknown-linux-gnuabi64, + mips64el-unknown-linux-gnuabi64, + mipsel-unknown-linux-gnu, + powerpc64le-unknown-linux-gnu, + ] + + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: '${{ env.MSRV }}' + components: clippy + + # cross relies on docker or podman, GitHub Acton already has it installed. + - name: Set up cross + uses: taiki-e/install-action@v2 + with: + tool: cross@0.2.5 + + - name: build + uses: ./.github/actions/build + with: + TARGET: '${{ matrix.target }}' + TOOL: cross + RUSTFLAGS: --cfg qemu -D warnings + + - name: test + uses: ./.github/actions/test + with: + TARGET: '${{ matrix.target }}' + SUDO: "" + TOOL: cross + RUSTFLAGS: --cfg qemu -D warnings + + - name: before_cache_script + run: rm -rf $CARGO_HOME/registry/index @@ -162,210 +162,206 @@ jobs: TARGET: '${{ matrix.TARGET }}' - name: before_cache_script - run: | - id; - tree -uga ~/.cargo/registry/index | head -n 100; - /usr/bin/ls -al ~/.cargo/registry/index/github.com-1ecc6299db9ec823/.cache |head -n 10; - rm -rf $CARGO_HOME/registry/index; - - # rust_stable: - # runs-on: ubuntu-20.04 - # env: - # TARGET: x86_64-unknown-linux-gnu - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # uses: dtolnay/rust-toolchain@stable - # with: - # components: clippy - - # - name: build - # uses: ./.github/actions/build - # with: - # TARGET: '${{ env.TARGET }}' - - # - name: test - # uses: ./.github/actions/test - # with: - # TARGET: '${{ env.TARGET }}' - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index - - - - # # Tasks for cross-compiling, but no testing - # cross_compiling: - # runs-on: ubuntu-20.04 - # needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] - # env: - # BUILD: check - # strategy: - # fail-fast: false - # matrix: - # include: - # # Cross claims to support Android, but when it tries to run Nix's tests it - # # reports undefined symbol references. - # - target: aarch64-linux-android - # - target: arm-linux-androideabi - # - target: armv7-linux-androideabi - # - target: i686-linux-android - # - target: x86_64-linux-android - # - target: arm-unknown-linux-musleabi - # - target: x86_64-unknown-fuchsia - # - target: x86_64-unknown-illumos - # # Cross claims to support running tests on iOS, but it actually doesn't. - # # https://github.com/rust-embedded/cross/issues/535 - # - target: aarch64-apple-ios - # # cargo hack tries to invoke the iphonesimulator SDK for iOS - # NOHACK: true - # # Cross claims to support Linux powerpc64, but it really doesn't. - # # https://github.com/rust-embedded/cross/issues/441 - # - target: powerpc64-unknown-linux-gnu - # - target: s390x-unknown-linux-gnu - # - target: x86_64-unknown-linux-gnux32 - # - target: x86_64-unknown-netbsd - - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # uses: dtolnay/rust-toolchain@master - # with: - # toolchain: '${{ env.MSRV }}' - # components: clippy - - # - name: install targets - # run: rustup target add ${{ matrix.target }} - - # - name: build - # uses: ./.github/actions/build - # with: - # TARGET: '${{ matrix.target }}' - # BUILD: '${{ env.BUILD }}' - # NOHACK: '${{ matrix.NOHACK }}' - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index + run: sudo rm -rf $CARGO_HOME/registry/index; + + rust_stable: + runs-on: ubuntu-20.04 + env: + TARGET: x86_64-unknown-linux-gnu + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: build + uses: ./.github/actions/build + with: + TARGET: '${{ env.TARGET }}' + + - name: test + uses: ./.github/actions/test + with: + TARGET: '${{ env.TARGET }}' + + - name: before_cache_script + run: sudo rm -rf $CARGO_HOME/registry/index + + + + # Tasks for cross-compiling, but no testing + cross_compiling: + runs-on: ubuntu-20.04 + needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] + env: + BUILD: check + strategy: + fail-fast: false + matrix: + include: + # Cross claims to support Android, but when it tries to run Nix's tests it + # reports undefined symbol references. + - target: aarch64-linux-android + - target: arm-linux-androideabi + - target: armv7-linux-androideabi + - target: i686-linux-android + - target: x86_64-linux-android + - target: arm-unknown-linux-musleabi + - target: x86_64-unknown-fuchsia + - target: x86_64-unknown-illumos + # Cross claims to support running tests on iOS, but it actually doesn't. + # https://github.com/rust-embedded/cross/issues/535 + - target: aarch64-apple-ios + # cargo hack tries to invoke the iphonesimulator SDK for iOS + NOHACK: true + # Cross claims to support Linux powerpc64, but it really doesn't. + # https://github.com/rust-embedded/cross/issues/441 + - target: powerpc64-unknown-linux-gnu + - target: s390x-unknown-linux-gnu + - target: x86_64-unknown-linux-gnux32 + - target: x86_64-unknown-netbsd + + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: '${{ env.MSRV }}' + components: clippy + + - name: install targets + run: rustup target add ${{ matrix.target }} + + - name: build + uses: ./.github/actions/build + with: + TARGET: '${{ matrix.target }}' + BUILD: '${{ env.BUILD }}' + NOHACK: '${{ matrix.NOHACK }}' + + - name: before_cache_script + run: rm -rf $CARGO_HOME/registry/index - # redox: - # runs-on: ubuntu-20.04 - # needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] - # env: - # TARGET: x86_64-unknown-redox - # CLIPPYFLAGS: -D warnings - # BUILD: check - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # # Redox's MSRV policy is unclear. Until they define it, use nightly. - # uses: dtolnay/rust-toolchain@nightly - # with: - # components: clippy + redox: + runs-on: ubuntu-20.04 + needs: [rustfmt, minver, macos, linux_native_builds, rust_stable] + env: + TARGET: x86_64-unknown-redox + CLIPPYFLAGS: -D warnings + BUILD: check + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + # Redox's MSRV policy is unclear. Until they define it, use nightly. + uses: dtolnay/rust-toolchain@nightly + with: + components: clippy - # - name: install targets - # run: rustup target add ${{ env.TARGET }} - - # - name: build - # uses: ./.github/actions/build - # with: - # TARGET: '${{ env.TARGET }}' - # BUILD: '${{ env.BUILD }}' - # CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index + - name: install targets + run: rustup target add ${{ env.TARGET }} + + - name: build + uses: ./.github/actions/build + with: + TARGET: '${{ env.TARGET }}' + BUILD: '${{ env.BUILD }}' + CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' + + - name: before_cache_script + run: rm -rf $CARGO_HOME/registry/index - # # Rust Tier 3 targets can't use Rustup - # tier3: - # runs-on: ubuntu-20.04 - # env: - # BUILD: check - # ZFLAGS: -Zbuild-std - # CLIPPYFLAGS: -D warnings - # strategy: - # fail-fast: false - # matrix: - # include: - # - target: x86_64-unknown-dragonfly - # - target: x86_64-unknown-openbsd - # # Temporarily disable armv7-unknown-linux-uclibceabihf - # # https://github.com/nix-rust/nix/issues/2200 - # #- target: armv7-unknown-linux-uclibceabihf - # - target: x86_64-unknown-haiku - # # Disable hurd due to - # # https://github.com/nix-rust/nix/issues/2306 - # # - target: i686-unknown-hurd-gnu - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # uses: dtolnay/rust-toolchain@nightly - # with: - # components: clippy - - # - name: install src - # run: rustup component add rust-src - - # - name: build - # uses: ./.github/actions/build - # with: - # TARGET: '${{ matrix.target }}' - # BUILD: '${{ env.BUILD }}' - # ZFLAGS: '${{ env.ZFLAGS }}' - # CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index - - - # # Test that we can build with the lowest version of all dependencies. - # # "cargo test" doesn't work because some of our dev-dependencies, like - # # rand, can't build with their own minimal dependencies. - # minver: - # runs-on: ubuntu-20.04 - # env: - # TARGET: x86_64-unknown-linux-gnu - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: setup Rust - # uses: dtolnay/rust-toolchain@nightly - - # - name: setup - # run: cargo update -Zminimal-versions - - # - name: check - # run: cargo check - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index - - # # Tasks that checks if the code is formatted right using `cargo fmt` tool - # rustfmt: - # runs-on: ubuntu-20.04 - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - - # - name: Setup Rust - # uses: dtolnay/rust-toolchain@stable - # with: - # components: rustfmt - - # - name: Check format - # run: cargo fmt --all -- --check **/*.rs - - # - name: before_cache_script - # run: rm -rf $CARGO_HOME/registry/index + # Rust Tier 3 targets can't use Rustup + tier3: + runs-on: ubuntu-20.04 + env: + BUILD: check + ZFLAGS: -Zbuild-std + CLIPPYFLAGS: -D warnings + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-dragonfly + - target: x86_64-unknown-openbsd + # Temporarily disable armv7-unknown-linux-uclibceabihf + # https://github.com/nix-rust/nix/issues/2200 + #- target: armv7-unknown-linux-uclibceabihf + - target: x86_64-unknown-haiku + # Disable hurd due to + # https://github.com/nix-rust/nix/issues/2306 + # - target: i686-unknown-hurd-gnu + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + uses: dtolnay/rust-toolchain@nightly + with: + components: clippy + + - name: install src + run: rustup component add rust-src + + - name: build + uses: ./.github/actions/build + with: + TARGET: '${{ matrix.target }}' + BUILD: '${{ env.BUILD }}' + ZFLAGS: '${{ env.ZFLAGS }}' + CLIPPYFLAGS: '${{ env.CLIPPYFLAGS }}' + + - name: before_cache_script + run: rm -rf $CARGO_HOME/registry/index + + + # Test that we can build with the lowest version of all dependencies. + # "cargo test" doesn't work because some of our dev-dependencies, like + # rand, can't build with their own minimal dependencies. + minver: + runs-on: ubuntu-20.04 + env: + TARGET: x86_64-unknown-linux-gnu + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Rust + uses: dtolnay/rust-toolchain@nightly + + - name: setup + run: cargo update -Zminimal-versions + + - name: check + run: cargo check + + - name: before_cache_script + run: rm -rf $CARGO_HOME/registry/index + + # Tasks that checks if the code is formatted right using `cargo fmt` tool + rustfmt: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Check format + run: cargo fmt --all -- --check **/*.rs + + - name: before_cache_script + run: rm -rf $CARGO_HOME/registry/index From e2aa6ff7d30ef3d236236e992a4426e583318c20 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 5 May 2024 20:42:36 +0800 Subject: [PATCH 5/7] debug ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0271c5e1cb..ed51548a7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -135,7 +135,7 @@ jobs: matrix: target: [ x86_64-unknown-linux-gnu, - # x86_64-unknown-linux-musl, + x86_64-unknown-linux-musl, ] steps: From 0ea13ede43e8370bbcd374f142af61d7c0dbf36e Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 5 May 2024 20:53:30 +0800 Subject: [PATCH 6/7] test: disable test_mq module for Fuchsia --- test/test.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test.rs b/test/test.rs index c2bcb4723e..068862b3e7 100644 --- a/test/test.rs +++ b/test/test.rs @@ -15,7 +15,6 @@ mod test_fcntl; mod test_kmod; #[cfg(any( freebsdlike, - target_os = "fuchsia", target_os = "linux", target_os = "netbsd" ))] From 55635f6bbc1837aacdfea1cf23edb5a64dab57b3 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 5 May 2024 20:54:38 +0800 Subject: [PATCH 7/7] style: fmt --- test/common/mod.rs | 4 ++-- test/test.rs | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/test/common/mod.rs b/test/common/mod.rs index db4aed2598..ab0e746367 100644 --- a/test/common/mod.rs +++ b/test/common/mod.rs @@ -37,8 +37,8 @@ cfg_if! { #[macro_export] macro_rules! require_mount { ($name:expr) => { - use ::sysctl::{CtlValue, Sysctl}; use nix::unistd::Uid; + use sysctl::{CtlValue, Sysctl}; let ctl = ::sysctl::Ctl::new("vfs.usermount").unwrap(); if !Uid::current().is_root() && CtlValue::Int(0) == ctl.value().unwrap() @@ -65,7 +65,7 @@ macro_rules! skip_if_cirrus { #[macro_export] macro_rules! skip_if_jailed { ($name:expr) => { - use ::sysctl::{CtlValue, Sysctl}; + use sysctl::{CtlValue, Sysctl}; let ctl = ::sysctl::Ctl::new("security.jail.jailed").unwrap(); if let CtlValue::Int(1) = ctl.value().unwrap() { diff --git a/test/test.rs b/test/test.rs index 068862b3e7..7401c95611 100644 --- a/test/test.rs +++ b/test/test.rs @@ -13,11 +13,7 @@ mod test_errno; mod test_fcntl; #[cfg(linux_android)] mod test_kmod; -#[cfg(any( - freebsdlike, - target_os = "linux", - target_os = "netbsd" -))] +#[cfg(any(freebsdlike, target_os = "linux", target_os = "netbsd"))] mod test_mq; #[cfg(not(target_os = "redox"))] mod test_net;