Rewrite and rename issue-26006 to rmake

This commit is contained in:
Oneirical 2024-07-11 14:48:33 -04:00
parent 9dc08e30bd
commit fc4404c230
8 changed files with 45 additions and 27 deletions

View File

@ -38,7 +38,6 @@ run-make/interdependent-c-libraries/Makefile
run-make/issue-107094/Makefile
run-make/issue-14698/Makefile
run-make/issue-15460/Makefile
run-make/issue-26006/Makefile
run-make/issue-28595/Makefile
run-make/issue-33329/Makefile
run-make/issue-35164/Makefile

View File

@ -0,0 +1,5 @@
extern crate foo;
pub fn main() {
let _ = foo::hello_world();
}

View File

@ -0,0 +1,3 @@
pub fn hello_world() -> i32 {
42
}

View File

@ -0,0 +1,33 @@
// In this test, the symlink created is invalid (valid relative to the root, but not
// relatively to where it is located), and used to cause an internal
// compiler error (ICE) when passed as a library search path. This was fixed in #26044,
// and this test checks that the invalid symlink is instead simply ignored.
// See https://github.com/rust-lang/rust/issues/26006
//@ needs-symlink
//Reason: symlink requires elevated permission in Windows
use run_make_support::{rfs, rustc};
fn main() {
// We create two libs: `bar` which depends on `foo`. We need to compile `foo` first.
rfs::create_dir("out");
rfs::create_dir("out/foo");
rustc()
.input("in/foo/lib.rs")
.crate_name("foo")
.crate_type("lib")
.metadata("foo")
.output("out/foo/libfoo.rlib")
.run();
rfs::create_dir("out/bar");
rfs::create_dir("out/bar/deps");
rfs::create_symlink("out/foo/libfoo.rlib", "out/bar/deps/libfoo.rlib");
// Check that the invalid symlink does not cause an ICE
rustc()
.input("in/bar/lib.rs")
.library_search_path("dependency=out/bar/deps")
.run_fail()
.assert_exit_code(1)
.assert_stderr_not_contains("internal compiler error");
}

View File

@ -1,17 +0,0 @@
# ignore-cross-compile
include ../tools.mk
# ignore-windows
OUT := $(TMPDIR)/out
all: time
time: libc
mkdir -p $(OUT)/time $(OUT)/time/deps
ln -sf $(OUT)/libc/liblibc.rlib $(OUT)/time/deps/
$(RUSTC) in/time/lib.rs -Ldependency=$(OUT)/time/deps/
libc:
mkdir -p $(OUT)/libc
$(RUSTC) in/libc/lib.rs --crate-name=libc -Cmetadata=foo -o $(OUT)/libc/liblibc.rlib

View File

@ -1,3 +0,0 @@
#![crate_type = "rlib"]
pub fn something() {}

View File

@ -1,4 +0,0 @@
#![feature(rustc_private)]
extern crate libc;
fn main() {}

View File

@ -3,9 +3,10 @@
// After this was fixed in #22135, this test checks that this bug does not make a resurgence.
// See https://github.com/rust-lang/rust/issues/22131
//FIXME(Oneirical): try test-various
//@ ignore-cross-compile
// Reason: rustdoc fails to find the "foo" crate
use run_make_support::{rustc, rustdoc};
use run_make_support::{cwd, rustc, rustdoc};
fn main() {
rustc().cfg(r#"feature="bar""#).crate_type("lib").input("foo.rs").run();
@ -13,6 +14,7 @@ fn main() {
.arg("--test")
.arg("--cfg")
.arg(r#"feature="bar""#)
.library_search_path(cwd())
.input("foo.rs")
.run()
.assert_stdout_contains("foo.rs - foo (line 1) ... ok");