Skip to content

Commit f88bfa3

Browse files
Rollup merge of #131351 - jieyouxu:yeet-the-valgrind, r=Kobzol
Remove valgrind test suite and support from compiletest, bootstrap and opt-dist The `run-pass-valgrind` test suite is not exercised in CI, and as far as I'm aware nobody runs it (asked in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Are.20the.20valgrind.20tests.20even.20used.20by.20anyone.3F). What's remaining of valgrind support in compiletest isn't even properly hooked up with bootstrap. The existing valgrind logic in compiletest is also straight up questionable, i.e. https://github.com/rust-lang/rust/blob/1b3b8e7b0265162853c650ead09905bc3cdaeae9/src/tools/compiletest/src/runtest/valgrind.rs#L7-L12 It just runs valgrind tests as `rpass` if no valgrind path is provided to compiletest from bootstrap -- but bootstrap doesn't even pass a valgrind path to compiletest in the first place, so this always ran as `rpass` tests. So what is this even testing? So if it's not testing anything, let's delete it. Closes #44816 by deleting the test suite :3 <img src="https://github.com/user-attachments/assets/99525bf7-e85b-40ba-9281-e4e1e275c4e8" width=300 />
2 parents 9c4732a + fa3c25e commit f88bfa3

25 files changed

+29
-619
lines changed

Diff for: src/bootstrap/src/core/build_steps/test.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,6 @@ default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });
13941394

13951395
default_test!(Crashes { path: "tests/crashes", mode: "crashes", suite: "crashes" });
13961396

1397-
default_test!(RunPassValgrind {
1398-
path: "tests/run-pass-valgrind",
1399-
mode: "run-pass-valgrind",
1400-
suite: "run-pass-valgrind"
1401-
});
1402-
14031397
default_test!(Codegen { path: "tests/codegen", mode: "codegen", suite: "codegen" });
14041398

