Skip to content

Commit 55e5623

Browse files
committed
Don't run symlink tests based on symlink_supported
1 parent 0923d7c commit 55e5623

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed

tests/testsuite/build.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ use std::io::prelude::*;
44

55
use crate::support::paths::{root, CargoPathExt};
66
use crate::support::registry::Package;
7-
use crate::support::ProjectBuilder;
87
use crate::support::{
9-
basic_bin_manifest, basic_lib_manifest, basic_manifest, rustc_host, sleep_ms,
8+
basic_bin_manifest, basic_lib_manifest, basic_manifest, main_file, project, rustc_host,
9+
sleep_ms, symlink_supported, Execs, ProjectBuilder,
1010
};
11-
use crate::support::{main_file, project, Execs};
1211
use cargo::util::paths::dylib_path_envvar;
1312

1413
#[cargo_test]
@@ -1495,12 +1494,15 @@ package `test v0.0.0 ([CWD])`",
14951494
}
14961495

14971496
#[cargo_test]
1498-
#[cfg_attr(windows, ignore)]
1499-
/// Make sure ignored symlinks don't break the build
1497+
/// Make sure broken symlinks don't break the build
15001498
///
1501-
/// This test is marked ``ignore`` on Windows because it needs admin permissions.
1502-
/// Run it with ``--ignored``.
1499+
/// This test requires you to be able to make symlinks.
1500+
/// For windows, this may require you to enable developer mode.
15031501
fn ignore_broken_symlinks() {
1502+
if !symlink_supported() {
1503+
return;
1504+
}
1505+
15041506
let p = project()
15051507
.file("Cargo.toml", &basic_bin_manifest("foo"))
15061508
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))

tests/testsuite/package.rs

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::fs::File;
33
use std::io::prelude::*;
44
use std::path::Path;
55

6-
use crate::support::cargo_process;
76
use crate::support::paths::CargoPathExt;
87
use crate::support::registry::Package;
98
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,
1111
};
1212
use git2;
1313

@@ -505,22 +505,20 @@ fn package_git_submodule() {
505505
}
506506

507507
#[cargo_test]
508-
#[cfg_attr(windows, ignore)]
509508
/// Tests if a symlink to a git submodule is properly handled.
510509
///
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.
518512
fn package_symlink_to_submodule() {
519513
#[cfg(unix)]
520514
use std::os::unix::fs::symlink;
521515
#[cfg(windows)]
522516
use std::os::windows::fs::symlink_dir as symlink;
523517

518+
if !symlink_supported() {
519+
return;
520+
}
521+
524522
let project = git::new("foo", |project| {
525523
project.file("src/lib.rs", "pub fn foo() {}")
526524
})
@@ -712,22 +710,20 @@ See [..]
712710
}
713711

714712
#[cargo_test]
715-
#[cfg_attr(windows, ignore)]
716713
/// Tests if a broken symlink is properly handled when packaging.
717714
///
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.
725717
fn broken_symlink() {
726718
#[cfg(unix)]
727719
use std::os::unix::fs::symlink;
728720
#[cfg(windows)]
729721
use std::os::windows::fs::symlink_dir as symlink;
730722

723+
if !symlink_supported() {
724+
return;
725+
}
726+
731727
let p = project()
732728
.file(
733729
"Cargo.toml",
@@ -764,17 +760,16 @@ Caused by:
764760
}
765761

766762
#[cargo_test]
767-
#[cfg_attr(windows, ignore)]
768763
/// Tests if a symlink to a directory is proberly included.
769764
///
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.
777767
fn package_symlink_to_dir() {
768+
769+
if !symlink_supported() {
770+
return;
771+
}
772+
778773
project()
779774
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
780775
.file("bla/Makefile", "all:")

0 commit comments

Comments
 (0)