From 9b331316963e14c249570f5be9a65bb3269c41fd Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 5 Jun 2023 17:02:36 -0600 Subject: [PATCH 1/2] Fix CI with the latest Rustup The latest Rustup does not allow the toolchain specification to be blank, which we were using. Fix it by ensuring that only one toolchain is ever installed in a given task, so we won't need to use the +$TOOLCHAIN with cargo. --- .cirrus.yml | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 1ffe4611f4..f3624f4bde 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -8,29 +8,28 @@ env: RUSTFLAGS: -D warnings RUSTDOCFLAGS: -D warnings TOOL: cargo - # The MSRV - TOOLCHAIN: 1.63.0 + MSRV: 1.63.0 ZFLAGS: # Tests that don't require executing the build binaries build: &BUILD build_script: - . $HOME/.cargo/env || true - - $TOOL +$TOOLCHAIN -Vv - - rustc +$TOOLCHAIN -Vv - - $TOOL +$TOOLCHAIN $BUILD $ZFLAGS --target $TARGET --all-targets - - $TOOL +$TOOLCHAIN doc $ZFLAGS --no-deps --target $TARGET - - $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET --all-targets -- -D warnings + - $TOOL -Vv + - rustc -Vv + - $TOOL $BUILD $ZFLAGS --target $TARGET --all-targets + - $TOOL doc $ZFLAGS --no-deps --target $TARGET + - $TOOL clippy $ZFLAGS --target $TARGET --all-targets -- -D warnings - if [ -z "$NOHACK" ]; then mkdir -p $HOME/.cargo/bin; export PATH=$HOME/.cargo/bin:$PATH; fi - if [ -z "$NOHACK" ]; then curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${HOST:-$TARGET}.tar.gz | tar xzf - -C ~/.cargo/bin; fi - - if [ -z "$NOHACK" ]; then $TOOL +$TOOLCHAIN hack $ZFLAGS check --target $TARGET --each-feature; fi + - if [ -z "$NOHACK" ]; then $TOOL hack $ZFLAGS check --target $TARGET --each-feature; fi # Tests that do require executing the binaries test: &TEST << : *BUILD test_script: - . $HOME/.cargo/env || true - - $TOOL +$TOOLCHAIN test --target $TARGET + - $TOOL test --target $TARGET # Test FreeBSD in a full VM. Test the i686 target too, in the # same VM. The binary will be built in 32-bit mode, but will execute on a @@ -52,10 +51,10 @@ task: setup_script: - kldload mqueuefs - fetch https://sh.rustup.rs -o rustup.sh - - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN + - sh rustup.sh -y --profile=minimal --default-toolchain $MSRV - . $HOME/.cargo/env - rustup target add i686-unknown-freebsd - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *TEST i386_test_script: - . $HOME/.cargo/env @@ -76,9 +75,9 @@ task: image: ghcr.io/cirruslabs/macos-ventura-base:latest setup_script: - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs - - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN + - sh rustup.sh -y --profile=minimal --default-toolchain $MSRV - . $HOME/.cargo/env - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index @@ -129,7 +128,7 @@ task: setup_script: - mkdir /tmp/home - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs - - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN + - sh rustup.sh -y --profile=minimal --default-toolchain $MSRV - . $HOME/.cargo/env - cargo install cross --version 0.2.1 # cross 0.2.2 bumped the MSRV to 1.58.1 << : *TEST @@ -165,9 +164,7 @@ task: image: rust:latest env: TARGET: x86_64-unknown-linux-gnu - TOOLCHAIN: setup_script: - - rustup target add $TARGET - rustup component add clippy << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index @@ -242,37 +239,33 @@ task: TARGET: x86_64-unknown-netbsd setup_script: - rustup target add $TARGET - - rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index task: container: - image: rust:1.63.0 + # Redox's MSRV policy is unclear. Until they define it, use nightly. + image: rustlang/rust:nightly env: BUILD: check name: Redox x86_64 env: HOST: x86_64-unknown-linux-gnu TARGET: x86_64-unknown-redox - # Redox's MSRV policy is unclear. Until they define it, use nightly. - TOOLCHAIN: nightly setup_script: - rustup target add $TARGET - - rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index -# Rust Tier 3 targets can't use Rustup +## Rust Tier 3 targets can't use Rustup task: container: image: rustlang/rust:nightly env: BUILD: check HOST: x86_64-unknown-linux-gnu - TOOLCHAIN: nightly ZFLAGS: -Zbuild-std matrix: - name: DragonFly BSD x86_64 @@ -299,7 +292,6 @@ task: name: Minver env: HOST: x86_64-unknown-linux-gnu - TOOLCHAIN: nightly container: image: rustlang/rust:nightly setup_script: @@ -313,5 +305,5 @@ task: name: Rust Formatter container: image: rust:latest - setup_script: rustup +$TOOLCHAIN component add rustfmt - test_script: $TOOL +$TOOLCHAIN fmt --all -- --check **/*.rs + setup_script: rustup component add rustfmt + test_script: cargo fmt --all -- --check **/*.rs From 57cdbed0ab9077e33d48c1b7a6f44b5cc0e67cbd Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sat, 3 Jun 2023 09:31:07 -0400 Subject: [PATCH 2/2] Clippy cleanup: fix the new clippy::non-minimal-cfg lint --- src/sys/event.rs | 4 ++-- test/sys/test_socket.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sys/event.rs b/src/sys/event.rs index 5dcf121ae2..58e48c91d9 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -86,7 +86,7 @@ impl Kqueue { target_os = "openbsd" ))] type type_of_udata = *mut libc::c_void; -#[cfg(any(target_os = "netbsd"))] +#[cfg(target_os = "netbsd")] type type_of_udata = intptr_t; #[cfg(target_os = "netbsd")] @@ -171,7 +171,7 @@ libc_enum! { ))] #[doc(hidden)] pub type type_of_event_flag = u16; -#[cfg(any(target_os = "netbsd"))] +#[cfg(target_os = "netbsd")] #[doc(hidden)] pub type type_of_event_flag = u32; libc_bitflags! { diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 0a8d0544cb..9fb7e89a57 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -10,7 +10,7 @@ use std::path::Path; use std::slice; use std::str::FromStr; -#[cfg(any(target_os = "linux"))] +#[cfg(target_os = "linux")] #[cfg_attr(qemu, ignore)] #[test] pub fn test_timestamping() { @@ -2082,7 +2082,7 @@ pub fn test_vsock() { // Disable the test on emulated platforms because it fails in Cirrus-CI. Lack // of QEMU support is suspected. #[cfg_attr(qemu, ignore)] -#[cfg(all(target_os = "linux"))] +#[cfg(target_os = "linux")] #[test] fn test_recvmsg_timestampns() { use nix::sys::socket::*; @@ -2137,7 +2137,7 @@ fn test_recvmsg_timestampns() { // Disable the test on emulated platforms because it fails in Cirrus-CI. Lack // of QEMU support is suspected. #[cfg_attr(qemu, ignore)] -#[cfg(all(target_os = "linux"))] +#[cfg(target_os = "linux")] #[test] fn test_recvmmsg_timestampns() { use nix::sys::socket::*;