-
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.
tests/run-make: update for symlink helper changes
- Loading branch information
Showing
4 changed files
with
93 additions
and
26 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,18 +1,37 @@ | ||
// 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, 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(); | ||
|
||
#[cfg(unix)] | ||
{ | ||
rfs::unix::symlink( | ||
cwd().join(dynamic_lib_name("foo")), | ||
cwd().join("other").join(dynamic_lib_name("foo")), | ||
); | ||
} | ||
#[cfg(windows)] | ||
{ | ||
rfs::windows::symlink_file( | ||
cwd().join(dynamic_lib_name("foo")), | ||
cwd().join("other").join(dynamic_lib_name("foo")), | ||
); | ||
} | ||
#[cfg(not(any(unix, windows)))] | ||
{ | ||
// FIXME(jieyouxu): this is not supported, but we really should implement a only-* directive | ||
// that accepts multiple targets, like e.g. `//@ only-target-families: unix, windows`. That | ||
// way, it properly shows up as an ignored test instead of silently passing. | ||
return; | ||
} | ||
|
||
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