-
Notifications
You must be signed in to change notification settings - Fork 732
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tracing: add static level tests for spans and instrumented fns (#1872)
The current tests for the compile-time maximum level were not being run in `--release` mode, and did not previously assert anything about `Span`s. This also adds some test cases for various `#[instrument]`-ed functions.
- Loading branch information
Showing
4 changed files
with
236 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
name: Check Features | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- "v0.1.x" | ||
pull_request: {} | ||
|
||
env: | ||
# Disable incremental compilation. | ||
# | ||
# Incremental compilation is useful as part of an edit-build-test-edit cycle, | ||
# as it lets the compiler avoid recompiling code that hasn't changed. However, | ||
# on CI, we're not making small edits; we're almost always building the entire | ||
# project from scratch. Thus, incremental compilation on CI actually | ||
# introduces *additional* overhead to support making future builds | ||
# faster...but no future builds will ever occur in any given CI environment. | ||
# | ||
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow | ||
# for details. | ||
CARGO_INCREMENTAL: 0 | ||
# Allow more retries for network requests in cargo (downloading crates) and | ||
# rustup (installing toolchains). This should help to reduce flaky CI failures | ||
# from transient network timeouts or other issues. | ||
CARGO_NET_RETRY: 10 | ||
RUSTUP_MAX_RETRIES: 10 | ||
# Don't emit giant backtraces in the CI logs. | ||
RUST_BACKTRACE: short | ||
|
||
jobs: | ||
cargo-hack: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# cargo hack --feature-powerset will have a significant permutation | ||
# number, we can't just use --all as it increases the runtime | ||
# further than what we would like to | ||
subcrate: | ||
- tracing-attributes | ||
- tracing-core | ||
- tracing-futures | ||
- tracing-log | ||
- tracing-macros | ||
- tracing-serde | ||
- tracing-tower | ||
# tracing and tracing-subscriber have too many features to be checked by | ||
# cargo-hack --feature-powerset, combinatorics there is exploding. | ||
#- tracing | ||
#- tracing-subscriber | ||
steps: | ||
- uses: actions/checkout@main | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- name: Install cargo-hack | ||
run: | | ||
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin | ||
- name: cargo hack check | ||
working-directory: ${{ matrix.subcrate }} | ||
run: cargo hack check --feature-powerset --no-dev-deps | ||
|
||
cargo-check-tracing: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
featureset: | ||
- "" | ||
- log-always | ||
- std log-always | ||
- std | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@main | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- name: cargo check | ||
working-directory: tracing | ||
run: cargo check --no-default-features --features "${{ matrix.featureset }}" | ||
|
||
cargo-check-subscriber: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
featureset: | ||
- "" | ||
- fmt | ||
- fmt ansi | ||
- fmt json | ||
- fmt json ansi | ||
- fmt registry | ||
- fmt env-filter | ||
- registry | ||
- env-filter | ||
steps: | ||
- uses: actions/checkout@main | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- name: cargo check | ||
working-directory: tracing-subscriber | ||
run: cargo check --no-default-features --features "${{ matrix.featureset }}" | ||
|
||
features-stable: | ||
# Feature flag tests that run on stable Rust. | ||
# TODO(david): once tracing's MSRV goes up to Rust 1.51, we should be able to switch to | ||
# using cargo's V2 feature resolver (https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions) | ||
# and avoid cd'ing into each crate's directory. | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- name: "Test log support" | ||
run: cargo test | ||
working-directory: "tracing/test-log-support" | ||
- name: "Test static max level" | ||
run: cargo test | ||
working-directory: "tracing/test_static_max_level_features" | ||
- name: "Test tracing-core no-std support" | ||
run: cargo test --no-default-features | ||
working-directory: tracing-core | ||
- name: "Test tracing no-std support" | ||
run: cargo test --lib --tests --no-default-features | ||
working-directory: tracing | ||
# this skips running doctests under the `--no-default-features` flag, | ||
# as rustdoc isn't aware of cargo's feature flags. | ||
- name: "Test tracing-subscriber no-std support" | ||
run: cargo test --lib --tests --no-default-features | ||
working-directory: tracing-subscriber | ||
- name: "Test tracing-subscriber with liballoc only" | ||
run: cargo test --lib --tests --no-default-features --features "alloc" | ||
working-directory: tracing-subscriber | ||
- name: "Test tracing-subscriber with no default features" | ||
run: cargo test --lib --tests --no-default-features --features "std" | ||
working-directory: tracing-subscriber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.