@@ -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" ) ) ) ;
@@ -308,10 +308,10 @@ fn uninstall(toolchain: &ToolchainDesc, prefix: &InstallPrefix, temp_cfg: &temp:
308
308
Ok ( ( ) )
309
309
}
310
310
311
- fn setup ( edit : Option < & Fn ( & str , & mut MockPackage ) > ,
311
+ fn setup ( edit : Option < & Fn ( & str , & mut MockPackage ) > , enable_xz : bool ,
312
312
f : & Fn ( & Url , & ToolchainDesc , & InstallPrefix , & dist:: DownloadCfg , & temp:: Cfg ) ) {
313
313
let dist_tempdir = TempDir :: new ( "multirust" ) . unwrap ( ) ;
314
- create_mock_dist_server ( dist_tempdir. path ( ) , edit) . write ( & [ ManifestVersion :: V2 ] ) ;
314
+ create_mock_dist_server ( dist_tempdir. path ( ) , edit) . write ( & [ ManifestVersion :: V2 ] , enable_xz ) ;
315
315
316
316
let prefix_tempdir = TempDir :: new ( "multirust" ) . unwrap ( ) ;
317
317
@@ -335,7 +335,17 @@ fn setup(edit: Option<&Fn(&str, &mut MockPackage)>,
335
335
336
336
#[ test]
337
337
fn initial_install ( ) {
338
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
338
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
339
+ update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
340
+
341
+ assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/rustc" ) ) ) ;
342
+ assert ! ( utils:: path_exists( & prefix. path( ) . join( "lib/libstd.rlib" ) ) ) ;
343
+ } ) ;
344
+ }
345
+
346
+ #[ test]
347
+ fn initial_install_xz ( ) {
348
+ setup ( None , true , & |url, toolchain, prefix, download_cfg, temp_cfg| {
339
349
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
340
350
341
351
assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/rustc" ) ) ) ;
@@ -345,7 +355,7 @@ fn initial_install() {
345
355
346
356
#[ test]
347
357
fn test_uninstall ( ) {
348
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
358
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
349
359
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
350
360
uninstall ( toolchain, prefix, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
351
361
@@ -356,7 +366,7 @@ fn test_uninstall() {
356
366
357
367
#[ test]
358
368
fn uninstall_removes_config_file ( ) {
359
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
369
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
360
370
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
361
371
assert ! ( utils:: path_exists( & prefix. manifest_file( "multirust-config.toml" ) ) ) ;
362
372
uninstall ( toolchain, prefix, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
@@ -366,7 +376,7 @@ fn uninstall_removes_config_file() {
366
376
367
377
#[ test]
368
378
fn upgrade ( ) {
369
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
379
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
370
380
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
371
381
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
372
382
assert_eq ! ( "2016-02-01" , utils_raw:: read_file( & prefix. path( ) . join( "bin/rustc" ) ) . unwrap( ) ) ;
@@ -388,7 +398,7 @@ fn update_removes_components_that_dont_exist() {
388
398
} ) ;
389
399
}
390
400
} ;
391
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
401
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
392
402
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
393
403
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
394
404
assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/bonus" ) ) ) ;
@@ -400,7 +410,7 @@ fn update_removes_components_that_dont_exist() {
400
410
401
411
#[ test]
402
412
fn update_preserves_extensions ( ) {
403
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
413
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
404
414
let ref adds = vec ! [
405
415
Component {
406
416
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -442,7 +452,7 @@ fn update_preserves_extensions_that_became_components() {
442
452
} ) ;
443
453
}
444
454
} ;
445
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
455
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
446
456
let ref adds = vec ! [
447
457
Component {
448
458
pkg: "bonus" . to_string( ) , target: Some ( TargetTriple :: from_str( "x86_64-apple-darwin" ) )
@@ -478,7 +488,7 @@ fn update_preserves_components_that_became_extensions() {
478
488
} ) ;
479
489
}
480
490
} ;
481
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
491
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
482
492
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
483
493
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
484
494
assert ! ( utils:: path_exists( & prefix. path( ) . join( "bin/bonus" ) ) ) ;
@@ -490,7 +500,7 @@ fn update_preserves_components_that_became_extensions() {
490
500
491
501
#[ test]
492
502
fn update_makes_no_changes_for_identical_manifest ( ) {
493
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
503
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
494
504
let status = update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
495
505
assert_eq ! ( status, UpdateStatus :: Changed ) ;
496
506
let status = update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
@@ -500,7 +510,7 @@ fn update_makes_no_changes_for_identical_manifest() {
500
510
501
511
#[ test]
502
512
fn add_extensions_for_initial_install ( ) {
503
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
513
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
504
514
let ref adds = vec ! [
505
515
Component {
506
516
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -518,7 +528,7 @@ fn add_extensions_for_initial_install() {
518
528
519
529
#[ test]
520
530
fn add_extensions_for_same_manifest ( ) {
521
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
531
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
522
532
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
523
533
524
534
let ref adds = vec ! [
@@ -539,7 +549,7 @@ fn add_extensions_for_same_manifest() {
539
549
540
550
#[ test]
541
551
fn add_extensions_for_upgrade ( ) {
542
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
552
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
543
553
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
544
554
545
555
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
@@ -565,7 +575,7 @@ fn add_extensions_for_upgrade() {
565
575
#[ test]
566
576
#[ should_panic]
567
577
fn add_extension_not_in_manifest ( ) {
568
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
578
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
569
579
let ref adds = vec ! [
570
580
Component {
571
581
pkg: "rust-bogus" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -579,7 +589,7 @@ fn add_extension_not_in_manifest() {
579
589
#[ test]
580
590
#[ should_panic]
581
591
fn add_extension_that_is_required_component ( ) {
582
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
592
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
583
593
let ref adds = vec ! [
584
594
Component {
585
595
pkg: "rustc" . to_string( ) , target: Some ( TargetTriple :: from_str( "x86_64-apple-darwin" ) )
@@ -602,7 +612,7 @@ fn add_extensions_for_same_manifest_when_extension_already_installed() {
602
612
603
613
#[ test]
604
614
fn add_extensions_does_not_remove_other_components ( ) {
605
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
615
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
606
616
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
607
617
608
618
let ref adds = vec ! [
@@ -621,7 +631,7 @@ fn add_extensions_does_not_remove_other_components() {
621
631
#[ test]
622
632
#[ should_panic]
623
633
fn remove_extensions_for_initial_install ( ) {
624
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
634
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
625
635
let ref removes = vec ! [
626
636
Component {
627
637
pkg: "rustc" . to_string( ) , target: Some ( TargetTriple :: from_str( "x86_64-apple-darwin" ) )
@@ -634,7 +644,7 @@ fn remove_extensions_for_initial_install() {
634
644
635
645
#[ test]
636
646
fn remove_extensions_for_same_manifest ( ) {
637
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
647
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
638
648
let ref adds = vec ! [
639
649
Component {
640
650
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -661,7 +671,7 @@ fn remove_extensions_for_same_manifest() {
661
671
662
672
#[ test]
663
673
fn remove_extensions_for_upgrade ( ) {
664
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
674
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
665
675
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
666
676
667
677
let ref adds = vec ! [
@@ -693,7 +703,7 @@ fn remove_extensions_for_upgrade() {
693
703
#[ test]
694
704
#[ should_panic]
695
705
fn remove_extension_not_in_manifest ( ) {
696
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
706
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
697
707
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
698
708
699
709
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
@@ -725,7 +735,7 @@ fn remove_extension_not_in_manifest_but_is_already_installed() {
725
735
} ) ;
726
736
}
727
737
} ;
728
- setup ( Some ( edit) , & |url, toolchain, prefix, download_cfg, temp_cfg| {
738
+ setup ( Some ( edit) , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
729
739
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
730
740
731
741
let ref adds = vec ! [
@@ -750,7 +760,7 @@ fn remove_extension_not_in_manifest_but_is_already_installed() {
750
760
#[ test]
751
761
#[ should_panic]
752
762
fn remove_extension_that_is_required_component ( ) {
753
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
763
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
754
764
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
755
765
756
766
let ref removes = vec ! [
@@ -766,7 +776,7 @@ fn remove_extension_that_is_required_component() {
766
776
#[ test]
767
777
#[ should_panic]
768
778
fn remove_extension_not_installed ( ) {
769
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
779
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
770
780
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
771
781
772
782
let ref removes = vec ! [
@@ -786,7 +796,7 @@ fn remove_extensions_for_same_manifest_does_not_reinstall_other_components() {
786
796
787
797
#[ test]
788
798
fn remove_extensions_does_not_remove_other_components ( ) {
789
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
799
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
790
800
let ref adds = vec ! [
791
801
Component {
792
802
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-apple-darwin" ) )
@@ -809,7 +819,7 @@ fn remove_extensions_does_not_remove_other_components() {
809
819
810
820
#[ test]
811
821
fn add_and_remove_for_upgrade ( ) {
812
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
822
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
813
823
change_channel_date ( url, "nightly" , "2016-02-01" ) ;
814
824
815
825
let ref adds = vec ! [
@@ -843,7 +853,7 @@ fn add_and_remove_for_upgrade() {
843
853
844
854
#[ test]
845
855
fn add_and_remove ( ) {
846
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
856
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
847
857
let ref adds = vec ! [
848
858
Component {
849
859
pkg: "rust-std" . to_string( ) , target: Some ( TargetTriple :: from_str( "i686-unknown-linux-gnu" ) )
@@ -874,7 +884,7 @@ fn add_and_remove() {
874
884
#[ test]
875
885
#[ should_panic]
876
886
fn add_and_remove_same_component ( ) {
877
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
887
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
878
888
update_from_dist ( url, toolchain, prefix, & [ ] , & [ ] , download_cfg, temp_cfg, & |_| ( ) ) . unwrap ( ) ;
879
889
880
890
let ref adds = vec ! [
@@ -895,7 +905,7 @@ fn add_and_remove_same_component() {
895
905
896
906
#[ test]
897
907
fn bad_component_hash ( ) {
898
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
908
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
899
909
let path = url. to_file_path ( ) . unwrap ( ) ;
900
910
let path = path. join ( "dist/2016-02-02/rustc-nightly-x86_64-apple-darwin.tar.gz" ) ;
901
911
utils_raw:: write_file ( & path, "bogus" ) . unwrap ( ) ;
@@ -911,7 +921,7 @@ fn bad_component_hash() {
911
921
912
922
#[ test]
913
923
fn unable_to_download_component ( ) {
914
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
924
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
915
925
let path = url. to_file_path ( ) . unwrap ( ) ;
916
926
let path = path. join ( "dist/2016-02-02/rustc-nightly-x86_64-apple-darwin.tar.gz" ) ;
917
927
fs:: remove_file ( & path) . unwrap ( ) ;
@@ -938,7 +948,7 @@ fn allow_installation(prefix: &InstallPrefix) {
938
948
939
949
#[ test]
940
950
fn reuse_downloaded_file ( ) {
941
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
951
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
942
952
943
953
prevent_installation ( prefix) ;
944
954
@@ -959,7 +969,7 @@ fn reuse_downloaded_file() {
959
969
960
970
#[ test]
961
971
fn checks_files_hashes_before_reuse ( ) {
962
- setup ( None , & |url, toolchain, prefix, download_cfg, temp_cfg| {
972
+ setup ( None , false , & |url, toolchain, prefix, download_cfg, temp_cfg| {
963
973
964
974
let path = url. to_file_path ( ) . unwrap ( ) ;
965
975
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