File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,6 +116,49 @@ fn build_sbom_with_simple_build_script() {
116116 let path = p. bin ( "foo" ) . with_extension ( "cargo-sbom.json" ) ;
117117 assert ! ( path. is_file( ) ) ;
118118
119- let json = read_json ( path) . expect ( "Failed to read JSON" ) ;
120- dbg ! ( & json) ;
119+ let _json = read_json ( path) . expect ( "Failed to read JSON" ) ;
120+ // TODO: check SBOM output
121+ }
122+
123+ #[ cargo_test]
124+ fn build_sbom_with_build_dependencies ( ) {
125+ let p = configured_project ( )
126+ . file (
127+ "Cargo.toml" ,
128+ r#"
129+ [package]
130+ name = "foo"
131+ version = "0.0.1"
132+ authors = []
133+
134+ [dependencies]
135+ bar = { path = "./bar" }
136+ "# ,
137+ )
138+ . file ( "src/main.rs" , "fn main() { let _i = bar::bar(); }" )
139+ . file ( "bar/src/lib.rs" , "pub fn bar() -> i32 { 2 }" )
140+ . file (
141+ "bar/Cargo.toml" ,
142+ r#"
143+ [package]
144+ name = "bar"
145+ version = "0.1.0"
146+ build = "build.rs"
147+
148+ [build-dependencies]
149+ cc = "1.0.46"
150+ "# ,
151+ )
152+ . file (
153+ "bar/build.rs" ,
154+ r#"fn main() { println!("cargo::rustc-cfg=foo"); }"# ,
155+ )
156+ . build ( ) ;
157+
158+ p. cargo ( "build -Zsbom" )
159+ . masquerade_as_nightly_cargo ( & [ "sbom" ] )
160+ . run ( ) ;
161+ let path = p. bin ( "foo" ) . with_extension ( "cargo-sbom.json" ) ;
162+ let _json = read_json ( path) . expect ( "Failed to read JSON" ) ;
163+ // TODO: check SBOM output
121164}
You can’t perform that action at this time.
0 commit comments