Skip to content

Commit a961be9

Browse files
committed
Remove valgrind test suite and support from compiletest
1 parent a964a92 commit a961be9

File tree

6 files changed

+29
-95
lines changed

6 files changed

+29
-95
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 0 additions & 8 deletions
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>,

src/tools/compiletest/src/lib.rs

Lines changed: 1 addition & 5 deletions
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),

src/tools/compiletest/src/main.rs

Lines changed: 0 additions & 4 deletions
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
}

src/tools/compiletest/src/runtest.rs

Lines changed: 4 additions & 34 deletions
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
}
@@ -2651,33 +2648,6 @@ impl<'test> TestCx<'test> {
26512648
}
26522649
}
26532650

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

src/tools/compiletest/src/runtest/incremental.rs

Lines changed: 24 additions & 10 deletions
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);

src/tools/compiletest/src/runtest/valgrind.rs

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

0 commit comments

Comments
 (0)