Skip to content

Commit cecef7b

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

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
@@ -1933,7 +1933,8 @@ impl<'test> TestCx<'test> {
19331933
let mut test_client =
19341934
Command::new(self.config.remote_test_client.as_ref().unwrap());
19351935
test_client
1936-
.args(&["run", &support_libs.len().to_string(), &prog])
1936+
.args(&["run", &support_libs.len().to_string()])
1937+
.arg(&prog)
19371938
.args(support_libs)
19381939
.args(args);
19391940

@@ -2516,15 +2517,15 @@ impl<'test> TestCx<'test> {
25162517
// If this is emscripten, then run tests under nodejs
25172518
if self.config.target.contains("emscripten") {
25182519
if let Some(ref p) = self.config.nodejs {
2519-
args.push(p.clone());
2520+
args.push(p.into());
25202521
} else {
25212522
self.fatal("emscripten target requested and no NodeJS binary found (--nodejs)");
25222523
}
25232524
// If this is otherwise wasm, then run tests under nodejs with our
25242525
// shim
25252526
} else if self.config.target.contains("wasm32") {
25262527
if let Some(ref p) = self.config.nodejs {
2527-
args.push(p.clone());
2528+
args.push(p.into());
25282529
} else {
25292530
self.fatal("wasm32 target requested and no NodeJS binary found (--nodejs)");
25302531
}
@@ -2536,13 +2537,12 @@ impl<'test> TestCx<'test> {
25362537
.unwrap() // chop off `ui`
25372538
.parent()
25382539
.unwrap(); // chop off `tests`
2539-
args.push(src.join("src/etc/wasm32-shim.js").display().to_string());
2540+
args.push(src.join("src/etc/wasm32-shim.js").into_os_string());
25402541
}
25412542

25422543
let exe_file = self.make_exe_name();
25432544

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

25472547
// Add the arguments in the run_flags directive
25482548
args.extend(self.split_maybe_args(&self.props.run_flags));
@@ -2551,12 +2551,16 @@ impl<'test> TestCx<'test> {
25512551
ProcArgs { prog, args }
25522552
}
25532553

2554-
fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<String> {
2554+
fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<OsString> {
25552555
match *argstr {
25562556
Some(ref s) => s
25572557
.split(' ')
25582558
.filter_map(|s| {
2559-
if s.chars().all(|c| c.is_whitespace()) { None } else { Some(s.to_owned()) }
2559+
if s.chars().all(|c| c.is_whitespace()) {
2560+
None
2561+
} else {
2562+
Some(OsString::from(s))
2563+
}
25602564
})
25612565
.collect(),
25622566
None => Vec::new(),
@@ -4363,8 +4367,8 @@ impl<'test> TestCx<'test> {
43634367
}
43644368

43654369
struct ProcArgs {
4366-
prog: String,
4367-
args: Vec<String>,
4370+
prog: OsString,
4371+
args: Vec<OsString>,
43684372
}
43694373

43704374
pub struct ProcRes {

0 commit comments

Comments
 (0)