@@ -11,8 +11,8 @@ use rustup::test::this_host_triple;
11
11
use rustup:: utils:: raw;
12
12
13
13
use crate :: mock:: clitools:: {
14
- self , expect_err, expect_not_stdout_ok, expect_ok, expect_ok_ex, expect_stderr_ok ,
15
- expect_stdout_ok, run, set_current_dist_date, Config , Scenario ,
14
+ self , expect_err, expect_not_stderr_ok , expect_not_stdout_ok, expect_ok, expect_ok_ex,
15
+ expect_stderr_ok , expect_stdout_ok, run, set_current_dist_date, Config , Scenario ,
16
16
} ;
17
17
18
18
macro_rules! for_host_and_home {
@@ -803,6 +803,42 @@ fn list_default_and_override_toolchain() {
803
803
} ) ;
804
804
}
805
805
806
+ #[ test]
807
+ fn heal_damaged_toolchain ( ) {
808
+ setup ( & |config| {
809
+ expect_ok ( config, & [ "rustup" , "default" , "nightly" ] ) ;
810
+ expect_not_stderr_ok (
811
+ config,
812
+ & [ "rustup" , "show" , "active-toolchain" ] ,
813
+ "syncing channel updates" ,
814
+ ) ;
815
+ let path = format ! (
816
+ "toolchains/nightly-{}/lib/rustlib/multirust-channel-manifest.toml" ,
817
+ this_host_triple( )
818
+ ) ;
819
+ fs:: remove_file ( config. rustupdir . join ( path) ) . unwrap ( ) ;
820
+ expect_ok_ex (
821
+ config,
822
+ & [ "rustup" , "show" , "active-toolchain" ] ,
823
+ & format ! (
824
+ r"nightly-{0} (default)
825
+ " ,
826
+ this_host_triple( )
827
+ ) ,
828
+ for_host ! (
829
+ r"info: syncing channel updates for 'nightly-{0}'
830
+ "
831
+ ) ,
832
+ ) ;
833
+ expect_ok ( config, & [ "rustup" , "default" , "nightly" ] ) ;
834
+ expect_stderr_ok (
835
+ config,
836
+ & [ "rustup" , "show" , "active-toolchain" ] ,
837
+ "syncing channel updates" ,
838
+ ) ;
839
+ } ) ;
840
+ }
841
+
806
842
#[ test]
807
843
#[ ignore = "FIXME: Windows shows UNC paths" ]
808
844
fn show_toolchain_override ( ) {
0 commit comments