|  |  | @ -10,9 +10,9 @@ pub struct Options { | 
			
		
	
		
		
			
				
					
					|  |  |  |     /// Set the endianness of the BPF target
 |  |  |  |     /// Set the endianness of the BPF target
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     #[structopt(default_value = "bpfel-unknown-none", long)] |  |  |  |     #[structopt(default_value = "bpfel-unknown-none", long)] | 
			
		
	
		
		
			
				
					
					|  |  |  |     pub bpf_target: Architecture, |  |  |  |     pub bpf_target: Architecture, | 
			
		
	
		
		
			
				
					
					|  |  |  |     /// Build and run the release target
 |  |  |  |     /// Build profile for userspace program
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     #[structopt(long)] |  |  |  |     #[structopt(default_value = "dev", long)] | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     pub release: bool, |  |  |  |     pub profile: String, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     /// The command used to wrap your application
 |  |  |  |     /// The command used to wrap your application
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     #[structopt(short, long, default_value = "sudo -E")] |  |  |  |     #[structopt(short, long, default_value = "sudo -E")] | 
			
		
	
		
		
			
				
					
					|  |  |  |     pub runner: String, |  |  |  |     pub runner: String, | 
			
		
	
	
		
		
			
				
					|  |  | @ -23,10 +23,7 @@ pub struct Options { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /// Build the project
 |  |  |  | /// Build the project
 | 
			
		
	
		
		
			
				
					
					|  |  |  | fn build(opts: &Options) -> Result<(), anyhow::Error> { |  |  |  | fn build(opts: &Options) -> Result<(), anyhow::Error> { | 
			
		
	
		
		
			
				
					
					|  |  |  |     let mut args = vec!["build"]; |  |  |  |     let args = vec!["build", "--profile", opts.profile.as_str()]; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     if opts.release { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         args.push("--release") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     let status = Command::new("cargo") |  |  |  |     let status = Command::new("cargo") | 
			
		
	
		
		
			
				
					
					|  |  |  |         .args(&args) |  |  |  |         .args(&args) | 
			
		
	
		
		
			
				
					
					|  |  |  |         .status() |  |  |  |         .status() | 
			
		
	
	
		
		
			
				
					|  |  | @ -40,14 +37,17 @@ pub fn run(opts: Options) -> Result<(), anyhow::Error> { | 
			
		
	
		
		
			
				
					
					|  |  |  |     // build our ebpf program followed by our application
 |  |  |  |     // build our ebpf program followed by our application
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     build_ebpf(BuildOptions { |  |  |  |     build_ebpf(BuildOptions { | 
			
		
	
		
		
			
				
					
					|  |  |  |         target: opts.bpf_target, |  |  |  |         target: opts.bpf_target, | 
			
		
	
		
		
			
				
					
					|  |  |  |         release: opts.release, |  |  |  |         profile: opts.profile.clone(), | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     }) |  |  |  |     }) | 
			
		
	
		
		
			
				
					
					|  |  |  |     .context("Error while building eBPF program")?; |  |  |  |     .context("Error while building eBPF program")?; | 
			
		
	
		
		
			
				
					
					|  |  |  |     build(&opts).context("Error while building userspace application")?; |  |  |  |     build(&opts).context("Error while building userspace application")?; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     // profile we are building (release or debug)
 |  |  |  |     let target_dir = match opts.profile.as_str() { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     let profile = if opts.release { "release" } else { "debug" }; |  |  |  |         "dev" | "test" => "debug", | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     let bin_path = format!("target/{}/{{project-name}}", profile); |  |  |  |         "bench" | "release" => "release", | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         _ => opts.profile.as_str(), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     let bin_path = format!("target/{}/{{project-name}}", target_dir); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     // arguments to pass to the application
 |  |  |  |     // arguments to pass to the application
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     let mut run_args: Vec<_> = opts.run_args.iter().map(String::as_str).collect(); |  |  |  |     let mut run_args: Vec<_> = opts.run_args.iter().map(String::as_str).collect(); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |