tests: explain libbpf env variable

pull/467/head
Matteo Nardi 2 years ago
parent b72abcc7de
commit 702f77b565

@ -14,7 +14,7 @@ fn relocate_field() {
__u8 b;
__u8 c;
__u8 d;
} __attribute__((preserve_access_index));
};
"#,
target_btf: r#"
struct foo {
@ -141,6 +141,8 @@ impl RelocationTest {
Command::new("clang")
.current_dir(tmp_dir.path())
.args(["-c", "-g", "-O2", "-target", "bpf"])
// NOTE: these tests depend on libbpf, LIBBPF_INCLUDE must point its headers.
// This is set automatically by the integration-test xtask.
.args([
"-I",
&std::env::var("LIBBPF_INCLUDE").context("LIBBPF_INCLUDE not set")?,

@ -103,7 +103,12 @@ fn build_c_ebpf(opts: &BuildEbpfOptions) -> anyhow::Result<()> {
let include_path = out_path.join("include");
get_libbpf_headers(&opts.libbpf_dir, &include_path)?;
// Export libbpf location as an env variable since it's needed for building
// the relocation tests at test/integration-test/src/tests/relocations.rs
// We decided to make an exception and build its eBPF programs at run-time
// because of the many different permutations.
std::env::set_var("LIBBPF_INCLUDE", &include_path);
let files = fs::read_dir(&src).unwrap();
for file in files {
let p = file.unwrap().path();

Loading…
Cancel
Save