@@ -3,11 +3,11 @@ use std::fs::File;
3
3
use std:: io:: prelude:: * ;
4
4
use std:: path:: Path ;
5
5
6
- use crate :: support:: cargo_process;
7
6
use crate :: support:: paths:: CargoPathExt ;
8
7
use crate :: support:: registry:: Package ;
9
8
use crate :: support:: {
10
- basic_manifest, git, path2url, paths, project, publish:: validate_crate_contents, registry,
9
+ basic_manifest, cargo_process, git, path2url, paths, project, publish:: validate_crate_contents,
10
+ registry, symlink_supported,
11
11
} ;
12
12
use git2;
13
13
@@ -505,22 +505,20 @@ fn package_git_submodule() {
505
505
}
506
506
507
507
#[ cargo_test]
508
- #[ cfg_attr( windows, ignore) ]
509
508
/// Tests if a symlink to a git submodule is properly handled.
510
509
///
511
- /// This test is ignored on Windows, because it needs Administrator
512
- /// permissions to run. If you do want to run this test, please
513
- /// run the tests with ``--ignored``, e.g.
514
- ///
515
- /// ```text
516
- /// cargo test -- --ignored
517
- /// ```
510
+ /// This test requires you to be able to make symlinks.
511
+ /// For windows, this may require you to enable developer mode.
518
512
fn package_symlink_to_submodule ( ) {
519
513
#[ cfg( unix) ]
520
514
use std:: os:: unix:: fs:: symlink;
521
515
#[ cfg( windows) ]
522
516
use std:: os:: windows:: fs:: symlink_dir as symlink;
523
517
518
+ if !symlink_supported ( ) {
519
+ return ;
520
+ }
521
+
524
522
let project = git:: new ( "foo" , |project| {
525
523
project. file ( "src/lib.rs" , "pub fn foo() {}" )
526
524
} )
@@ -712,22 +710,20 @@ See [..]
712
710
}
713
711
714
712
#[ cargo_test]
715
- #[ cfg_attr( windows, ignore) ]
716
713
/// Tests if a broken symlink is properly handled when packaging.
717
714
///
718
- /// This test is ignored on Windows, because it needs Administrator
719
- /// permissions to run. If you do want to run this test, please
720
- /// run the tests with ``--ignored``, e.g.
721
- ///
722
- /// ```text
723
- /// cargo test -- --ignored
724
- /// ```
715
+ /// This test requires you to be able to make symlinks.
716
+ /// For windows, this may require you to enable developer mode.
725
717
fn broken_symlink ( ) {
726
718
#[ cfg( unix) ]
727
719
use std:: os:: unix:: fs:: symlink;
728
720
#[ cfg( windows) ]
729
721
use std:: os:: windows:: fs:: symlink_dir as symlink;
730
722
723
+ if !symlink_supported ( ) {
724
+ return ;
725
+ }
726
+
731
727
let p = project ( )
732
728
. file (
733
729
"Cargo.toml" ,
@@ -764,17 +760,16 @@ Caused by:
764
760
}
765
761
766
762
#[ cargo_test]
767
- #[ cfg_attr( windows, ignore) ]
768
763
/// Tests if a symlink to a directory is proberly included.
769
764
///
770
- /// This test is ignored on Windows, because it needs Administrator
771
- /// permissions to run. If you do want to run this test, please
772
- /// run the tests with ``--ignored``, e.g.
773
- ///
774
- /// ```text
775
- /// cargo test -- --ignored
776
- /// ```
765
+ /// This test requires you to be able to make symlinks.
766
+ /// For windows, this may require you to enable developer mode.
777
767
fn package_symlink_to_dir ( ) {
768
+
769
+ if !symlink_supported ( ) {
770
+ return ;
771
+ }
772
+
778
773
project ( )
779
774
. file ( "src/main.rs" , r#"fn main() { println!("hello"); }"# )
780
775
. file ( "bla/Makefile" , "all:" )
0 commit comments