From 0e72c80afe9024ea7824579cd12c428264bb4783 Mon Sep 17 00:00:00 2001 From: Niv Kaminer Date: Mon, 17 Dec 2018 23:45:26 +0200 Subject: [PATCH] FIXME(9639) remove fixme and accept non-utf8 paths in compiletest --- src/tools/compiletest/src/runtest.rs | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 45527a7cce53..8c6e97893fb4 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -27,7 +27,7 @@ use util::{logv, PathBufExt}; use std::collections::hash_map::DefaultHasher; use std::collections::{HashMap, HashSet, VecDeque}; use std::env; -use std::ffi::OsString; +use std::ffi::{OsStr, OsString}; use std::fmt; use std::fs::{self, create_dir_all, File}; use std::hash::{Hash, Hasher}; @@ -760,13 +760,13 @@ impl<'test> TestCx<'test> { } drop(stdout); - let debugger_script = self.make_out_name("debugger.script"); - // FIXME (#9639): This needs to handle non-utf8 paths - let debugger_opts = vec![ - "-quiet".to_owned(), - "-batch".to_owned(), - "-nx".to_owned(), - format!("-command={}", debugger_script.to_str().unwrap()), + let mut debugger_script = OsString::from("-command="); + debugger_script.push(self.make_out_name("debugger.script")); + let debugger_opts: &[&OsStr] = &[ + "-quiet".as_ref(), + "-batch".as_ref(), + "-nx".as_ref(), + &debugger_script, ]; let gdb_path = self.config.gdb.as_ref().unwrap(); @@ -775,12 +775,12 @@ impl<'test> TestCx<'test> { stdout, stderr, } = Command::new(&gdb_path) - .args(&debugger_opts) + .args(debugger_opts) .output() .expect(&format!("failed to exec `{:?}`", gdb_path)); let cmdline = { let mut gdb = Command::new(&format!("{}-gdb", self.config.target)); - gdb.args(&debugger_opts); + gdb.args(debugger_opts); let cmdline = self.make_cmdline(&gdb, ""); logv(self.config, format!("executing {}", cmdline)); cmdline @@ -868,18 +868,18 @@ impl<'test> TestCx<'test> { debug!("script_str = {}", script_str); self.dump_output_file(&script_str, "debugger.script"); - let debugger_script = self.make_out_name("debugger.script"); + let mut debugger_script = OsString::from("-command="); + debugger_script.push(self.make_out_name("debugger.script")); - // FIXME (#9639): This needs to handle non-utf8 paths - let debugger_opts = vec![ - "-quiet".to_owned(), - "-batch".to_owned(), - "-nx".to_owned(), - format!("-command={}", debugger_script.to_str().unwrap()), + let debugger_opts: &[&OsStr] = &[ + "-quiet".as_ref(), + "-batch".as_ref(), + "-nx".as_ref(), + &debugger_script, ]; let mut gdb = Command::new(self.config.gdb.as_ref().unwrap()); - gdb.args(&debugger_opts) + gdb.args(debugger_opts) .env("PYTHONPATH", rust_pp_module_abs_path); debugger_run_result = self.compose_and_run(