Skip to content

Commit

Permalink
Rename tests requiring root
Browse files Browse the repository at this point in the history
We have some complicated and non-obvious logic for skipping certain
tests when running cargo test from the root of the crate in CI, but then
an explicit invocation from the libbpf-rs/ sub-directory attempting to
run those skipped tests (now under sudo).
Simplify the logic and hopefully make it somewhat more obvious by
prefixing all tests that require root with `test_sudo_`.

Note: this is a workaround for what I'd call a bug in Cargo. I opened
rust-lang/cargo#12147 in the hopes that this
will be addressed eventually (though I don't know how realistic that
is). If we are still getting confusion even with this more explicit
naming, we may want to consider moving (or copying) libbpf-rs's .cargo/
directory into the workspace root.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o authored and danielocfb committed May 18, 2023
1 parent e0da4b6 commit 319fc3b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 60 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
- name: Build
run: cargo build --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower
- name: Run tests
# Skip BTF & map tests which require sudo
run: cargo test --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower -- --skip test_object --skip test_tc --skip test_map_info --include-ignored
- name: Run BTF tests
run: cd libbpf-rs && cargo test --profile=${{ matrix.profile }} --locked --verbose -- test_object test_tc
# Skip tests which require sudo
run: cargo test --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower -- --skip test_sudo_ --include-ignored
- name: Run root tests
run: cd libbpf-rs && cargo test --profile=${{ matrix.profile }} --locked --verbose -- test_sudo_

build-minimum:
name: Build using minimum versions of dependencies
Expand Down
Loading

0 comments on commit 319fc3b

Please sign in to comment.