From e95bda62f94e9eeeef38c0aa105ee0c85a82cc2f Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Tue, 19 Apr 2022 21:01:13 -0400 Subject: [PATCH] compiletest: combine `--*-python` args Since these arguments are now always the same, combine them into a singular `--python` argument. --- src/bootstrap/test.rs | 4 +--- src/tools/compiletest/src/common.rs | 7 ++----- src/tools/compiletest/src/header/tests.rs | 3 +-- src/tools/compiletest/src/main.rs | 6 ++---- src/tools/compiletest/src/runtest.rs | 10 +++++----- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index da4689098119f..9c376602d283f 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1400,9 +1400,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the targetflags.extend(builder.lld_flags(target)); cmd.arg("--target-rustcflags").arg(targetflags.join(" ")); - cmd.arg("--docck-python").arg(builder.python()); - - cmd.arg("--lldb-python").arg(builder.python()); + cmd.arg("--python").arg(builder.python()); if let Some(ref gdb) = builder.config.gdb { cmd.arg("--gdb").arg(gdb); diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 1bf6e6d011e5c..2cb368c688188 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -198,11 +198,8 @@ pub struct Config { /// The rust-demangler executable. pub rust_demangler_path: Option, - /// The Python executable to use for LLDB. - pub lldb_python: String, - - /// The Python executable to use for htmldocck. - pub docck_python: String, + /// The Python executable to use for LLDB and htmldocck. + pub python: String, /// The jsondocck executable. pub jsondocck_path: Option, diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index 5b144a1020f4c..a8fd4880f0782 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -43,8 +43,7 @@ fn config() -> Config { "--compile-lib-path=", "--run-lib-path=", "--rustc-path=", - "--lldb-python=", - "--docck-python=", + "--python=", "--jsondocck-path=", "--src-base=", "--build-base=", diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 8c1f28f140768..f4e6c2a2bb288 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -61,8 +61,7 @@ pub fn parse_config(args: Vec) -> Config { .reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH") .optopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH") .optopt("", "rust-demangler-path", "path to rust-demangler to use in tests", "PATH") - .reqopt("", "lldb-python", "path to python to use for doc tests", "PATH") - .reqopt("", "docck-python", "path to python to use for doc tests", "PATH") + .reqopt("", "python", "path to python to use for doc tests", "PATH") .optopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH") .optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM") .optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind") @@ -222,8 +221,7 @@ pub fn parse_config(args: Vec) -> Config { rustc_path: opt_path(matches, "rustc-path"), rustdoc_path: matches.opt_str("rustdoc-path").map(PathBuf::from), rust_demangler_path: matches.opt_str("rust-demangler-path").map(PathBuf::from), - lldb_python: matches.opt_str("lldb-python").unwrap(), - docck_python: matches.opt_str("docck-python").unwrap(), + python: matches.opt_str("python").unwrap(), jsondocck_path: matches.opt_str("jsondocck-path"), valgrind_path: matches.opt_str("valgrind-path"), force_valgrind: matches.opt_present("force-valgrind"), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 6b27d1ecbf550..aedddedac6184 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -179,7 +179,7 @@ pub fn compute_stamp_hash(config: &Config) -> String { } Some(Debugger::Lldb) => { - config.lldb_python.hash(&mut hash); + config.python.hash(&mut hash); config.lldb_python_dir.hash(&mut hash); env::var_os("PATH").hash(&mut hash); env::var_os("PYTHONPATH").hash(&mut hash); @@ -1141,7 +1141,7 @@ impl<'test> TestCx<'test> { // Prepare the lldb_batchmode which executes the debugger script let lldb_script_path = rust_src_root.join("src/etc/lldb_batchmode.py"); self.cmd2procres( - Command::new(&self.config.lldb_python) + Command::new(&self.config.python) .arg(&lldb_script_path) .arg(test_executable) .arg(debugger_script) @@ -2256,7 +2256,7 @@ impl<'test> TestCx<'test> { self.check_rustdoc_test_option(proc_res); } else { let root = self.config.find_rust_src_root().unwrap(); - let mut cmd = Command::new(&self.config.docck_python); + let mut cmd = Command::new(&self.config.python); cmd.arg(root.join("src/etc/htmldocck.py")).arg(&out_dir).arg(&self.testpaths.file); if self.config.bless { cmd.arg("--bless"); @@ -2457,7 +2457,7 @@ impl<'test> TestCx<'test> { let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap()); json_out.set_extension("json"); let res = self.cmd2procres( - Command::new(&self.config.docck_python) + Command::new(&self.config.python) .arg(root.join("src/etc/check_missing_items.py")) .arg(&json_out), ); @@ -2852,7 +2852,7 @@ impl<'test> TestCx<'test> { .stdout(Stdio::piped()) .stderr(Stdio::piped()) .env("TARGET", &self.config.target) - .env("PYTHON", &self.config.docck_python) + .env("PYTHON", &self.config.python) .env("S", src_root) .env("RUST_BUILD_STAGE", &self.config.stage_id) .env("RUSTC", cwd.join(&self.config.rustc_path))