mirror of https://github.com/aya-rs/aya
Merge pull request #639 from aya-rs/test-no-bpftool
Remove dependency on bpftool in integration testsreviewable/pr640/r1
commit
e93e3c4a55
@ -1,17 +1,15 @@
|
|||||||
use lazy_static::lazy_static;
|
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::process::Command;
|
use std::{cell::OnceCell, process::Command};
|
||||||
|
|
||||||
lazy_static! {
|
pub fn workspace_root() -> &'static str {
|
||||||
pub static ref WORKSPACE_ROOT: String = workspace_root();
|
static mut WORKSPACE_ROOT: OnceCell<String> = OnceCell::new();
|
||||||
}
|
unsafe { &mut WORKSPACE_ROOT }.get_or_init(|| {
|
||||||
|
let output = Command::new("cargo").arg("metadata").output().unwrap();
|
||||||
fn workspace_root() -> String {
|
if !output.status.success() {
|
||||||
let output = Command::new("cargo").arg("metadata").output().unwrap();
|
panic!("unable to run cargo metadata")
|
||||||
if !output.status.success() {
|
}
|
||||||
panic!("unable to run cargo metadata")
|
let stdout = String::from_utf8(output.stdout).unwrap();
|
||||||
}
|
let v: Value = serde_json::from_str(&stdout).unwrap();
|
||||||
let stdout = String::from_utf8(output.stdout).unwrap();
|
v["workspace_root"].as_str().unwrap().to_string()
|
||||||
let v: Value = serde_json::from_str(&stdout).unwrap();
|
})
|
||||||
v["workspace_root"].as_str().unwrap().to_string()
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue