@@ -246,7 +246,7 @@ fn mock_dist_server_smoke_test() {
246
246
let tempdir = TempDir :: new ( "multirust" ) . unwrap ( ) ;
247
247
let path = tempdir. path ( ) ;
248
248
249
- create_mock_dist_server ( & path, None ) . write ( & [ ManifestVersion :: V2 ] ) ;
249
+ create_mock_dist_server ( & path, None ) . write ( & [ ManifestVersion :: V2 ] , false ) ;
250
250
251
251
assert ! ( utils:: path_exists( path. join( "dist/2016-02-01/rustc-nightly-x86_64-apple-darwin.tar.gz" ) ) ) ;
252
252
assert ! ( utils:: path_exists( path. join( "dist/2016-02-01/rustc-nightly-i686-apple-darwin.tar.gz" ) ) ) ;
@@ -307,10 +307,10 @@ fn uninstall(toolchain: &ToolchainDesc, prefix: &InstallPrefix, temp_cfg: &temp:
307
307
Ok ( ( ) )
308
308
}
309
309
310
- fn setup ( edit : Option < & Fn ( & str , & mut MockPackage ) > ,
310
+ fn setup ( edit : Option < & Fn ( & str , & mut MockPackage ) > , enable_xz : bool ,
311
311
f : & Fn ( & Url , & ToolchainDesc , & InstallPrefix , & DownloadCfg , & temp:: Cfg ) ) {
312
312
let dist_tempdir = TempDir :: new ( "multirust" ) . unwrap ( ) ;
313
- create_mock_dist_server ( dist_tempdir. path ( ) , edit) . write ( & [ ManifestVersion :: V2 ] ) ;
313
+ create_mock_dist_server ( dist_tempdir. path ( ) , edit) . write ( & [ ManifestVersion :: V2 ] , enable_xz ) ;
314
314
315
315
let prefix_tempdir = TempDir :: new ( "multirust" ) . unwrap ( ) ;
316
316
@@ -334,7 +334,17 @@ fn setup(edit: Option<&Fn(&str, &mut MockPackage)>,
334
334
335
335
#[ test]
336
336
fn initial_install ( ) {
337
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
337
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
338
+ update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
339
+
340
+ assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/rustc" ) ) ) ;
341
+ assert ! ( utils:: path_exists( & prefix. path( ) . join( "lib/libstd.rlib" ) ) ) ;
342
+ } ) ;
343
+ }
344
+
345
+ #[ test]
346
+ fn initial_install_xz ( ) {
347
+ setup ( None , true , & |url, toolchain, prefix, download_cfg, temp_cfg| {
338
348
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
339
349
340
350
assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/rustc" ) ) ) ;
@@ -344,7 +354,7 @@ fn initial_install() {
344
354
345
355
#[ test]
346
356
fn test_uninstall ( ) {
347
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
357
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
348
358
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
349
359
uninstall ( toolchain, prefix, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
350
360
@@ -355,7 +365,7 @@ fn test_uninstall() {
355
365
356
366
#[ test]
357
367
fn uninstall_removes_config_file ( ) {
358
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
368
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
359
369
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
360
370
assert ! ( utils:: path_exists( & prefix. manifest_file( "multirust-config.toml" ) ) ) ;
361
371
uninstall ( toolchain, prefix, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
@@ -365,7 +375,7 @@ fn uninstall_removes_config_file() {
365
375
366
376
#[ test]
367
377
fn upgrade ( ) {
368
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
378
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
369
379
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
370
380
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
371
381
assert_eq ! ( "2016-02-01" , utils_raw:: read_file( & prefix. path( ) . join( "bin/rustc" ) ) . unwrap( ) ) ;
@@ -387,7 +397,7 @@ fn update_removes_components_that_dont_exist() {
387
397
} ) ;
388
398
}
389
399
} ;
390
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
400
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
391
401
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
392
402
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
393
403
assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/bonus" ) ) ) ;
@@ -399,7 +409,7 @@ fn update_removes_components_that_dont_exist() {
399
409
400
410
#[ test]
401
411
fn update_preserves_extensions ( ) {
402
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
412
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
403
413
let ref adds = vec ! [
404
414
Component {
405
415
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -441,7 +451,7 @@ fn update_preserves_extensions_that_became_components() {
441
451
} ) ;
442
452
}
443
453
} ;
444
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
454
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
445
455
let ref adds = vec ! [
446
456
Component {
447
457
pkg: "bonus" . to_string( ) , target: Some ( TargetTriple :: from_str( "x86_64-apple-darwin" ) )
@@ -477,7 +487,7 @@ fn update_preserves_components_that_became_extensions() {
477
487
} ) ;
478
488
}
479
489
} ;
480
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
490
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
481
491
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
482
492
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
483
493
assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/bonus" ) ) ) ;
@@ -489,7 +499,7 @@ fn update_preserves_components_that_became_extensions() {
489
499
490
500
#[ test]
491
501
fn update_makes_no_changes_for_identical_manifest ( ) {
492
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
502
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
493
503
let status = update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
494
504
assert_eq ! ( status, UpdateStatus :: Changed ) ;
495
505
let status = update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
@@ -499,7 +509,7 @@ fn update_makes_no_changes_for_identical_manifest() {
499
509
500
510
#[ test]
501
511
fn add_extensions_for_initial_install ( ) {
502
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
512
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
503
513
let ref adds = vec ! [
504
514
Component {
505
515
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -517,7 +527,7 @@ fn add_extensions_for_initial_install() {
517
527
518
528
#[ test]
519
529
fn add_extensions_for_same_manifest ( ) {
520
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
530
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
521
531
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
522
532
523
533
let ref adds = vec ! [
@@ -538,7 +548,7 @@ fn add_extensions_for_same_manifest() {
538
548
539
549
#[ test]
540
550
fn add_extensions_for_upgrade ( ) {
541
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
551
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
542
552
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
543
553
544
554
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
@@ -564,7 +574,7 @@ fn add_extensions_for_upgrade() {
564
574
#[ test]
565
575
#[ should_panic]
566
576
fn add_extension_not_in_manifest ( ) {
567
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
577
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
568
578
let ref adds = vec ! [
569
579
Component {
570
580
pkg: "rust-bogus" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -578,7 +588,7 @@ fn add_extension_not_in_manifest() {
578
588
#[ test]
579
589
#[ should_panic]
580
590
fn add_extension_that_is_required_component ( ) {
581
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
591
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
582
592
let ref adds = vec ! [
583
593
Component {
584
594
pkg: "rustc" . to_string( ) , target: Some ( TargetTriple :: from_str( "x86_64-apple-darwin" ) )
@@ -601,7 +611,7 @@ fn add_extensions_for_same_manifest_when_extension_already_installed() {
601
611
602
612
#[ test]
603
613
fn add_extensions_does_not_remove_other_components ( ) {
604
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
614
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
605
615
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
606
616
607
617
let ref adds = vec ! [
@@ -620,7 +630,7 @@ fn add_extensions_does_not_remove_other_components() {
620
630
#[ test]
621
631
#[ should_panic]
622
632
fn remove_extensions_for_initial_install ( ) {
623
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
633
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
624
634
let ref removes = vec ! [
625
635
Component {
626
636
pkg: "rustc" . to_string( ) , target: Some ( TargetTriple :: from_str( "x86_64-apple-darwin" ) )
@@ -633,7 +643,7 @@ fn remove_extensions_for_initial_install() {
633
643
634
644
#[ test]
635
645
fn remove_extensions_for_same_manifest ( ) {
636
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
646
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
637
647
let ref adds = vec ! [
638
648
Component {
639
649
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -660,7 +670,7 @@ fn remove_extensions_for_same_manifest() {
660
670
661
671
#[ test]
662
672
fn remove_extensions_for_upgrade ( ) {
663
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
673
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
664
674
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
665
675
666
676
let ref adds = vec ! [
@@ -692,7 +702,7 @@ fn remove_extensions_for_upgrade() {
692
702
#[ test]
693
703
#[ should_panic]
694
704
fn remove_extension_not_in_manifest ( ) {
695
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
705
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
696
706
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
697
707
698
708
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
@@ -724,7 +734,7 @@ fn remove_extension_not_in_manifest_but_is_already_installed() {
724
734
} ) ;
725
735
}
726
736
} ;
727
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
737
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
728
738
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
729
739
730
740
let ref adds = vec ! [
@@ -749,7 +759,7 @@ fn remove_extension_not_in_manifest_but_is_already_installed() {
749
759
#[ test]
750
760
#[ should_panic]
751
761
fn remove_extension_that_is_required_component ( ) {
752
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
762
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
753
763
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
754
764
755
765
let ref removes = vec ! [
@@ -765,7 +775,7 @@ fn remove_extension_that_is_required_component() {
765
775
#[ test]
766
776
#[ should_panic]
767
777
fn remove_extension_not_installed ( ) {
768
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
778
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
769
779
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
770
780
771
781
let ref removes = vec ! [
@@ -785,7 +795,7 @@ fn remove_extensions_for_same_manifest_does_not_reinstall_other_components() {
785
795
786
796
#[ test]
787
797
fn remove_extensions_does_not_remove_other_components ( ) {
788
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
798
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
789
799
let ref adds = vec ! [
790
800
Component {
791
801
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -808,7 +818,7 @@ fn remove_extensions_does_not_remove_other_components() {
808
818
809
819
#[ test]
810
820
fn add_and_remove_for_upgrade ( ) {
811
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
821
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
812
822
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
813
823
814
824
let ref adds = vec ! [
@@ -842,7 +852,7 @@ fn add_and_remove_for_upgrade() {
842
852
843
853
#[ test]
844
854
fn add_and_remove ( ) {
845
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
855
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
846
856
let ref adds = vec ! [
847
857
Component {
848
858
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-unknown-linux-gnu" ) )
@@ -873,7 +883,7 @@ fn add_and_remove() {
873
883
#[ test]
874
884
#[ should_panic]
875
885
fn add_and_remove_same_component ( ) {
876
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
886
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
877
887
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg) . unwrap ( ) ;
878
888
879
889
let ref adds = vec ! [
@@ -894,7 +904,7 @@ fn add_and_remove_same_component() {
894
904
895
905
#[ test]
896
906
fn bad_component_hash ( ) {
897
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
907
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
898
908
let path = url. to_file_path ( ) . unwrap ( ) ;
899
909
let path = path. join ( "dist/2016-02-02/rustc-nightly-x86_64-apple-darwin.tar.gz" ) ;
900
910
utils_raw:: write_file ( & path, "bogus" ) . unwrap ( ) ;
@@ -910,7 +920,7 @@ fn bad_component_hash() {
910
920
911
921
#[ test]
912
922
fn unable_to_download_component ( ) {
913
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
923
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
914
924
let path = url. to_file_path ( ) . unwrap ( ) ;
915
925
let path = path. join ( "dist/2016-02-02/rustc-nightly-x86_64-apple-darwin.tar.gz" ) ;
916
926
fs:: remove_file ( & path) . unwrap ( ) ;
@@ -937,7 +947,7 @@ fn allow_installation(prefix: &InstallPrefix) {
937
947
938
948
#[ test]
939
949
fn reuse_downloaded_file ( ) {
940
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
950
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
941
951
942
952
prevent_installation ( prefix) ;
943
953
@@ -967,7 +977,7 @@ fn reuse_downloaded_file() {
967
977
968
978
#[ test]
969
979
fn checks_files_hashes_before_reuse ( ) {
970
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
980
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
971
981
972
982
let path = url. to_file_path ( ) . unwrap ( ) ;
973
983
let target_hash = utils:: read_file ( "target hash" , & path. join ( "dist/2016-02-02/rustc-nightly-x86_64-apple-darwin.tar.gz.sha256" ) ) . unwrap ( ) [ .. 64 ] . to_owned ( ) ;
0 commit comments