14051399
default_test!(CodegenUnits {

Diff for: src/bootstrap/src/core/builder.rs

-2
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ const PATH_REMAP: &[(&str, &[&str])] = &[
327327
"tests/mir-opt",
328328
"tests/pretty",
329329
"tests/run-make",
330-
"tests/run-pass-valgrind",
331330
"tests/rustdoc",
332331
"tests/rustdoc-gui",
333332
"tests/rustdoc-js",
@@ -852,7 +851,6 @@ impl<'a> Builder<'a> {
852851
test::Tidy,
853852
test::Ui,
854853
test::Crashes,
855-
test::RunPassValgrind,
856854
test::Coverage,
857855
test::CoverageMap,
858856
test::CoverageRun,

Diff for: src/tools/compiletest/src/common.rs

-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ macro_rules! string_enum {
5353
string_enum! {
5454
#[derive(Clone, Copy, PartialEq, Debug)]
5555
pub enum Mode {
56-
RunPassValgrind => "run-pass-valgrind",
5756
Pretty => "pretty",
5857
DebugInfo => "debuginfo",
5958
Codegen => "codegen",
@@ -207,13 +206,6 @@ pub struct Config {
207206
/// Path to LLVM's bin directory.
208207
pub llvm_bin_dir: Option<PathBuf>,
209208

210-
/// The valgrind path.
211-
pub valgrind_path: Option<String>,
212-
213-
/// Whether to fail if we can't run run-pass-valgrind tests under valgrind
214-
/// (or, alternatively, to silently run them like regular run-pass tests).
215-
pub force_valgrind: bool,
216-
217209
/// The path to the Clang executable to run Clang-based tests with. If
218210
/// `None` then these tests will be ignored.
219211
pub run_clang_based_tests_with: Option<String>,

Diff for: src/tools/compiletest/src/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
5353
.reqopt("", "python", "path to python to use for doc tests", "PATH")
5454
.optopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH")
5555
.optopt("", "jsondoclint-path", "path to jsondoclint to use for doc tests", "PATH")
56-
.optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM")
57-
.optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind")
5856
.optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH")
5957
.optopt("", "llvm-filecheck", "path to LLVM's FileCheck binary", "DIR")
6058
.reqopt("", "src-base", "directory to scan for test files", "PATH")
@@ -65,7 +63,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
6563
"",
6664
"mode",
6765
"which sort of compile tests to run",
68-
"run-pass-valgrind | pretty | debug-info | codegen | rustdoc \
66+
"pretty | debug-info | codegen | rustdoc \
6967
| rustdoc-json | codegen-units | incremental | run-make | ui \
7068
| js-doc-test | mir-opt | assembly | crashes",
7169
)
@@ -269,8 +267,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
269267
python: matches.opt_str("python").unwrap(),
270268
jsondocck_path: matches.opt_str("jsondocck-path"),
271269
jsondoclint_path: matches.opt_str("jsondoclint-path"),
272-
valgrind_path: matches.opt_str("valgrind-path"),
273-
force_valgrind: matches.opt_present("force-valgrind"),
274270
run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"),
275271
llvm_filecheck: matches.opt_str("llvm-filecheck").map(PathBuf::from),
276272
llvm_bin_dir: matches.opt_str("llvm-bin-dir").map(PathBuf::from),

Diff for: src/tools/compiletest/src/main.rs

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ fn main() {
1818

1919
let config = Arc::new(parse_config(env::args().collect()));
2020

21-
if config.valgrind_path.is_none() && config.force_valgrind {
22-
panic!("Can't find Valgrind to run Valgrind tests");
23-
}
24-
2521
if !config.has_tidy && config.mode == Mode::Rustdoc {
2622
eprintln!("warning: `tidy` is not installed; diffs will not be generated");
2723
}

Diff for: src/tools/compiletest/src/runtest.rs

+4-34
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ use tracing::*;
2020
use crate::common::{
2121
Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap, CoverageRun, Crashes,
2222
DebugInfo, Debugger, FailMode, Incremental, JsDocTest, MirOpt, PassMode, Pretty, RunMake,
23-
RunPassValgrind, Rustdoc, RustdocJson, TestPaths, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR,
24-
UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, Ui, expected_output_path,
25-
incremental_dir, output_base_dir, output_base_name, output_testname_unique,
23+
Rustdoc, RustdocJson, TestPaths, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR, UI_RUN_STDOUT,
24+
UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, Ui, expected_output_path, incremental_dir,
25+
output_base_dir, output_base_name, output_testname_unique,
2626
};
2727
use crate::compute_diff::{write_diff, write_filtered_diff};
2828
use crate::errors::{self, Error, ErrorKind};
@@ -49,7 +49,6 @@ mod run_make;
4949
mod rustdoc;
5050
mod rustdoc_json;
5151
mod ui;
52-
mod valgrind;
5352
// tidy-alphabet-end
5453

5554
#[cfg(test)]
@@ -253,7 +252,6 @@ impl<'test> TestCx<'test> {
253252
self.fatal("cannot use should-ice in a test that is not cfail");
254253
}
255254
match self.config.mode {
256-
RunPassValgrind => self.run_valgrind_test(),
257255
Pretty => self.run_pretty_test(),
258256
DebugInfo => self.run_debuginfo_test(),
259257
Codegen => self.run_codegen_test(),
@@ -1500,8 +1498,7 @@ impl<'test> TestCx<'test> {
15001498
Crashes => {
15011499
set_mir_dump_dir(&mut rustc);
15021500
}
1503-
RunPassValgrind | Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake
1504-
| CodegenUnits | JsDocTest => {
1501+
Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake | CodegenUnits | JsDocTest => {
15051502
// do not use JSON output
15061503
}
15071504
}
@@ -2655,33 +2652,6 @@ impl<'test> TestCx<'test> {
26552652
}
26562653
}
26572654

2658-
// FIXME(jieyouxu): `run_rpass_test` is hoisted out here and not in incremental because
2659-
// apparently valgrind test falls back to `run_rpass_test` if valgrind isn't available, which
2660-
// seems highly questionable to me.
2661-
fn run_rpass_test(&self) {
2662-
let emit_metadata = self.should_emit_metadata(self.pass_mode());
2663-
let should_run = self.run_if_enabled();
2664-
let proc_res = self.compile_test(should_run, emit_metadata);
2665-
2666-
if !proc_res.status.success() {
2667-
self.fatal_proc_rec("compilation failed!", &proc_res);
2668-
}
2669-
2670-
// FIXME(#41968): Move this check to tidy?
2671-
if !errors::load_errors(&self.testpaths.file, self.revision).is_empty() {
2672-
self.fatal("run-pass tests with expected warnings should be moved to ui/");
2673-
}
2674-
2675-
if let WillExecute::Disabled = should_run {
2676-
return;
2677-
}
2678-
2679-
let proc_res = self.exec_compiled_test();
2680-
if !proc_res.status.success() {
2681-
self.fatal_proc_rec("test run failed!", &proc_res);
2682-
}
2683-
}
2684-
26852655
fn aggressive_rm_rf(&self, path: &Path) -> io::Result<()> {
26862656
for e in path.read_dir()? {
26872657
let entry = e?;

Diff for: src/tools/compiletest/src/runtest/incremental.rs

+24-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
use super::{TestCx, WillExecute};
22
use crate::errors;
33

4-
// FIXME(jieyouxu): `run_rpass_test` got hoisted out of this because apparently valgrind falls back
5-
// to `run_rpass_test` if valgrind isn't available, which is questionable, but keeping it for
6-
// refactoring changes to preserve current behavior.
7-
84
impl TestCx<'_> {
95
pub(super) fn run_incremental_test(&self) {
106
// Basic plan for a test incremental/foo/bar.rs:
@@ -73,6 +69,30 @@ impl TestCx<'_> {
7369
}
7470
}
7571

72+
fn run_rpass_test(&self) {
73+
let emit_metadata = self.should_emit_metadata(self.pass_mode());
74+
let should_run = self.run_if_enabled();
75+
let proc_res = self.compile_test(should_run, emit_metadata);
76+
77+
if !proc_res.status.success() {
78+
self.fatal_proc_rec("compilation failed!", &proc_res);
79+
}
80+
81+
// FIXME(#41968): Move this check to tidy?
82+
if !errors::load_errors(&self.testpaths.file, self.revision).is_empty() {
83+
self.fatal("run-pass tests with expected warnings should be moved to ui/");
84+
}
85+
86+
if let WillExecute::Disabled = should_run {
87+
return;
88+
}
89+
90+
let proc_res = self.exec_compiled_test();
91+
if !proc_res.status.success() {
92+
self.fatal_proc_rec("test run failed!", &proc_res);
93+
}
94+
}
95+
7696
fn run_cfail_test(&self) {
7797
let pm = self.pass_mode();
7898
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
@@ -115,12 +135,6 @@ impl TestCx<'_> {
115135

116136
let proc_res = self.exec_compiled_test();
117137

118-
// The value our Makefile configures valgrind to return on failure
119-
const VALGRIND_ERR: i32 = 100;
120-
if proc_res.status.code() == Some(VALGRIND_ERR) {
121-
self.fatal_proc_rec("run-fail test isn't valgrind-clean!", &proc_res);
122-
}
123-
124138
let output_to_check = self.get_output(&proc_res);
125139
self.check_correct_failure_status(&proc_res);
126140
self.check_all_error_patterns(&output_to_check, &proc_res, pm);

Diff for: src/tools/compiletest/src/runtest/valgrind.rs

-34
This file was deleted.

Diff for: src/tools/opt-dist/src/tests.rs

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ llvm-config = "{llvm_config}"
9696
"tests/incremental",
9797
"tests/mir-opt",
9898
"tests/pretty",
99-
"tests/run-pass-valgrind",
10099
"tests/ui",
101100
"tests/crashes",
102101
];

Diff for: tests/run-pass-valgrind/cast-enum-with-dtor.rs

-34
This file was deleted.

Diff for: tests/run-pass-valgrind/cleanup-auto-borrow-obj.rs

-28
This file was deleted.

Diff for: tests/run-pass-valgrind/cleanup-stdin.rs

-5
This file was deleted.

Diff for: tests/run-pass-valgrind/coerce-match-calls.rs

-21
This file was deleted.

Diff for: tests/run-pass-valgrind/coerce-match.rs

-31
This file was deleted.

0 commit comments

Comments
 (0)