-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #130427 - jieyouxu:rmake-symlink, r=Kobzol
run_make_support: rectify symlink handling Avoid confusing Unix symlinks and Windows symlinks. Since their semantics are quite different, we should avoid trying to make it automagic in how symlinks are created and deleted. Notably, the tests should reflect what type of symlinks are to be created to match what std does to make it less surprising for test readers.
- Loading branch information
Showing
5 changed files
with
158 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
// Crates that are resolved normally have their path canonicalized and all | ||
// symlinks resolved. This did not happen for paths specified | ||
// using the --extern option to rustc, which could lead to rustc thinking | ||
// that it encountered two different versions of a crate, when it's | ||
// actually the same version found through different paths. | ||
// See https://github.com/rust-lang/rust/pull/16505 | ||
|
||
// This test checks that --extern and symlinks together | ||
// can result in successful compilation. | ||
// Crates that are resolved normally have their path canonicalized and all symlinks resolved. This | ||
// did not happen for paths specified using the `--extern` option to rustc, which could lead to | ||
// rustc thinking that it encountered two different versions of a crate, when it's actually the same | ||
// version found through different paths. | ||
// | ||
// This test checks that `--extern` and symlinks together can result in successful compilation. | ||
// | ||
// See <https://github.com/rust-lang/rust/pull/16505>. | ||
|
||
//@ ignore-cross-compile | ||
//@ needs-symlink | ||
|
||
use run_make_support::{cwd, rfs, rustc}; | ||
use run_make_support::{cwd, path, rfs, rustc}; | ||
|
||
fn main() { | ||
rustc().input("foo.rs").run(); | ||
rfs::create_dir_all("other"); | ||
rfs::create_symlink("libfoo.rlib", "other"); | ||
rfs::symlink_file(path("libfoo.rlib"), path("other").join("libfoo.rlib")); | ||
|
||
rustc().input("bar.rs").library_search_path(cwd()).run(); | ||
rustc().input("baz.rs").extern_("foo", "other").library_search_path(cwd()).run(); | ||
rustc().input("baz.rs").extern_("foo", "other/libfoo.rlib").library_search_path(cwd()).run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
// When a directory and a symlink simultaneously exist with the same name, | ||
// setting that name as the library search path should not cause rustc | ||
// to avoid looking in the symlink and cause an error. This test creates | ||
// a directory and a symlink named "other", and places the library in the symlink. | ||
// If it succeeds, the library was successfully found. | ||
// See https://github.com/rust-lang/rust/issues/12459 | ||
// Avoid erroring on symlinks pointing to the same file that are present in the library search path. | ||
// | ||
// See <https://github.com/rust-lang/rust/issues/12459>. | ||
|
||
//@ ignore-cross-compile | ||
//@ needs-symlink | ||
|
||
use run_make_support::{dynamic_lib_name, rfs, rustc}; | ||
use run_make_support::{cwd, dynamic_lib_name, path, rfs, rustc}; | ||
|
||
fn main() { | ||
rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); | ||
rfs::create_dir_all("other"); | ||
rfs::create_symlink(dynamic_lib_name("foo"), "other"); | ||
rustc().input("bar.rs").library_search_path("other").run(); | ||
rfs::symlink_file(dynamic_lib_name("foo"), path("other").join(dynamic_lib_name("foo"))); | ||
rustc().input("bar.rs").library_search_path(cwd()).library_search_path("other").run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters