Skip to content

Commit

Permalink
fixed ebpf check in xtask
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin JEROME <qjerome@users.noreply.github.com>
  • Loading branch information
qjerome committed Oct 3, 2023
1 parent 6ae9f54 commit e32cda3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
"--",
"--workspace",
"--quiet",
"--message-format=json"
"--message-format=json",
"--all-targets",
],
// if set to workspace it tries to run cargo xtask inside
// kunai-ebpf which is problematic as xtask doesnt exists in there
"rust-analyzer.cargo.buildScripts.invocationLocation": "root",
"rust-analyzer.cargo.features": "all"
"rust-analyzer.cargo.features": "all",
"rust-analyzer.runnables.extraArgs": [
"--target=x86_64-unknown-linux-gnu"
],
}
5 changes: 5 additions & 0 deletions xtask/src/ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ pub struct BuildOptions {
}

impl BuildOptions {
pub fn build_args(mut self, args: Vec<String>) -> Self {
self.build_args = args;
self
}

fn mandatory_rustflags(&self) -> Vec<String> {
let mut rustflags = vec![std::env::var("RUSTFLAGS").unwrap_or_default()];

Expand Down
9 changes: 8 additions & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ fn main() -> Result<(), anyhow::Error> {
Build(opts) => user::build_all(EBPF_DIR, &opts)?,
Run(opts) => user::run(EBPF_DIR, &opts)?,
Check(mut opts) => {
// checking userland code
user::check(&mut opts)?;
ebpf::check(EBPF_DIR, &mut opts.into())?;

// checking bpf code
// build arguments are not propagated by into method so we need
// to set them explicitely
let check_args = opts.build_args.clone();
let bo: ebpf::BuildOptions = opts.into();
ebpf::check(EBPF_DIR, &mut bo.build_args(check_args))?;
}
BuildTools(opts) => {
// checking we have the tools we need
Expand Down

0 comments on commit e32cda3

Please sign in to comment.