@@ -380,6 +380,9 @@ fn rustup_failed_path_search() {
380380 & config. customdir . join ( "custom-1" ) . to_string_lossy ( ) ,
381381 ] ,
382382 ) ;
383+
384+ expect_ok ( config, & [ "rustup" , "default" , "custom" ] ) ;
385+
383386 let broken = & [ "rustup" , "run" , "custom" , "fake_proxy" ] ;
384387 expect_err (
385388 config,
@@ -394,6 +397,54 @@ fn rustup_failed_path_search() {
394397 } ) ;
395398}
396399
400+ #[ test]
401+ fn rustup_failed_path_search_toolchain ( ) {
402+ setup ( & |config| {
403+ use std:: env:: consts:: EXE_SUFFIX ;
404+
405+ let ref rustup_path = config. exedir . join ( & format ! ( "rustup{}" , EXE_SUFFIX ) ) ;
406+ let ref tool_path = config. exedir . join ( & format ! ( "cargo-miri{}" , EXE_SUFFIX ) ) ;
407+ utils:: hardlink_file ( rustup_path, tool_path)
408+ . expect ( "Failed to create fake cargo-miri for test" ) ;
409+
410+ expect_ok (
411+ config,
412+ & [
413+ "rustup" ,
414+ "toolchain" ,
415+ "link" ,
416+ "custom-1" ,
417+ & config. customdir . join ( "custom-1" ) . to_string_lossy ( ) ,
418+ ] ,
419+ ) ;
420+
421+ expect_ok (
422+ config,
423+ & [
424+ "rustup" ,
425+ "toolchain" ,
426+ "link" ,
427+ "custom-2" ,
428+ & config. customdir . join ( "custom-2" ) . to_string_lossy ( ) ,
429+ ] ,
430+ ) ;
431+
432+ expect_ok ( config, & [ "rustup" , "default" , "custom-2" ] ) ;
433+
434+ let broken = & [ "rustup" , "run" , "custom-1" , "cargo-miri" ] ;
435+ expect_err (
436+ config,
437+ broken,
438+ "rustup component add miri --toolchain custom-1" ,
439+ ) ;
440+
441+ let broken = & [ "rustup" , "run" , "custom-2" , "cargo-miri" ] ;
442+ expect_err ( config, broken, "rustup component add miri" ) ;
443+
444+ // Hardlink will be automatically cleaned up by test setup code
445+ } ) ;
446+ }
447+
397448#[ test]
398449fn rustup_run_not_installed ( ) {
399450 setup ( & |config| {
0 commit comments