Skip to content

Commit 9ed58e6

Browse files
committed
rewrite long-linker-command-lines-cmd-exe to rmake
1 parent 90ba355 commit 9ed58e6

File tree

4 files changed

+28
-31
lines changed

4 files changed

+28
-31
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ run-make/libtest-json/Makefile
3333
run-make/libtest-junit/Makefile
3434
run-make/libtest-thread-limit/Makefile
3535
run-make/link-cfg/Makefile
36-
run-make/long-linker-command-lines-cmd-exe/Makefile
3736
run-make/macos-deployment-target/Makefile
3837
run-make/min-global-align/Makefile
3938
run-make/native-link-modifier-bundle/Makefile

tests/run-make/long-linker-command-lines-cmd-exe/Makefile

-7
This file was deleted.

tests/run-make/long-linker-command-lines-cmd-exe/foo.rs

+3-23
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
1-
// Like the `long-linker-command-lines` test this test attempts to blow
2-
// a command line limit for running the linker. Unlike that test, however,
3-
// this test is testing `cmd.exe` specifically rather than the OS.
4-
//
5-
// Unfortunately `cmd.exe` has a 8192 limit which is relatively small
6-
// in the grand scheme of things and anyone sripting rustc's linker
7-
// is probably using a `*.bat` script and is likely to hit this limit.
8-
//
9-
// This test uses a `foo.bat` script as the linker which just simply
10-
// delegates back to this program. The compiler should use a lower
11-
// limit for arguments before passing everything via `@`, which
12-
// means that everything should still succeed here.
13-
141
use std::env;
152
use std::fs::{self, File};
163
use std::io::{BufWriter, Read, Write};
174
use std::path::PathBuf;
185
use std::process::Command;
196

207
fn main() {
21-
if !cfg!(windows) {
22-
return;
23-
}
24-
25-
let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
26-
let ok = tmpdir.join("ok");
27-
let not_ok = tmpdir.join("not_ok");
8+
let ok = PathBuf::from("ok");
9+
let not_ok = PathBuf::from("not_ok");
2810
if env::var("YOU_ARE_A_LINKER").is_ok() {
2911
match env::args_os().find(|a| a.to_string_lossy().contains("@")) {
3012
Some(file) => {
@@ -45,7 +27,7 @@ fn main() {
4527
for i in (1..).map(|i| i * 10) {
4628
println!("attempt: {}", i);
4729

48-
let file = tmpdir.join("bar.rs");
30+
let file = PathBuf::from("bar.rs");
4931
let mut f = BufWriter::new(File::create(&file).unwrap());
5032
let mut lib_name = String::new();
5133
for _ in 0..i {
@@ -63,8 +45,6 @@ fn main() {
6345
.arg(&file)
6446
.arg("-C")
6547
.arg(&bat_linker)
66-
.arg("--out-dir")
67-
.arg(&tmpdir)
6848
.env("YOU_ARE_A_LINKER", "1")
6949
.env("MY_LINKER", &me)
7050
.status()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Like the `long-linker-command-lines` test this test attempts to blow
2+
// a command line limit for running the linker. Unlike that test, however,
3+
// this test is testing `cmd.exe` specifically rather than the OS.
4+
//
5+
// Unfortunately `cmd.exe` has a 8192 limit which is relatively small
6+
// in the grand scheme of things and anyone sripting rustc's linker
7+
// is probably using a `*.bat` script and is likely to hit this limit.
8+
//
9+
// This test uses a `foo.bat` script as the linker which just simply
10+
// delegates back to this program. The compiler should use a lower
11+
// limit for arguments before passing everything via `@`, which
12+
// means that everything should still succeed here.
13+
// See https://github.com/rust-lang/rust/pull/47507
14+
15+
//@ ignore-cross-compile
16+
// Reason: the compiled binary is executed
17+
//@ only-windows
18+
// Reason: this test is specific to Windows executables
19+
20+
use run_make_support::{run, rustc};
21+
22+
fn main() {
23+
rustc().input("foo.rs").arg("-g").run();
24+
run("foo");
25+
}

0 commit comments

Comments
 (0)