diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae445709..2a0e5e99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: run: cargo fmt --all -- --check - name: Run clippy - run: cargo hack clippy --all-targets --feature-powerset --workspace -- --deny warnings + run: ./clippy.sh - run: cargo xtask public-api if: github.event_name == 'pull_request' @@ -165,10 +165,12 @@ jobs: CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.bpf_target_arch }} run: | set -euxo pipefail - cargo hack build --package aya-ebpf --package aya-log-ebpf \ - --feature-powerset \ + cargo hack build \ --target ${{ matrix.target }} \ - -Z build-std=core + -Z build-std=core \ + --package aya-ebpf \ + --package aya-log-ebpf \ + --feature-powerset - name: Test env: @@ -176,7 +178,8 @@ jobs: RUST_BACKTRACE: full run: | set -euxo pipefail - cargo hack test --doc \ + cargo hack test \ + --doc \ --package aya-ebpf \ --package aya-log-ebpf \ --feature-powerset diff --git a/Cargo.toml b/Cargo.toml index e1ecd0e4..2a41fa9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,12 +96,6 @@ tokio = { version = "1.24.0", default-features = false } which = { version = "7.0.0", default-features = false } xdpilone = { version = "1.0.5", default-features = false } -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" - [profile.release.package.integration-ebpf] debug = 2 codegen-units = 1 diff --git a/clippy.sh b/clippy.sh new file mode 100755 index 00000000..2c50ca8e --- /dev/null +++ b/clippy.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# `-C panic=abort` because "unwinding panics are not supported without std"; +# integration-ebpf contains `#[no_std]` binaries. +# +# `-Zpanic_abort_tests` because "building tests with panic=abort is not supported without +# `-Zpanic_abort_tests`"; Cargo does this automatically when panic=abort is set via profile +# but we want to preserve unwinding at runtime - here we are just running clippy so we don't +# care about unwinding behavior. +# +# `+nightly` because "the option `Z` is only accepted on the nightly compiler". +exec cargo +nightly hack clippy "$@" --all-targets --feature-powerset --workspace -- --deny warnings -C panic=abort -Zpanic_abort_tests diff --git a/test/integration-ebpf/.cargo/config.toml b/test/integration-ebpf/.cargo/config.toml deleted file mode 100644 index d8d7a20c..00000000 --- a/test/integration-ebpf/.cargo/config.toml +++ /dev/null @@ -1,12 +0,0 @@ -# We have this so that one doesn't need to manually pass -# --target=bpfel-unknown-none -Z build-std=core when running cargo -# check/build/doc etc. -# -# NB: this file gets loaded only if you run cargo from this directory, it's -# ignored if you run from the workspace root. See -# https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure -[build] -target = ["bpfeb-unknown-none", "bpfel-unknown-none"] - -[unstable] -build-std = ["core"] diff --git a/xtask/src/run.rs b/xtask/src/run.rs index c92d08d5..98f55c61 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -54,7 +54,7 @@ pub fn build(target: Option<&str>, f: F) -> Result> where F: FnOnce(&mut Command) -> &mut Command, { - // Always use rust-lld and -Zbuild-std in case we're cross-compiling. + // Always use rust-lld in case we're cross-compiling. let mut cmd = Command::new("cargo"); cmd.args(["build", "--message-format=json"]); if let Some(target) = target {