rewrite suspicious-library in rmake

This commit is contained in:
Oneirical 2024-05-28 15:54:09 -04:00
parent d553d5ba2d
commit 59e2074c79
6 changed files with 30 additions and 28 deletions

View File

@ -798,6 +798,7 @@ pub fn line_directive<'line>(
"ignore-none", "ignore-none",
"ignore-nto", "ignore-nto",
"ignore-nvptx64", "ignore-nvptx64",
"ignore-nvptx64-nvidia-cuda",
"ignore-openbsd", "ignore-openbsd",
"ignore-pass", "ignore-pass",
"ignore-remote", "ignore-remote",

View File

@ -246,7 +246,6 @@ run-make/static-pie/Makefile
run-make/staticlib-blank-lib/Makefile run-make/staticlib-blank-lib/Makefile
run-make/staticlib-dylib-linkage/Makefile run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile run-make/std-core-cycle/Makefile
run-make/suspicious-library/Makefile
run-make/symbol-mangling-hashed/Makefile run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile run-make/symbol-visibility/Makefile
run-make/symbols-include-type-name/Makefile run-make/symbols-include-type-name/Makefile

View File

@ -7,26 +7,21 @@
// was hashed by rustc in addition to the span length, and the fix still // was hashed by rustc in addition to the span length, and the fix still
// works. // works.
// FIXME: Ignore flags temporarily disabled for the test. //@ ignore-none
// ignore-none // reason: no-std is not supported
// ignore-nvptx64-nvidia-cuda
use run_make_support::{rustc, target, tmp_dir}; //@ ignore-nvptx64-nvidia-cuda
// FIXME: can't find crate for `std`
use run_make_support::{rustc, tmp_dir};
use std::fs; use std::fs;
fn main() { fn main() {
fs::create_dir(tmp_dir().join("src")); // FIXME(Oneirical): Use run_make_support::fs_wrapper here.
fs::create_dir(tmp_dir().join("incr")); fs::create_dir(tmp_dir().join("src")).unwrap();
fs::copy("a.rs", tmp_dir().join("main.rs")); fs::create_dir(tmp_dir().join("incr")).unwrap();
rustc() fs::copy("a.rs", tmp_dir().join("src/main.rs")).unwrap();
.incremental(tmp_dir().join("incr")) rustc().incremental(tmp_dir().join("incr")).input(tmp_dir().join("src/main.rs")).run();
.input(tmp_dir().join("src/main.rs")) fs::copy("b.rs", tmp_dir().join("src/main.rs")).unwrap();
.target(target()) rustc().incremental(tmp_dir().join("incr")).input(tmp_dir().join("src/main.rs")).run();
.run();
fs::copy("b.rs", tmp_dir().join("main.rs"));
rustc()
.incremental(tmp_dir().join("incr"))
.input(tmp_dir().join("src/main.rs"))
.target(target())
.run();
} }

View File

@ -10,6 +10,7 @@
fn main() { fn main() {
rustc().extra_filename("-hash").input("foo.rs").run(); rustc().extra_filename("-hash").input("foo.rs").run();
rustc().input("bar.rs").run(); rustc().input("bar.rs").run();
fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib")); fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"))
.unwrap();
rustc().input("baz.rs").run(); rustc().input("baz.rs").run();
} }

View File

@ -1,8 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all:
$(RUSTC) foo.rs -C prefer-dynamic
touch $(call DYLIB,foo-something-special)
touch $(call DYLIB,foo-something-special2)
$(RUSTC) bar.rs

View File

@ -0,0 +1,14 @@
// This test creates some fake dynamic libraries with nothing inside,
// and checks if rustc avoids them and successfully compiles as a result.
//@ ignore-cross-compile
use run_make_support::{dynamic_lib, rustc};
use std::fs::File;
fn main() {
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
File::create(dynamic_lib("foo-something-special")).unwrap();
File::create(dynamic_lib("foo-something-special2")).unwrap();
rustc().input("bar.rs").run();
}