Rollup merge of #139609 - jieyouxu:compiletest-path-misc, r=Kobzol
compiletest: don't use stringly paths for `compose_and_run`
Eventually I'd like to fully migrate to `camino`'s `{Utf8Path,Utf8PathBuf}` because compiletest assumes UTF-8 paths all over the place, so this is an precursor change to make the migration diff cleaner.
r? `@Kobzol` (or bootstrap/compiler)
This commit is contained in:
commit
362c0f2711
2 changed files with 23 additions and 22 deletions
|
|
@ -445,8 +445,8 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
self.compose_and_run(
|
||||
rustc,
|
||||
self.config.compile_lib_path.to_str().unwrap(),
|
||||
Some(aux_dir.to_str().unwrap()),
|
||||
self.config.compile_lib_path.as_path(),
|
||||
Some(aux_dir.as_path()),
|
||||
src,
|
||||
)
|
||||
}
|
||||
|
|
@ -1020,8 +1020,8 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
self.compose_and_run(
|
||||
test_client,
|
||||
self.config.run_lib_path.to_str().unwrap(),
|
||||
Some(aux_dir.to_str().unwrap()),
|
||||
self.config.run_lib_path.as_path(),
|
||||
Some(aux_dir.as_path()),
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
@ -1035,8 +1035,8 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
self.compose_and_run(
|
||||
wr_run,
|
||||
self.config.run_lib_path.to_str().unwrap(),
|
||||
Some(aux_dir.to_str().unwrap()),
|
||||
self.config.run_lib_path.as_path(),
|
||||
Some(aux_dir.as_path()),
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
@ -1050,8 +1050,8 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
self.compose_and_run(
|
||||
program,
|
||||
self.config.run_lib_path.to_str().unwrap(),
|
||||
Some(aux_dir.to_str().unwrap()),
|
||||
self.config.run_lib_path.as_path(),
|
||||
Some(aux_dir.as_path()),
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
@ -1197,8 +1197,8 @@ impl<'test> TestCx<'test> {
|
|||
self.props.unset_rustc_env.iter().fold(&mut rustc, Command::env_remove);
|
||||
self.compose_and_run(
|
||||
rustc,
|
||||
self.config.compile_lib_path.to_str().unwrap(),
|
||||
Some(aux_dir.to_str().unwrap()),
|
||||
self.config.compile_lib_path.as_path(),
|
||||
Some(aux_dir.as_path()),
|
||||
input,
|
||||
)
|
||||
}
|
||||
|
|
@ -1219,8 +1219,7 @@ impl<'test> TestCx<'test> {
|
|||
rustc.args(&["--crate-type", "rlib"]);
|
||||
rustc.arg("-Cpanic=abort");
|
||||
|
||||
let res =
|
||||
self.compose_and_run(rustc, self.config.compile_lib_path.to_str().unwrap(), None, None);
|
||||
let res = self.compose_and_run(rustc, self.config.compile_lib_path.as_path(), None, None);
|
||||
if !res.status.success() {
|
||||
self.fatal_proc_rec(
|
||||
&format!(
|
||||
|
|
@ -1332,8 +1331,8 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
let auxres = aux_cx.compose_and_run(
|
||||
aux_rustc,
|
||||
aux_cx.config.compile_lib_path.to_str().unwrap(),
|
||||
Some(aux_dir.to_str().unwrap()),
|
||||
aux_cx.config.compile_lib_path.as_path(),
|
||||
Some(aux_dir.as_path()),
|
||||
None,
|
||||
);
|
||||
if !auxres.status.success() {
|
||||
|
|
@ -1373,8 +1372,8 @@ impl<'test> TestCx<'test> {
|
|||
fn compose_and_run(
|
||||
&self,
|
||||
mut command: Command,
|
||||
lib_path: &str,
|
||||
aux_path: Option<&str>,
|
||||
lib_path: &Path,
|
||||
aux_path: Option<&Path>,
|
||||
input: Option<String>,
|
||||
) -> ProcRes {
|
||||
let cmdline = {
|
||||
|
|
@ -1806,7 +1805,7 @@ impl<'test> TestCx<'test> {
|
|||
}
|
||||
}
|
||||
|
||||
fn make_cmdline(&self, command: &Command, libpath: &str) -> String {
|
||||
fn make_cmdline(&self, command: &Command, libpath: &Path) -> String {
|
||||
use crate::util;
|
||||
|
||||
// Linux and mac don't require adjusting the library search path
|
||||
|
|
@ -1819,7 +1818,7 @@ impl<'test> TestCx<'test> {
|
|||
format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path))
|
||||
}
|
||||
|
||||
format!("{} {:?}", lib_path_cmd_prefix(libpath), command)
|
||||
format!("{} {:?}", lib_path_cmd_prefix(libpath.to_str().unwrap()), command)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1980,7 +1979,8 @@ impl<'test> TestCx<'test> {
|
|||
// Add custom flags supplied by the `filecheck-flags:` test header.
|
||||
filecheck.args(&self.props.filecheck_flags);
|
||||
|
||||
self.compose_and_run(filecheck, "", None, None)
|
||||
// FIXME(jieyouxu): don't pass an empty Path
|
||||
self.compose_and_run(filecheck, Path::new(""), None, None)
|
||||
}
|
||||
|
||||
fn charset() -> &'static str {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ impl TestCx<'_> {
|
|||
|
||||
let debugger_run_result = self.compose_and_run(
|
||||
cdb,
|
||||
self.config.run_lib_path.to_str().unwrap(),
|
||||
self.config.run_lib_path.as_path(),
|
||||
None, // aux_path
|
||||
None, // input
|
||||
);
|
||||
|
|
@ -241,7 +241,8 @@ impl TestCx<'_> {
|
|||
let cmdline = {
|
||||
let mut gdb = Command::new(&format!("{}-gdb", self.config.target));
|
||||
gdb.args(debugger_opts);
|
||||
let cmdline = self.make_cmdline(&gdb, "");
|
||||
// FIXME(jieyouxu): don't pass an empty Path
|
||||
let cmdline = self.make_cmdline(&gdb, Path::new(""));
|
||||
logv(self.config, format!("executing {}", cmdline));
|
||||
cmdline
|
||||
};
|
||||
|
|
@ -340,7 +341,7 @@ impl TestCx<'_> {
|
|||
gdb.args(debugger_opts).env("PYTHONPATH", pythonpath);
|
||||
|
||||
debugger_run_result =
|
||||
self.compose_and_run(gdb, self.config.run_lib_path.to_str().unwrap(), None, None);
|
||||
self.compose_and_run(gdb, self.config.run_lib_path.as_path(), None, None);
|
||||
}
|
||||
|
||||
if !debugger_run_result.status.success() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue