Skip to content

Commit 9ea8531

Browse files
committed
Rewrite and rename issue-26092 to rmake
1 parent 178c493 commit 9ea8531

12 files changed

Lines changed: 43 additions & 56 deletions

File tree

src/tools/run-make-support/src/command.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,35 @@ impl CompletedProcess {
167167
self
168168
}
169169

170+
/// Checks that trimmed `stdout` does not contain trimmed `content`.
170171
#[track_caller]
171172
pub fn assert_stdout_not_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
172173
assert_not_contains(&self.stdout_utf8(), needle.as_ref());
173174
self
174175
}
175176

177+
/// Checks that trimmed `stdout` contains trimmed `content`.
178+
#[track_caller]
179+
pub fn assert_stdout_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
180+
assert!(self.stdout_utf8().contains(needle.as_ref()));
181+
self
182+
}
183+
176184
/// Checks that trimmed `stderr` matches trimmed `content`.
177185
#[track_caller]
178186
pub fn assert_stderr_equals<S: AsRef<str>>(&self, content: S) -> &Self {
179187
assert_eq!(self.stderr_utf8().trim(), content.as_ref().trim());
180188
self
181189
}
182190

191+
/// Checks that trimmed `stderr` contains trimmed `content`.
183192
#[track_caller]
184193
pub fn assert_stderr_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
185194
assert!(self.stderr_utf8().contains(needle.as_ref()));
186195
self
187196
}
188197

198+
/// Checks that trimmed `stderr` does not contain trimmed `content`.
189199
#[track_caller]
190200
pub fn assert_stderr_not_contains<S: AsRef<str>>(&self, needle: S) -> &Self {
191201
assert_not_contains(&self.stdout_utf8(), needle.as_ref());

src/tools/tidy/src/allowed_run_make_makefiles.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ run-make/issue-20626/Makefile
8888
run-make/issue-22131/Makefile
8989
run-make/issue-25581/Makefile
9090
run-make/issue-26006/Makefile
91-
run-make/issue-26092/Makefile
9291
run-make/issue-28595/Makefile
9392
run-make/issue-33329/Makefile
9493
run-make/issue-35164/Makefile

tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ fn main() {
1212

1313
let output =
1414
rustc().input("main.rs").emit("metadata").extern_("stable", "libstable.rmeta").run();
15-
1615
let version = fs_wrapper::read_to_string(source_root().join("src/version"));
1716
let expected_string = format!("stable since {}", version.trim());
1817
output.assert_stderr_contains(expected_string);
File renamed without changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// When an empty output file is passed to rustc, the ensuing error message
2+
// should be clear. However, calling file_stem on an empty path returns None,
3+
// which, when unwrapped, causes a panic, stopping execution of rustc
4+
// and printing an obscure message instead of reaching the helpful
5+
// error message. This test checks that the panic does not occur.
6+
// See https://github.com/rust-lang/rust/pull/26199
7+
8+
use run_make_support::rustc;
9+
10+
fn main() {
11+
let output = rustc().output("").input("blank.rs").run_fail();
12+
output.assert_stderr_not_contains("panic");
13+
}

tests/run-make/issue-26092/Makefile

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/run-make/link-arg/rmake.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,16 @@
44
// This ensures that the compiler successfully parses this flag.
55
// See https://github.com/rust-lang/rust/pull/36574
66

7-
use run_make_support::rustc;
7+
use run_make_support::{is_msvc, rustc};
88

99
fn main() {
10-
let output = String::from_utf8(
11-
rustc()
12-
.input("empty.rs")
13-
.link_arg("-lfoo")
14-
.link_arg("-lbar")
15-
.print("link-args")
16-
.command_output()
17-
.stdout,
18-
)
19-
.unwrap();
20-
assert!(
21-
output.contains("lfoo") || output.contains("lbar"),
22-
"The output did not contain the expected \"lfoo\" or \"lbar\" strings."
23-
);
10+
//FIXME(Oneirical): These link-args do not fail when passed to the MSVC linker.
11+
// The original Makefile test did not check if rustc succeeded or failed.
12+
let out = if is_msvc() {
13+
rustc().input("empty.rs").link_arg("-lfoo").link_arg("-lbar").print("link-args").run()
14+
} else {
15+
rustc().input("empty.rs").link_arg("-lfoo").link_arg("-lbar").print("link-args").run_fail()
16+
};
17+
out.assert_stdout_contains("lfoo");
18+
out.assert_stdout_contains("lbar");
2419
}

tests/run-make/link-dedup/Makefile

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/run-make/link-dedup/rmake.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,18 @@
77

88
//@ ignore-msvc
99

10+
use run_make_support::rustc;
11+
1012
fn main() {
1113
rustc().input("depa.rs").run();
1214
rustc().input("depb.rs").run();
1315
rustc().input("depc.rs").run();
14-
let output =
15-
String::from_utf8(rustc().input("empty.rs").cfg("bar").command_output().stderr).unwrap();
16-
let pos_a1 =
17-
output.find("-ltesta").expect("empty.rs, compiled with --cfg, should contain -ltesta");
18-
let pos_b = output[pos_a1..]
19-
.find("-ltestb")
20-
.map(|pos| pos + pos_a1)
21-
.expect("empty.rs, compiled with --cfg, should contain -ltestb");
22-
let _ = output[pos_b..]
23-
.find("-ltesta")
24-
.map(|pos| pos + pos_b)
25-
.expect("empty.rs, compiled with --cfg, should contain a second -ltesta");
26-
let output = String::from_utf8(rustc().input("empty.rs").command_output().stderr).unwrap();
27-
assert!(output.contains("-ltesta"));
28-
let output = String::from_utf8(rustc().input("empty.rs").command_output().stderr).unwrap();
29-
assert!(!output.contains("-ltestb"));
30-
let output = String::from_utf8(rustc().input("empty.rs").command_output().stderr).unwrap();
31-
assert_eq!(output.matches("-ltesta").count, 1);
16+
let output = rustc().input("empty.rs").cfg("bar").run_fail();
17+
output.assert_stderr_contains("\"-ltesta\" \"-ltestb\" \"-ltesta\"");
18+
let output = rustc().input("empty.rs").run_fail();
19+
output.assert_stderr_contains("\"-ltesta\"");
20+
let output = rustc().input("empty.rs").run_fail();
21+
output.assert_stderr_not_contains("\"-ltestb\"");
22+
let output = rustc().input("empty.rs").run_fail();
23+
output.assert_stderr_not_contains("\"-ltesta\" \"-ltesta\" \"-ltesta\"");
3224
}

tests/run-make/rustdoc-error-lines/rmake.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use run_make_support::rustdoc;
55

66
fn main() {
77
let output = rustdoc().input("input.rs").arg("--test").run_fail().stdout_utf8();
8-
98
let should_contain = &[
109
"input.rs - foo (line 5)",
1110
"input.rs:7:15",

0 commit comments

Comments
 (0)