@@ -377,7 +377,7 @@ fn test_make_workspace() {
377377 . exists( ) ) ;
378378}
379379
380- fn build_rust_project_from_bpf_c ( bpf_c : & str , rust : & str ) {
380+ fn build_rust_project_from_bpf_c_impl ( bpf_c : & str , rust : & str , run : bool ) {
381381 let ( _dir, proj_dir, cargo_toml) = setup_temp_project ( ) ;
382382
383383 // Add prog dir
@@ -434,7 +434,7 @@ fn build_rust_project_from_bpf_c(bpf_c: &str, rust: &str) {
434434 . expect ( "failed to write to main.rs" ) ;
435435
436436 let status = Command :: new ( "cargo" )
437- . arg ( " build")
437+ . arg ( if run { "run" } else { " build" } )
438438 . arg ( "--quiet" )
439439 . arg ( "--manifest-path" )
440440 . arg ( cargo_toml. into_os_string ( ) )
@@ -444,6 +444,16 @@ fn build_rust_project_from_bpf_c(bpf_c: &str, rust: &str) {
444444 assert ! ( status. success( ) ) ;
445445}
446446
447+ fn build_rust_project_from_bpf_c ( bpf_c : & str , rust : & str ) {
448+ let run = false ;
449+ build_rust_project_from_bpf_c_impl ( bpf_c, rust, run)
450+ }
451+
452+ fn run_rust_project_from_bpf_c ( bpf_c : & str , rust : & str ) {
453+ let run = true ;
454+ build_rust_project_from_bpf_c_impl ( bpf_c, rust, run)
455+ }
456+
447457#[ test]
448458fn test_skeleton_empty_source ( ) {
449459 let bpf_c = String :: new ( ) ;
@@ -869,12 +879,15 @@ fn test_skeleton_enum_with_same_value_variants() {
869879 use bpf::*;
870880
871881 fn main() {
872- let _zero1 = types::Foo::Zero;
873- let _zero2 = types::Foo::ZeroDup;
882+ let zero1 = types::Foo::Zero;
883+ let zero2 = types::Foo::ZeroDup;
884+
885+ assert_eq!(zero1, zero2);
886+ assert_ne!(types::Foo::Zero, types::Foo::One);
874887 }
875888 "#
876889 . to_string ( ) ;
877- let ( ) = build_rust_project_from_bpf_c ( & bpf_c, & rust) ;
890+ let ( ) = run_rust_project_from_bpf_c ( & bpf_c, & rust) ;
878891}
879892
880893#[ test]
@@ -1865,7 +1878,7 @@ struct Bar bar;
18651878pub struct Bar {
18661879 pub foo: Foo,
18671880}
1868- #[derive(Debug, Copy, Clone)]
1881+ #[derive(Debug, Copy, Clone, Eq, PartialEq )]
18691882#[repr(transparent)]
18701883pub struct Foo(u32);
18711884#[allow(non_upper_case_globals)]
@@ -2603,7 +2616,7 @@ struct Foo foo;
26032616pub struct Foo {
26042617 pub test: __anon_1,
26052618}
2606- #[derive(Debug, Copy, Clone)]
2619+ #[derive(Debug, Copy, Clone, Eq, PartialEq )]
26072620#[repr(transparent)]
26082621pub struct __anon_1(u32);
26092622#[allow(non_upper_case_globals)]
0 commit comments