@@ -585,3 +585,35 @@ fn test_proc_macro_inner(sbom: bool) {
585585 . expect ( "Could not find 'syn' in the embedded dependency list!" ) ;
586586 assert_eq ! ( syn_info. kind, DependencyKind :: Build ) ;
587587}
588+
589+ #[ test]
590+ fn test_bare_linker ( ) {
591+ test_bare_linker_inner ( false ) ;
592+ test_bare_linker_inner ( true ) ;
593+ }
594+ fn test_bare_linker_inner ( sbom : bool ) {
595+ // Path to workspace fixture Cargo.toml
596+ let cargo_toml =
597+ PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "tests/fixtures/bare_linker/Cargo.toml" ) ;
598+ // The motivating example is https://github.com/EFForg/rayhunter/blob/main/.cargo/config.toml
599+ // and the config file fixture is based on that.
600+ // There doesn't seem to be a way to build with a bare linker for GNU targets, only Apple and Musl,
601+ // so this tests really only does anything on those.
602+ let config_path = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) )
603+ . join ( "tests/fixtures/bare_linker/.cargo/config.toml" ) ;
604+
605+ let bins = run_cargo_auditable (
606+ cargo_toml,
607+ & [ "--config" , config_path. to_str ( ) . unwrap ( ) ] ,
608+ & [ ] ,
609+ sbom,
610+ ) ;
611+ eprintln ! ( "Test fixture binary map: {bins:?}" ) ;
612+
613+ // bare_linker should only depend on itself
614+ let bare_linker_bin = & bins. get ( "bare_linker" ) . unwrap ( ) [ 0 ] ;
615+ let dep_info = get_dependency_info ( bare_linker_bin) ;
616+ eprintln ! ( "{bare_linker_bin} dependency info: {dep_info:?}" ) ;
617+ assert ! ( dep_info. packages. len( ) == 1 ) ;
618+ assert ! ( dep_info. packages. iter( ) . any( |p| p. name == "bare_linker" ) ) ;
619+ }
0 commit comments