Skip to content

Commit 208d02e

Browse files
d-e-s-odanielocfb
authored andcommitted
Run tests on release builds
Run tests on release builds to catch issues such as #447 early on. Signed-off-by: Daniel Müller <[email protected]>
1 parent c52623a commit 208d02e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ on:
88

99
jobs:
1010
build:
11+
name: Test [${{ matrix.rust }}, ${{ matrix.profile }}]
1112
runs-on: ubuntu-latest
1213
strategy:
1314
fail-fast: false
1415
matrix:
1516
rust: [stable, nightly]
17+
profile: [dev]
18+
include:
19+
- rust: stable
20+
profile: release
1621
steps:
1722
- name: "Set environmental variables"
1823
shell: bash
@@ -50,12 +55,12 @@ jobs:
5055
sudo rm -f /bin/clang && sudo ln -s /usr/bin/clang-14 /bin/clang
5156
- uses: Swatinem/[email protected]
5257
- name: Build
53-
run: cargo build --locked --verbose --workspace --exclude runqslower
58+
run: cargo build --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower
5459
- name: Run tests
5560
# Skip BTF & map tests which require sudo
56-
run: cargo test --locked --verbose --workspace --exclude runqslower -- --skip test_object --skip test_tc --skip test_map_info --include-ignored
61+
run: cargo test --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower -- --skip test_object --skip test_tc --skip test_map_info --include-ignored
5762
- name: Run BTF tests
58-
run: cd libbpf-rs && cargo test --locked --verbose -- test_object test_tc
63+
run: cd libbpf-rs && cargo test --profile=${{ matrix.profile }} --locked --verbose -- test_object test_tc
5964

6065
build-minimum:
6166
name: Build using minimum versions of dependencies

libbpf-rs/tests/test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::collections::HashSet;
22
use std::ffi::c_void;
33
use std::fs;
4+
use std::hint;
45
use std::io::Read;
56
use std::path::Path;
67
use std::path::PathBuf;
@@ -1102,7 +1103,8 @@ fn test_object_tracepoint_with_opts() {
11021103
#[inline(never)]
11031104
#[no_mangle]
11041105
extern "C" fn uprobe_target() -> usize {
1105-
42
1106+
// Use `black_box` here as an additional barrier to inlining.
1107+
hint::black_box(42)
11061108
}
11071109

11081110
/// Check that we can attach a BPF program to a uprobe.

0 commit comments

Comments
 (0)