diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-10-05 19:49:32 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-10-15 22:18:30 -0700 |
| commit | d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd (patch) | |
| tree | e197783b86700e71d94c9bc6d0254eb25b16cc0c /src/compiletest | |
| parent | ed539e14712539473c3e89604cb69e2307110772 (diff) | |
| download | rust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.tar.gz rust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.zip | |
path2: Adjust the API to remove all the _str mutation methods
Add a new trait BytesContainer that is implemented for both byte vectors and strings. Convert Path::from_vec and ::from_str to one function, Path::new(). Remove all the _str-suffixed mutation methods (push, join, with_*, set_*) and modify the non-suffixed versions to use BytesContainer.
Diffstat (limited to 'src/compiletest')
| -rw-r--r-- | src/compiletest/compiletest.rs | 12 | ||||
| -rw-r--r-- | src/compiletest/header.rs | 2 | ||||
| -rw-r--r-- | src/compiletest/runtest.rs | 32 |
3 files changed, 23 insertions, 23 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index cc99f0d67d2..362d2ba749d 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -102,15 +102,15 @@ pub fn parse_config(args: ~[~str]) -> config { } fn opt_path(m: &getopts::Matches, nm: &str) -> Path { - Path::from_str(m.opt_str(nm).unwrap()) + Path::new(m.opt_str(nm).unwrap()) } config { compile_lib_path: matches.opt_str("compile-lib-path").unwrap(), run_lib_path: matches.opt_str("run-lib-path").unwrap(), rustc_path: opt_path(matches, "rustc-path"), - clang_path: matches.opt_str("clang-path").map(|s| Path::from_str(s)), - llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::from_str(s)), + clang_path: matches.opt_str("clang-path").map(|s| Path::new(s)), + llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::new(s)), src_base: opt_path(matches, "src-base"), build_base: opt_path(matches, "build-base"), aux_base: opt_path(matches, "aux-base"), @@ -123,10 +123,10 @@ pub fn parse_config(args: ~[~str]) -> config { } else { None }, - logfile: matches.opt_str("logfile").map(|s| Path::from_str(s)), - save_metrics: matches.opt_str("save-metrics").map(|s| Path::from_str(s)), + logfile: matches.opt_str("logfile").map(|s| Path::new(s)), + save_metrics: matches.opt_str("save-metrics").map(|s| Path::new(s)), ratchet_metrics: - matches.opt_str("ratchet-metrics").map(|s| Path::from_str(s)), + matches.opt_str("ratchet-metrics").map(|s| Path::new(s)), ratchet_noise_percent: matches.opt_str("ratchet-noise-percent").and_then(|s| from_str::<f64>(s)), runtool: matches.opt_str("runtool"), diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index bf68371c7d2..9cd3d3683cd 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -161,7 +161,7 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> { fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> { match parse_name_value_directive(line, ~"pp-exact") { - Some(s) => Some(Path::from_str(s)), + Some(s) => Some(Path::new(s)), None => { if parse_name_directive(line, "pp-exact") { testfile.file_path() diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index e1c4c34a5f4..b5b81f7b810 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -62,7 +62,7 @@ pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) { // We're going to be dumping a lot of info. Start on a new line. io::stdout().write_str("\n\n"); } - let testfile = Path::from_str(testfile); + let testfile = Path::new(testfile); debug2!("running {}", testfile.display()); let props = load_props(&testfile); debug2!("loaded props"); @@ -594,7 +594,7 @@ fn compose_and_run_compiler( let extra_link_args = ~[~"-L", aux_dir.as_str().unwrap().to_owned()]; for rel_ab in props.aux_builds.iter() { - let abs_ab = config.aux_base.join_str(*rel_ab); + let abs_ab = config.aux_base.join(rel_ab.as_slice()); let aux_args = make_compile_args(config, props, ~[~"--lib"] + extra_link_args, |a,b| make_lib_name(a, b, testfile), &abs_ab); @@ -662,7 +662,7 @@ fn make_lib_name(config: &config, auxfile: &Path, testfile: &Path) -> Path { fn make_exe_name(config: &config, testfile: &Path) -> Path { let mut f = output_base_name(config, testfile); - f.add_extension_str(os::EXE_EXTENSION); + f.add_extension(os::EXE_EXTENSION); f } @@ -742,23 +742,23 @@ fn dump_output_file(config: &config, testfile: &Path, } fn make_out_name(config: &config, testfile: &Path, extension: &str) -> Path { - output_base_name(config, testfile).with_extension_str(extension) + output_base_name(config, testfile).with_extension(extension) } fn aux_output_dir_name(config: &config, testfile: &Path) -> Path { let mut f = output_base_name(config, testfile); - f.add_extension_str("libaux"); + f.add_extension("libaux"); f } fn output_testname(testfile: &Path) -> Path { - Path::from_vec(testfile.filestem().unwrap()) + Path::new(testfile.filestem().unwrap()) } fn output_base_name(config: &config, testfile: &Path) -> Path { config.build_base .join_path(&output_testname(testfile)) - .with_extension_str(config.stage_id) + .with_extension(config.stage_id.as_slice()) } fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) { @@ -916,7 +916,7 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) { // codegen tests (vs. clang) fn make_o_name(config: &config, testfile: &Path) -> Path { - output_base_name(config, testfile).with_extension_str("o") + output_base_name(config, testfile).with_extension("o") } fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path { @@ -942,9 +942,9 @@ fn compile_test_and_save_bitcode(config: &config, props: &TestProps, fn compile_cc_with_clang_and_save_bitcode(config: &config, _props: &TestProps, testfile: &Path) -> ProcRes { - let bitcodefile = output_base_name(config, testfile).with_extension_str("bc"); + let bitcodefile = output_base_name(config, testfile).with_extension("bc"); let bitcodefile = append_suffix_to_stem(&bitcodefile, "clang"); - let testcc = testfile.with_extension_str("cc"); + let testcc = testfile.with_extension("cc"); let ProcArgs = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths prog: config.clang_path.get_ref().as_str().unwrap().to_owned(), @@ -959,10 +959,10 @@ fn compile_cc_with_clang_and_save_bitcode(config: &config, _props: &TestProps, fn extract_function_from_bitcode(config: &config, _props: &TestProps, fname: &str, testfile: &Path, suffix: &str) -> ProcRes { - let bitcodefile = output_base_name(config, testfile).with_extension_str("bc"); + let bitcodefile = output_base_name(config, testfile).with_extension("bc"); let bitcodefile = append_suffix_to_stem(&bitcodefile, suffix); let extracted_bc = append_suffix_to_stem(&bitcodefile, "extract"); - let prog = config.llvm_bin_path.get_ref().join_str("llvm-extract"); + let prog = config.llvm_bin_path.get_ref().join("llvm-extract"); let ProcArgs = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths prog: prog.as_str().unwrap().to_owned(), @@ -975,11 +975,11 @@ fn extract_function_from_bitcode(config: &config, _props: &TestProps, fn disassemble_extract(config: &config, _props: &TestProps, testfile: &Path, suffix: &str) -> ProcRes { - let bitcodefile = output_base_name(config, testfile).with_extension_str("bc"); + let bitcodefile = output_base_name(config, testfile).with_extension("bc"); let bitcodefile = append_suffix_to_stem(&bitcodefile, suffix); let extracted_bc = append_suffix_to_stem(&bitcodefile, "extract"); - let extracted_ll = extracted_bc.with_extension_str("ll"); - let prog = config.llvm_bin_path.get_ref().join_str("llvm-dis"); + let extracted_ll = extracted_bc.with_extension("ll"); + let prog = config.llvm_bin_path.get_ref().join("llvm-dis"); let ProcArgs = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths prog: prog.as_str().unwrap().to_owned(), @@ -991,7 +991,7 @@ fn disassemble_extract(config: &config, _props: &TestProps, fn count_extracted_lines(p: &Path) -> uint { - let x = io::read_whole_file_str(&p.with_extension_str("ll")).unwrap(); + let x = io::read_whole_file_str(&p.with_extension("ll")).unwrap(); x.line_iter().len() } |
