Skip to content

Commit

Permalink
ci: use --feature-powerset --depth 2 in features check (#5007)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
taiki-e committed Sep 13, 2022
1 parent 0fddb76 commit b891714
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

4 changes: 2 additions & 2 deletions tokio/src/process/unix/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion tokio/src/runtime/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}
}
Expand All @@ -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(),
Expand Down
8 changes: 2 additions & 6 deletions tokio/src/runtime/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/signal/unix/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b891714

Please sign in to comment.