Skip to content

Commit

Permalink
libbpf-cargo: Remove unnecessary 'clang' setting
Browse files Browse the repository at this point in the history
Usage of clang as the compiler is the default for the SkeletonBuilder
type. Hence, there is no need to instruct it to use this compiler
explicitly.

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o committed Jan 21, 2025
1 parent be15077 commit 2d2d5f8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions libbpf-cargo/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ fn build_rust_project_from_bpf_c_impl(bpf_c: &str, rust: &str, run: bool) {
.arg(cargo_toml.into_os_string())
.env("RUSTFLAGS", "-Dwarnings")
.status()
.expect("failed to spawn cargo-build");
.expect("failed to run cargo");
assert!(status.success());
}

Expand Down Expand Up @@ -774,14 +774,12 @@ fn test_skeleton_builder_clang_opts() {
// Should fail b/c `PURPOSE` not defined
SkeletonBuilder::new()
.source(proj_dir.join("src/bpf/prog.bpf.c"))
.clang("clang")
.build_and_generate(skel.path())
.unwrap_err();

// Should succeed b/c we defined the macro
SkeletonBuilder::new()
.source(proj_dir.join("src/bpf/prog.bpf.c"))
.clang("clang")
.clang_args(["-DPURPOSE=you_pass_the_butter"])
.build_and_generate(skel.path())
.unwrap();
Expand Down Expand Up @@ -1086,15 +1084,13 @@ fn test_skeleton_builder_deterministic() {
let skel1 = NamedTempFile::new().unwrap();
SkeletonBuilder::new()
.source(proj_dir.join("src/bpf/prog.bpf.c"))
.clang("clang")
.build_and_generate(skel1.path())
.unwrap();
let skel1 = read_to_string(skel1.path()).unwrap();

let skel2 = NamedTempFile::new().unwrap();
SkeletonBuilder::new()
.source(proj_dir.join("src/bpf/prog.bpf.c"))
.clang("clang")
.build_and_generate(skel2.path())
.unwrap();
let skel2 = read_to_string(skel2.path()).unwrap();
Expand Down

0 comments on commit 2d2d5f8

Please sign in to comment.