From b891714bdb3ff8a52c356bbaa0cddd9206f42cfd Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 14 Sep 2022 03:05:38 +0900 Subject: [PATCH] ci: use --feature-powerset --depth 2 in features check (#5007) As has been pointed out a few times in the past (e.g., #4036 (comment)), each-feature is not sufficient for features check. Ideally, we'd like to check all combinations of features, but there are too many combinations. So limit the max number of simultaneous feature flags to 2 by --depth option. I think this should be sufficient in most cases as @carllerche said in taiki-e/cargo-hack#58. --- .github/workflows/ci.yml | 21 +++++++++------------ tokio/src/process/unix/driver.rs | 4 ++-- tokio/src/runtime/driver.rs | 3 ++- tokio/src/runtime/io/mod.rs | 8 ++------ tokio/src/signal/unix/driver.rs | 4 ++-- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c3437d21..5d47b8693 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: run: rustup update stable - uses: Swatinem/rust-cache@v1 - name: Install cargo-hack - run: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack # Run `tokio` with `full` features. This excludes testing utilities which # can alter the runtime behavior of Tokio. @@ -279,14 +279,12 @@ jobs: override: true - uses: Swatinem/rust-cache@v1 - name: Install cargo-hack - run: cargo install cargo-hack - - name: check --each-feature - run: cargo hack check --all --each-feature -Z avoid-dev-deps - - name: check net,time - run: cargo check -p tokio --no-default-features --features net,time -Z avoid-dev-deps + uses: taiki-e/install-action@cargo-hack + - name: check --feature-powerset + run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going # Try with unstable feature flags - - name: check --each-feature --unstable - run: cargo hack check --all --each-feature -Z avoid-dev-deps + - name: check --feature-powerset --unstable + run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going env: RUSTFLAGS: --cfg tokio_unstable -Dwarnings @@ -316,7 +314,7 @@ jobs: override: true - uses: Swatinem/rust-cache@v1 - name: Install cargo-hack - run: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack - name: "check --all-features -Z minimal-versions" run: | # Remove dev-dependencies from Cargo.toml to prevent the next `cargo update` @@ -501,13 +499,13 @@ jobs: # Install dependencies - name: Install cargo-hack - run: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack - name: Install wasm32-wasi target run: rustup target add wasm32-wasi - name: Install wasmtime - run: cargo install wasmtime-cli + uses: taiki-e/install-action@wasmtime - name: Install cargo-wasi run: cargo install cargo-wasi @@ -557,4 +555,3 @@ jobs: cargo install cargo-check-external-types --locked --version 0.1.3 cargo check-external-types --all-features --config external-types.toml working-directory: tokio - diff --git a/tokio/src/process/unix/driver.rs b/tokio/src/process/unix/driver.rs index 2e1a36ade..5f9fdddfd 100644 --- a/tokio/src/process/unix/driver.rs +++ b/tokio/src/process/unix/driver.rs @@ -28,8 +28,8 @@ impl Driver { } } - pub(crate) fn handle(&self) -> Handle { - self.park.io_handle() + pub(crate) fn unpark(&self) -> Handle { + self.park.unpark() } pub(crate) fn park(&mut self) { diff --git a/tokio/src/runtime/driver.rs b/tokio/src/runtime/driver.rs index 172de7061..ac9b1a927 100644 --- a/tokio/src/runtime/driver.rs +++ b/tokio/src/runtime/driver.rs @@ -43,7 +43,7 @@ cfg_io_driver! { impl IoStack { pub(crate) fn unpark(&self) -> IoUnpark { match self { - IoStack::Enabled(v) => IoUnpark::Enabled(v.handle()), + IoStack::Enabled(v) => IoUnpark::Enabled(v.unpark()), IoStack::Disabled(v) => IoUnpark::Disabled(v.unpark()), } } @@ -62,6 +62,7 @@ cfg_io_driver! { } } + #[cfg_attr(not(feature = "rt-multi-thread"), allow(dead_code))] // some features use this pub(crate) fn shutdown(&mut self) { match self { IoStack::Enabled(v) => v.shutdown(), diff --git a/tokio/src/runtime/io/mod.rs b/tokio/src/runtime/io/mod.rs index ef335723b..22d84cbb6 100644 --- a/tokio/src/runtime/io/mod.rs +++ b/tokio/src/runtime/io/mod.rs @@ -145,12 +145,8 @@ impl Driver { } // TODO: remove this in a later refactor - cfg_not_rt! { - cfg_time! { - pub(crate) fn unpark(&self) -> Handle { - self.handle() - } - } + pub(crate) fn unpark(&self) -> Handle { + self.handle() } pub(crate) fn park(&mut self) { diff --git a/tokio/src/signal/unix/driver.rs b/tokio/src/signal/unix/driver.rs index e30519350..6192c8073 100644 --- a/tokio/src/signal/unix/driver.rs +++ b/tokio/src/signal/unix/driver.rs @@ -92,8 +92,8 @@ impl Driver { } } - pub(crate) fn io_handle(&self) -> io::Handle { - self.park.handle() + pub(crate) fn unpark(&self) -> io::Handle { + self.park.unpark() } pub(crate) fn park(&mut self) {