Skip to content

Commit

Permalink
compiletest: combine --*-python args
Browse files Browse the repository at this point in the history
Since these arguments are now always the same, combine them into a
singular `--python` argument.
  • Loading branch information
algo-cloudflare committed Apr 20, 2022
1 parent 4ca19e0 commit e95bda6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
4 changes: 1 addition & 3 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 2 additions & 5 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,8 @@ pub struct Config {
/// The rust-demangler executable.
pub rust_demangler_path: Option<PathBuf>,

/// 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<String>,
Expand Down
3 changes: 1 addition & 2 deletions src/tools/compiletest/src/header/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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=",
Expand Down
6 changes: 2 additions & 4 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ pub fn parse_config(args: Vec<String>) -> 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")
Expand Down Expand Up @@ -222,8 +221,7 @@ pub fn parse_config(args: Vec<String>) -> 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"),
Expand Down
10 changes: 5 additions & 5 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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),
);
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit e95bda6

Please sign in to comment.