Skip to content

Commit 90d93c3

Browse files
authored
Rollup merge of #114429 - Enselic:compiletest-fix, r=est31
compiletest: Handle non-utf8 paths (fix FIXME) Removes the last FIXME in the code for #9639 🎉 (which was closed 8 years ago) Part of #44366 which is E-help-wanted. (The other two PRs that does this are #114377 and #114427)
2 parents eb19abf + f15832f commit 90d93c3

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/tools/compiletest/src/runtest.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,8 @@ impl<'test> TestCx<'test> {
19391939
let mut test_client =
19401940
Command::new(self.config.remote_test_client.as_ref().unwrap());
19411941
test_client
1942-
.args(&["run", &support_libs.len().to_string(), &prog])
1942+
.args(&["run", &support_libs.len().to_string()])
1943+
.arg(&prog)
19431944
.args(support_libs)
19441945
.args(args);
19451946

@@ -2525,15 +2526,15 @@ impl<'test> TestCx<'test> {
25252526
// If this is emscripten, then run tests under nodejs
25262527
if self.config.target.contains("emscripten") {
25272528
if let Some(ref p) = self.config.nodejs {
2528-
args.push(p.clone());
2529+
args.push(p.into());
25292530
} else {
25302531
self.fatal("emscripten target requested and no NodeJS binary found (--nodejs)");
25312532
}
25322533
// If this is otherwise wasm, then run tests under nodejs with our
25332534
// shim
25342535
} else if self.config.target.contains("wasm32") {
25352536
if let Some(ref p) = self.config.nodejs {
2536-
args.push(p.clone());
2537+
args.push(p.into());
25372538
} else {
25382539
self.fatal("wasm32 target requested and no NodeJS binary found (--nodejs)");
25392540
}
@@ -2545,13 +2546,12 @@ impl<'test> TestCx<'test> {
25452546
.unwrap() // chop off `ui`
25462547
.parent()
25472548
.unwrap(); // chop off `tests`
2548-
args.push(src.join("src/etc/wasm32-shim.js").display().to_string());
2549+
args.push(src.join("src/etc/wasm32-shim.js").into_os_string());
25492550
}
25502551

25512552
let exe_file = self.make_exe_name();
25522553

2553-
// FIXME (#9639): This needs to handle non-utf8 paths
2554-
args.push(exe_file.to_str().unwrap().to_owned());
2554+
args.push(exe_file.into_os_string());
25552555

25562556
// Add the arguments in the run_flags directive
25572557
args.extend(self.split_maybe_args(&self.props.run_flags));
@@ -2560,12 +2560,16 @@ impl<'test> TestCx<'test> {
25602560
ProcArgs { prog, args }
25612561
}
25622562

2563-
fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<String> {
2563+
fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<OsString> {
25642564
match *argstr {
25652565
Some(ref s) => s
25662566
.split(' ')
25672567
.filter_map(|s| {
2568-
if s.chars().all(|c| c.is_whitespace()) { None } else { Some(s.to_owned()) }
2568+
if s.chars().all(|c| c.is_whitespace()) {
2569+
None
2570+
} else {
2571+
Some(OsString::from(s))
2572+
}
25692573
})
25702574
.collect(),
25712575
None => Vec::new(),
@@ -4372,8 +4376,8 @@ impl<'test> TestCx<'test> {
43724376
}
43734377

43744378
struct ProcArgs {
4375-
prog: String,
4376-
args: Vec<String>,
4379+
prog: OsString,
4380+
args: Vec<OsString>,
43774381
}
43784382

43794383
pub struct ProcRes {

0 commit comments

Comments
 (0)