Skip to content

Commit c9da03c

Browse files
d-e-s-odanielocfb
authored andcommitted
Use test-tag crate for tagging root tests
The way we specify the tests to run as root is non-obvious and error-prone: we just include "sudo" inside a tests name and then filter for that when running. The test_tag crate provides first class support for tagging of tests, which makes what is going on a bit more obvious. Switch over to using it. Signed-off-by: Daniel Müller <[email protected]>
1 parent c32000d commit c9da03c

File tree

6 files changed

+164
-76
lines changed

6 files changed

+164
-76
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ jobs:
6060
run: cargo build --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower
6161
- name: Run tests
6262
# Skip tests which require sudo
63-
run: cargo test --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower -- --skip test_sudo_ --include-ignored
63+
run: cargo test --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower -- --skip ':root:' --include-ignored
6464
- name: Run root tests
65-
run: cd libbpf-rs && cargo test --profile=${{ matrix.profile }} --locked --verbose -- test_sudo_
65+
run: cd libbpf-rs && cargo test --profile=${{ matrix.profile }} --locked --verbose -- ':root:'
6666

6767
build-features:
6868
name: Build [${{ matrix.args }}]

Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libbpf-rs/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ probe = "0.3"
3737
scopeguard = "1.1"
3838
serial_test = { version = "3.0", default-features = false }
3939
tempfile = "3.3"
40+
test-tag = "0.1"
4041

4142
# A set of unused dependencies that we require to force correct minimum versions
4243
# of transitive dependencies, for cases where our dependencies have incorrect

0 commit comments

Comments
 (0)