File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
fixtures/lto_stripped_binary Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " lto_stripped_binary"
3+ version = " 0.1.0"
4+ edition = " 2021"
5+
6+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+ [dependencies ]
9+
10+ [workspace ]
11+
12+ [profile .release ]
13+ lto =true
14+ strip =true
Original file line number Diff line number Diff line change 1+ fn main ( ) {
2+ println ! ( "Hello, world!" ) ;
3+ }
Original file line number Diff line number Diff line change @@ -269,6 +269,26 @@ fn test_lto() {
269269 . any( |p| p. name == "lto_binary_crate" ) ) ;
270270}
271271
272+ #[ test]
273+ fn test_lto_stripped ( ) {
274+ // Path to workspace fixture Cargo.toml. See that file for overview of workspace members and their dependencies.
275+ let workspace_cargo_toml = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) )
276+ . join ( "tests/fixtures/lto_stripped_binary/Cargo.toml" ) ;
277+ // Run in workspace root with default features
278+ let bins = run_cargo_auditable ( workspace_cargo_toml, & [ ] , & [ ] ) ;
279+ eprintln ! ( "Stripped binary map: {bins:?}" ) ;
280+
281+ // lto_stripped_binary should only depend on itself
282+ let lto_stripped_binary_bin = & bins. get ( "lto_stripped_binary" ) . unwrap ( ) [ 0 ] ;
283+ let dep_info = get_dependency_info ( lto_stripped_binary_bin) ;
284+ eprintln ! ( "{lto_stripped_binary_bin} dependency info: {dep_info:?}" ) ;
285+ assert ! ( dep_info. packages. len( ) == 1 ) ;
286+ assert ! ( dep_info
287+ . packages
288+ . iter( )
289+ . any( |p| p. name == "lto_stripped_binary" ) ) ;
290+ }
291+
272292#[ test]
273293fn test_bin_and_lib_in_one_crate ( ) {
274294 // Path to workspace fixture Cargo.toml. See that file for overview of workspace members and their dependencies.
You can’t perform that action at this time.
0 commit comments