mirror of https://github.com/aya-rs/aya
integration-ebpf: invalidate on bpf-linker
Extract the symlink-to-bpf-linker logic from integration-test to xtask and use it in a new build script in integration-ebpf, causing ebpf probes to be rebuilt when bpf-linker changes. Previously bpf-linker changes would rebuild integration-test, but not integration-ebpf, resulting in stale tests. Note that this still doesn't address the possibility that a new bpf-linker is added to the PATH ahead of the cached one. Solving this in the general case would require rebuild-if-changed-env=PATH *and* rebuild-if-changed={every-directory-in-PATH} which would likely mean far too much cache invalidation.reviewable/pr677/r5
parent
37965cdee2
commit
8964b801ee
@ -0,0 +1,27 @@
|
|||||||
|
use std::{env, path::PathBuf};
|
||||||
|
|
||||||
|
use xtask::{create_symlink_to_binary, AYA_BUILD_INTEGRATION_BPF};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("cargo:rerun-if-env-changed={}", AYA_BUILD_INTEGRATION_BPF);
|
||||||
|
|
||||||
|
let build_integration_bpf = match env::var_os(AYA_BUILD_INTEGRATION_BPF) {
|
||||||
|
None => false,
|
||||||
|
Some(s) => {
|
||||||
|
let s = s.to_str().unwrap();
|
||||||
|
s.parse::<bool>().unwrap()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if !build_integration_bpf {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
|
let out_dir = PathBuf::from(out_dir);
|
||||||
|
let bpf_linker_symlink = create_symlink_to_binary(&out_dir, "bpf-linker").unwrap();
|
||||||
|
println!(
|
||||||
|
"cargo:rerun-if-changed={}",
|
||||||
|
bpf_linker_symlink.to_str().unwrap()
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue