Skip to content

Commit 7d76428

Browse files
committed
tests/run-make: update for symlink helper changes
1 parent 1b86340 commit 7d76428

File tree

4 files changed

+28
-30
lines changed

4 files changed

+28
-30
lines changed

tests/run-make/invalid-symlink-search-path/rmake.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
// In this test, the symlink created is invalid (valid relative to the root, but not
2-
// relatively to where it is located), and used to cause an internal
3-
// compiler error (ICE) when passed as a library search path. This was fixed in #26044,
4-
// and this test checks that the invalid symlink is instead simply ignored.
1+
// In this test, the symlink created is invalid (valid relative to the root, but not relatively to
2+
// where it is located), and used to cause an internal compiler error (ICE) when passed as a library
3+
// search path. This was fixed in #26044, and this test checks that the invalid symlink is instead
4+
// simply ignored.
5+
//
56
// See https://github.com/rust-lang/rust/issues/26006
67

78
//@ needs-symlink
89
//Reason: symlink requires elevated permission in Windows
910

10-
use run_make_support::{rfs, rustc};
11+
use run_make_support::{path, rfs, rustc};
1112

1213
fn main() {
1314
// We create two libs: `bar` which depends on `foo`. We need to compile `foo` first.
@@ -20,9 +21,9 @@ fn main() {
2021
.metadata("foo")
2122
.output("out/foo/libfoo.rlib")
2223
.run();
23-
rfs::create_dir("out/bar");
24-
rfs::create_dir("out/bar/deps");
25-
rfs::create_symlink("out/foo/libfoo.rlib", "out/bar/deps/libfoo.rlib");
24+
rfs::create_dir_all("out/bar/deps");
25+
rfs::symlink_file(path("out/foo/libfoo.rlib"), path("out/bar/deps/libfoo.rlib"));
26+
2627
// Check that the invalid symlink does not cause an ICE
2728
rustc()
2829
.input("in/bar/lib.rs")
+12-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
// Crates that are resolved normally have their path canonicalized and all
2-
// symlinks resolved. This did not happen for paths specified
3-
// using the --extern option to rustc, which could lead to rustc thinking
4-
// that it encountered two different versions of a crate, when it's
5-
// actually the same version found through different paths.
6-
// See https://github.com/rust-lang/rust/pull/16505
7-
8-
// This test checks that --extern and symlinks together
9-
// can result in successful compilation.
1+
// Crates that are resolved normally have their path canonicalized and all symlinks resolved. This
2+
// did not happen for paths specified using the `--extern` option to rustc, which could lead to
3+
// rustc thinking that it encountered two different versions of a crate, when it's actually the same
4+
// version found through different paths.
5+
//
6+
// This test checks that `--extern` and symlinks together can result in successful compilation.
7+
//
8+
// See <https://github.com/rust-lang/rust/pull/16505>.
109

1110
//@ ignore-cross-compile
1211
//@ needs-symlink
1312

14-
use run_make_support::{cwd, rfs, rustc};
13+
use run_make_support::{cwd, path, rfs, rustc};
1514

1615
fn main() {
1716
rustc().input("foo.rs").run();
1817
rfs::create_dir_all("other");
19-
rfs::create_symlink("libfoo.rlib", "other");
18+
rfs::symlink_file(path("libfoo.rlib"), path("other").join("libfoo.rlib"));
19+
2020
rustc().input("bar.rs").library_search_path(cwd()).run();
21-
rustc().input("baz.rs").extern_("foo", "other").library_search_path(cwd()).run();
21+
rustc().input("baz.rs").extern_("foo", "other/libfoo.rlib").library_search_path(cwd()).run();
2222
}
+6-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
// When a directory and a symlink simultaneously exist with the same name,
2-
// setting that name as the library search path should not cause rustc
3-
// to avoid looking in the symlink and cause an error. This test creates
4-
// a directory and a symlink named "other", and places the library in the symlink.
5-
// If it succeeds, the library was successfully found.
6-
// See https://github.com/rust-lang/rust/issues/12459
1+
// Avoid erroring on symlinks pointing to the same file that are present in the library search path.
2+
//
3+
// See <https://github.com/rust-lang/rust/issues/12459>.
74

85
//@ ignore-cross-compile
96
//@ needs-symlink
107

11-
use run_make_support::{dynamic_lib_name, rfs, rustc};
8+
use run_make_support::{cwd, dynamic_lib_name, path, rfs, rustc};
129

1310
fn main() {
1411
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
1512
rfs::create_dir_all("other");
16-
rfs::create_symlink(dynamic_lib_name("foo"), "other");
17-
rustc().input("bar.rs").library_search_path("other").run();
13+
rfs::symlink_file(dynamic_lib_name("foo"), path("other").join(dynamic_lib_name("foo")));
14+
rustc().input("bar.rs").library_search_path(cwd()).library_search_path("other").run();
1815
}

tests/run-make/symlinked-rlib/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ use run_make_support::{cwd, rfs, rustc};
1212

1313
fn main() {
1414
rustc().input("foo.rs").crate_type("rlib").output("foo.xxx").run();
15-
rfs::create_symlink("foo.xxx", "libfoo.rlib");
15+
rfs::symlink_file("foo.xxx", "libfoo.rlib");
1616
rustc().input("bar.rs").library_search_path(cwd()).run();
1717
}

0 commit comments

Comments
 (0)