integration-tests: run in release also

In release, the trigger functions were being optimized out and the
tests did not work. Use core::hint::black_box to ensure that the
functions are not optimized out. Also, run these integration tests
in CI to ensure that we don't regress.
reviewable/pr661/r2
Andrew Werner 2 years ago committed by Tamir Duberstein
parent c17f1d7596
commit 2e8d40d723
No known key found for this signature in database

@ -116,8 +116,12 @@ fn load_and_attach_uprobe(prog_name: &str, func_name: &str, bytes: &[u8]) -> Bpf
#[no_mangle]
#[inline(never)]
pub extern "C" fn trigger_bpf_probe_read_user(_string: *const u8, _len: usize) {}
pub extern "C" fn trigger_bpf_probe_read_user(string: *const u8, len: usize) {
core::hint::black_box((string, len));
}
#[no_mangle]
#[inline(never)]
pub extern "C" fn trigger_bpf_probe_read_kernel(_len: usize) {}
pub extern "C" fn trigger_bpf_probe_read_kernel(len: usize) {
core::hint::black_box(len);
}

@ -9,7 +9,9 @@ use log::{Level, Log, Record};
#[no_mangle]
#[inline(never)]
pub extern "C" fn trigger_ebpf_program() {}
pub extern "C" fn trigger_ebpf_program() {
core::hint::black_box(trigger_ebpf_program);
}
struct TestingLogger<F> {
log: F,

@ -49,4 +49,6 @@ fn load_and_attach(name: &str, bytes: &[u8]) -> Bpf {
#[no_mangle]
#[inline(never)]
pub extern "C" fn trigger_relocations_program() {}
pub extern "C" fn trigger_relocations_program() {
core::hint::black_box(trigger_relocations_program);
}

@ -244,6 +244,9 @@ rsync_vm "--exclude=target --exclude=.tmp $AYA_SOURCE_DIR"
exec_vm "cd aya; cargo xtask integration-test"
# run the integration tests again in release, they should still work.
exec_vm "cd aya; cargo xtask integration-test --cargo-arg=--release"
# we rm and sync but it doesn't seem to work reliably - I guess we could sleep a
# few seconds after but ain't nobody got time for that. Instead we also rm
# before rsyncing.

Loading…
Cancel
Save