mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
rewrite long-linker-command-lines-cmd-exe to rmake
This commit is contained in:
parent
fe6feb8c6e
commit
fe4cd9aa8d
@ -12,7 +12,6 @@ run-make/libs-through-symlinks/Makefile
|
||||
run-make/libtest-json/Makefile
|
||||
run-make/libtest-junit/Makefile
|
||||
run-make/libtest-thread-limit/Makefile
|
||||
run-make/long-linker-command-lines-cmd-exe/Makefile
|
||||
run-make/macos-deployment-target/Makefile
|
||||
run-make/min-global-align/Makefile
|
||||
run-make/native-link-modifier-bundle/Makefile
|
||||
|
@ -4,10 +4,6 @@
|
||||
// thin LTO.
|
||||
// See https://github.com/rust-lang/rust/pull/53031
|
||||
|
||||
// ignore windows due to libLLVM being present in PATH and the PATH and library path being the same
|
||||
// (so fixing it is harder). See #57765 for context
|
||||
//FIXME(Oneirical): ignore-windows
|
||||
|
||||
use run_make_support::{
|
||||
cwd, has_extension, has_prefix, has_suffix, llvm_ar, rfs, rustc, shallow_find_files,
|
||||
static_lib_name,
|
||||
@ -22,7 +18,7 @@ fn main() {
|
||||
.codegen_units(1)
|
||||
.output(static_lib_name("staticlib"))
|
||||
.run();
|
||||
llvm_ar().arg("x").arg(static_lib_name("staticlib")).run();
|
||||
llvm_ar().extract().arg(static_lib_name("staticlib")).run();
|
||||
// Ensure the upstream object file was included.
|
||||
assert_eq!(
|
||||
shallow_find_files(cwd(), |path| {
|
||||
@ -50,7 +46,7 @@ fn main() {
|
||||
.arg("-Clto=thin")
|
||||
.output(static_lib_name("staticlib"))
|
||||
.run();
|
||||
llvm_ar().arg("x").arg(static_lib_name("staticlib")).run();
|
||||
llvm_ar().extract().arg(static_lib_name("staticlib")).run();
|
||||
assert_eq!(
|
||||
shallow_find_files(cwd(), |path| {
|
||||
has_prefix(path, "upstream.") && has_suffix(path, ".rcgu.o")
|
||||
|
@ -1,7 +0,0 @@
|
||||
# ignore-cross-compile
|
||||
include ../tools.mk
|
||||
|
||||
all:
|
||||
$(RUSTC) foo.rs -g
|
||||
cp foo.bat $(TMPDIR)/
|
||||
OUT_DIR="$(TMPDIR)" RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo)
|
@ -1,16 +1,3 @@
|
||||
// Like the `long-linker-command-lines` test this test attempts to blow
|
||||
// a command line limit for running the linker. Unlike that test, however,
|
||||
// this test is testing `cmd.exe` specifically rather than the OS.
|
||||
//
|
||||
// Unfortunately `cmd.exe` has a 8192 limit which is relatively small
|
||||
// in the grand scheme of things and anyone sripting rustc's linker
|
||||
// is probably using a `*.bat` script and is likely to hit this limit.
|
||||
//
|
||||
// This test uses a `foo.bat` script as the linker which just simply
|
||||
// delegates back to this program. The compiler should use a lower
|
||||
// limit for arguments before passing everything via `@`, which
|
||||
// means that everything should still succeed here.
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{BufWriter, Read, Write};
|
||||
@ -18,13 +5,8 @@ use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
if !cfg!(windows) {
|
||||
return;
|
||||
}
|
||||
|
||||
let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
let ok = tmpdir.join("ok");
|
||||
let not_ok = tmpdir.join("not_ok");
|
||||
let ok = PathBuf::from("ok");
|
||||
let not_ok = PathBuf::from("not_ok");
|
||||
if env::var("YOU_ARE_A_LINKER").is_ok() {
|
||||
match env::args_os().find(|a| a.to_string_lossy().contains("@")) {
|
||||
Some(file) => {
|
||||
@ -45,7 +27,7 @@ fn main() {
|
||||
for i in (1..).map(|i| i * 10) {
|
||||
println!("attempt: {}", i);
|
||||
|
||||
let file = tmpdir.join("bar.rs");
|
||||
let file = PathBuf::from("bar.rs");
|
||||
let mut f = BufWriter::new(File::create(&file).unwrap());
|
||||
let mut lib_name = String::new();
|
||||
for _ in 0..i {
|
||||
@ -63,8 +45,6 @@ fn main() {
|
||||
.arg(&file)
|
||||
.arg("-C")
|
||||
.arg(&bat_linker)
|
||||
.arg("--out-dir")
|
||||
.arg(&tmpdir)
|
||||
.env("YOU_ARE_A_LINKER", "1")
|
||||
.env("MY_LINKER", &me)
|
||||
.status()
|
||||
|
26
tests/run-make/long-linker-command-lines-cmd-exe/rmake.rs
Normal file
26
tests/run-make/long-linker-command-lines-cmd-exe/rmake.rs
Normal file
@ -0,0 +1,26 @@
|
||||
// Like the `long-linker-command-lines` test this test attempts to blow
|
||||
// a command line limit for running the linker. Unlike that test, however,
|
||||
// this test is testing `cmd.exe` specifically rather than the OS.
|
||||
//
|
||||
// Unfortunately, the maximum length of the string that you can use at the
|
||||
// command prompt (`cmd.exe`) is 8191 characters.
|
||||
// Anyone scripting rustc's linker
|
||||
// is probably using a `*.bat` script and is likely to hit this limit.
|
||||
//
|
||||
// This test uses a `foo.bat` script as the linker which just simply
|
||||
// delegates back to this program. The compiler should use a lower
|
||||
// limit for arguments before passing everything via `@`, which
|
||||
// means that everything should still succeed here.
|
||||
// See https://github.com/rust-lang/rust/pull/47507
|
||||
|
||||
//@ ignore-cross-compile
|
||||
// Reason: the compiled binary is executed
|
||||
//@ only-windows
|
||||
// Reason: this test is specific to Windows executables
|
||||
|
||||
use run_make_support::{run, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc().input("foo.rs").arg("-g").run();
|
||||
run("foo");
|
||||
}
|
@ -43,7 +43,7 @@ fn main() {
|
||||
return;
|
||||
}
|
||||
|
||||
let rustc = env::var_os("RUSTC").unwrap_or("rustc".into());
|
||||
let rustc = env::var_os("RUSTC").unwrap();
|
||||
let me_as_linker = format!("linker={}", env::current_exe().unwrap().display());
|
||||
for i in (1..).map(|i| i * 100) {
|
||||
println!("attempt: {}", i);
|
||||
|
Loading…
Reference in New Issue
Block a user