rewrite long-linker-command-lines to rmake

This commit is contained in:
Oneirical 2024-07-25 13:07:26 -04:00
parent 342b807e1a
commit fe6feb8c6e
4 changed files with 21 additions and 23 deletions

View File

@ -13,7 +13,6 @@ run-make/libtest-json/Makefile
run-make/libtest-junit/Makefile run-make/libtest-junit/Makefile
run-make/libtest-thread-limit/Makefile run-make/libtest-thread-limit/Makefile
run-make/long-linker-command-lines-cmd-exe/Makefile run-make/long-linker-command-lines-cmd-exe/Makefile
run-make/long-linker-command-lines/Makefile
run-make/macos-deployment-target/Makefile run-make/macos-deployment-target/Makefile
run-make/min-global-align/Makefile run-make/min-global-align/Makefile
run-make/native-link-modifier-bundle/Makefile run-make/native-link-modifier-bundle/Makefile

View File

@ -1,8 +0,0 @@
# ignore-cross-compile
include ../tools.mk
export LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
all:
$(RUSTC) foo.rs -g -O
RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo)

View File

@ -1,12 +1,3 @@
// This is a test which attempts to blow out the system limit with how many
// arguments can be passed to a process. This'll successively call rustc with
// larger and larger argument lists in an attempt to find one that's way too
// big for the system at hand. This file itself is then used as a "linker" to
// detect when the process creation succeeds.
//
// Eventually we should see an argument that looks like `@` as we switch from
// passing literal arguments to passing everything in the file.
use std::collections::HashSet; use std::collections::HashSet;
use std::env; use std::env;
use std::fs::{self, File}; use std::fs::{self, File};
@ -43,8 +34,7 @@ fn read_linker_args(path: &Path) -> String {
} }
fn main() { fn main() {
let tmpdir = PathBuf::from(env::var_os("TMPDIR").unwrap()); let ok = PathBuf::from("ok");
let ok = tmpdir.join("ok");
if env::var("YOU_ARE_A_LINKER").is_ok() { if env::var("YOU_ARE_A_LINKER").is_ok() {
if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) { if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) {
let file = file.to_str().expect("non-utf8 file argument"); let file = file.to_str().expect("non-utf8 file argument");
@ -57,7 +47,7 @@ fn main() {
let me_as_linker = format!("linker={}", env::current_exe().unwrap().display()); let me_as_linker = format!("linker={}", env::current_exe().unwrap().display());
for i in (1..).map(|i| i * 100) { for i in (1..).map(|i| i * 100) {
println!("attempt: {}", i); println!("attempt: {}", i);
let file = tmpdir.join("bar.rs"); let file = PathBuf::from("bar.rs");
let mut expected_libs = write_test_case(&file, i); let mut expected_libs = write_test_case(&file, i);
drop(fs::remove_file(&ok)); drop(fs::remove_file(&ok));
@ -65,8 +55,6 @@ fn main() {
.arg(&file) .arg(&file)
.arg("-C") .arg("-C")
.arg(&me_as_linker) .arg(&me_as_linker)
.arg("--out-dir")
.arg(&tmpdir)
.env("YOU_ARE_A_LINKER", "1") .env("YOU_ARE_A_LINKER", "1")
.output() .output()
.unwrap(); .unwrap();

View File

@ -0,0 +1,19 @@
// This is a test which attempts to blow out the system limit with how many
// arguments can be passed to a process. This'll successively call rustc with
// larger and larger argument lists in an attempt to find one that's way too
// big for the system at hand. This file itself is then used as a "linker" to
// detect when the process creation succeeds.
//
// Eventually we should see an argument that looks like `@` as we switch from
// passing literal arguments to passing everything in the file.
// See https://github.com/rust-lang/rust/issues/41190
//@ ignore-cross-compile
// Reason: the compiled binary is executed
use run_make_support::{run, rustc};
fn main() {
rustc().input("foo.rs").arg("-g").opt().run();
run("foo");
}