about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-05-14 20:47:24 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-05-16 11:41:26 -0700
commit78bc758c94ae9c99b8e4e82f7d18b6733c8eb949 (patch)
treef6d747176f2a08a0cd123adfadef4c3f215c6b4c
parentbbd034c3a6e0325da0cb743cab007d69a736557a (diff)
downloadrust-78bc758c94ae9c99b8e4e82f7d18b6733c8eb949.tar.gz
rust-78bc758c94ae9c99b8e4e82f7d18b6733c8eb949.zip
compiletest: Remove all uses of `~str` from `compiletest`
-rw-r--r--src/compiletest/common.rs22
-rw-r--r--src/compiletest/compiletest.rs140
-rw-r--r--src/compiletest/errors.rs42
-rw-r--r--src/compiletest/header.rs89
-rw-r--r--src/compiletest/procsrv.rs43
-rw-r--r--src/compiletest/runtest.rs774
-rw-r--r--src/compiletest/util.rs14
7 files changed, 699 insertions, 425 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index 695c0420e2b..a7f693da6cc 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -56,10 +56,10 @@ impl fmt::Show for Mode {
 #[deriving(Clone)]
 pub struct Config {
     // The library paths required for running the compiler
-    pub compile_lib_path: ~str,
+    pub compile_lib_path: StrBuf,
 
     // The library paths required for running compiled programs
-    pub run_lib_path: ~str,
+    pub run_lib_path: StrBuf,
 
     // The rustc executable
     pub rustc_path: Path,
@@ -80,7 +80,7 @@ pub struct Config {
     pub aux_base: Path,
 
     // The name of the stage being built (stage1, etc)
-    pub stage_id: ~str,
+    pub stage_id: StrBuf,
 
     // The test mode, compile-fail, run-fail, run-pass
     pub mode: Mode,
@@ -110,37 +110,37 @@ pub struct Config {
 
     // A command line to prefix program execution with,
     // for running under valgrind
-    pub runtool: Option<~str>,
+    pub runtool: Option<StrBuf>,
 
     // Flags to pass to the compiler when building for the host
-    pub host_rustcflags: Option<~str>,
+    pub host_rustcflags: Option<StrBuf>,
 
     // Flags to pass to the compiler when building for the target
-    pub target_rustcflags: Option<~str>,
+    pub target_rustcflags: Option<StrBuf>,
 
     // Run tests using the JIT
     pub jit: bool,
 
     // Target system to be tested
-    pub target: ~str,
+    pub target: StrBuf,
 
     // Host triple for the compiler being invoked
-    pub host: ~str,
+    pub host: StrBuf,
 
     // Path to the android tools
     pub android_cross_path: Path,
 
     // Extra parameter to run adb on arm-linux-androideabi
-    pub adb_path: ~str,
+    pub adb_path: StrBuf,
 
     // Extra parameter to run test sute on arm-linux-androideabi
-    pub adb_test_dir: ~str,
+    pub adb_test_dir: StrBuf,
 
     // status whether android device available or not
     pub adb_device_status: bool,
 
     // the path containing LLDB's Python module
-    pub lldb_python_dir: Option<~str>,
+    pub lldb_python_dir: Option<StrBuf>,
 
     // Explain what's going on
     pub verbose: bool
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 3b57e3e98ca..feae84e7d87 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -48,12 +48,14 @@ fn start(argc: int, argv: **u8) -> int {
 
 pub fn main() {
     let args = os::args();
-    let config = parse_config(args.move_iter().collect());
+    let config = parse_config(args.move_iter()
+                                  .map(|x| x.to_strbuf())
+                                  .collect());
     log_config(&config);
     run_tests(&config);
 }
 
-pub fn parse_config(args: Vec<~str> ) -> Config {
+pub fn parse_config(args: Vec<StrBuf> ) -> Config {
 
     let groups : Vec<getopts::OptGroup> =
         vec!(reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
@@ -91,7 +93,7 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
     assert!(!args.is_empty());
     let argv0 = (*args.get(0)).clone();
     let args_ = args.tail();
-    if *args.get(1) == "-h".to_owned() || *args.get(1) == "--help".to_owned() {
+    if args.get(1).as_slice() == "-h" || args.get(1).as_slice() == "--help" {
         let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
         println!("{}", getopts::usage(message, groups.as_slice()));
         println!("");
@@ -99,7 +101,11 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
     }
 
     let matches =
-        &match getopts::getopts(args_, groups.as_slice()) {
+        &match getopts::getopts(args_.iter()
+                                     .map(|x| x.to_owned())
+                                     .collect::<Vec<_>>()
+                                     .as_slice(),
+                                groups.as_slice()) {
           Ok(m) => m,
           Err(f) => fail!("{}", f.to_err_msg())
         };
@@ -129,15 +135,17 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
     };
 
     Config {
-        compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
-        run_lib_path: matches.opt_str("run-lib-path").unwrap(),
+        compile_lib_path: matches.opt_str("compile-lib-path")
+                                 .unwrap()
+                                 .to_strbuf(),
+        run_lib_path: matches.opt_str("run-lib-path").unwrap().to_strbuf(),
         rustc_path: opt_path(matches, "rustc-path"),
         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"),
-        stage_id: matches.opt_str("stage-id").unwrap(),
+        stage_id: matches.opt_str("stage-id").unwrap().to_strbuf(),
         mode: FromStr::from_str(matches.opt_str("mode").unwrap()).expect("invalid mode"),
         run_ignored: matches.opt_present("ignored"),
         filter: filter,
@@ -147,21 +155,30 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
             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"),
-        host_rustcflags: matches.opt_str("host-rustcflags"),
-        target_rustcflags: matches.opt_str("target-rustcflags"),
+        runtool: matches.opt_str("runtool").map(|x| x.to_strbuf()),
+        host_rustcflags: matches.opt_str("host-rustcflags")
+                                .map(|x| x.to_strbuf()),
+        target_rustcflags: matches.opt_str("target-rustcflags")
+                                  .map(|x| x.to_strbuf()),
         jit: matches.opt_present("jit"),
-        target: opt_str2(matches.opt_str("target")).to_str(),
-        host: opt_str2(matches.opt_str("host")).to_str(),
+        target: opt_str2(matches.opt_str("target").map(|x| x.to_strbuf())),
+        host: opt_str2(matches.opt_str("host").map(|x| x.to_strbuf())),
         android_cross_path: opt_path(matches, "android-cross-path"),
-        adb_path: opt_str2(matches.opt_str("adb-path")).to_str(),
-        adb_test_dir:
-            opt_str2(matches.opt_str("adb-test-dir")).to_str(),
+        adb_path: opt_str2(matches.opt_str("adb-path")
+                                  .map(|x| x.to_strbuf())),
+        adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")
+                                      .map(|x| x.to_strbuf())),
         adb_device_status:
-            "arm-linux-androideabi" == opt_str2(matches.opt_str("target")) &&
-            "(none)" != opt_str2(matches.opt_str("adb-test-dir")) &&
-            !opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
-        lldb_python_dir: matches.opt_str("lldb-python-dir"),
+            "arm-linux-androideabi" ==
+                opt_str2(matches.opt_str("target")
+                                .map(|x| x.to_strbuf())).as_slice() &&
+            "(none)" !=
+                opt_str2(matches.opt_str("adb-test-dir")
+                                .map(|x| x.to_strbuf())).as_slice() &&
+            !opt_str2(matches.opt_str("adb-test-dir")
+                             .map(|x| x.to_strbuf())).is_empty(),
+        lldb_python_dir: matches.opt_str("lldb-python-dir")
+                                .map(|x| x.to_strbuf()),
         test_shard: test::opt_shard(matches.opt_str("test-shard")
                                            .map(|x| x.to_strbuf())),
         verbose: matches.opt_present("verbose")
@@ -170,50 +187,59 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
 
 pub fn log_config(config: &Config) {
     let c = config;
-    logv(c, format!("configuration:"));
-    logv(c, format!("compile_lib_path: {}", config.compile_lib_path));
-    logv(c, format!("run_lib_path: {}", config.run_lib_path));
-    logv(c, format!("rustc_path: {}", config.rustc_path.display()));
-    logv(c, format!("src_base: {}", config.src_base.display()));
-    logv(c, format!("build_base: {}", config.build_base.display()));
-    logv(c, format!("stage_id: {}", config.stage_id));
-    logv(c, format!("mode: {}", config.mode));
-    logv(c, format!("run_ignored: {}", config.run_ignored));
-    logv(c, format!("filter: {}", opt_str(&config.filter.as_ref().map(|re| re.to_str()))));
-    logv(c, format!("runtool: {}", opt_str(&config.runtool)));
-    logv(c, format!("host-rustcflags: {}", opt_str(&config.host_rustcflags)));
-    logv(c, format!("target-rustcflags: {}", opt_str(&config.target_rustcflags)));
-    logv(c, format!("jit: {}", config.jit));
-    logv(c, format!("target: {}", config.target));
-    logv(c, format!("host: {}", config.host));
-    logv(c, format!("android-cross-path: {}", config.android_cross_path.display()));
-    logv(c, format!("adb_path: {}", config.adb_path));
-    logv(c, format!("adb_test_dir: {}", config.adb_test_dir));
-    logv(c, format!("adb_device_status: {}", config.adb_device_status));
+    logv(c, format_strbuf!("configuration:"));
+    logv(c, format_strbuf!("compile_lib_path: {}", config.compile_lib_path));
+    logv(c, format_strbuf!("run_lib_path: {}", config.run_lib_path));
+    logv(c, format_strbuf!("rustc_path: {}", config.rustc_path.display()));
+    logv(c, format_strbuf!("src_base: {}", config.src_base.display()));
+    logv(c, format_strbuf!("build_base: {}", config.build_base.display()));
+    logv(c, format_strbuf!("stage_id: {}", config.stage_id));
+    logv(c, format_strbuf!("mode: {}", config.mode));
+    logv(c, format_strbuf!("run_ignored: {}", config.run_ignored));
+    logv(c, format_strbuf!("filter: {}",
+                           opt_str(&config.filter
+                                          .as_ref()
+                                          .map(|re| {
+                                              re.to_str().into_strbuf()
+                                          }))));
+    logv(c, format_strbuf!("runtool: {}", opt_str(&config.runtool)));
+    logv(c, format_strbuf!("host-rustcflags: {}",
+                           opt_str(&config.host_rustcflags)));
+    logv(c, format_strbuf!("target-rustcflags: {}",
+                           opt_str(&config.target_rustcflags)));
+    logv(c, format_strbuf!("jit: {}", config.jit));
+    logv(c, format_strbuf!("target: {}", config.target));
+    logv(c, format_strbuf!("host: {}", config.host));
+    logv(c, format_strbuf!("android-cross-path: {}",
+                           config.android_cross_path.display()));
+    logv(c, format_strbuf!("adb_path: {}", config.adb_path));
+    logv(c, format_strbuf!("adb_test_dir: {}", config.adb_test_dir));
+    logv(c, format_strbuf!("adb_device_status: {}",
+                           config.adb_device_status));
     match config.test_shard {
-        None => logv(c, "test_shard: (all)".to_owned()),
-        Some((a,b)) => logv(c, format!("test_shard: {}.{}", a, b))
+        None => logv(c, "test_shard: (all)".to_strbuf()),
+        Some((a,b)) => logv(c, format_strbuf!("test_shard: {}.{}", a, b))
     }
-    logv(c, format!("verbose: {}", config.verbose));
-    logv(c, format!("\n"));
+    logv(c, format_strbuf!("verbose: {}", config.verbose));
+    logv(c, format_strbuf!("\n"));
 }
 
-pub fn opt_str<'a>(maybestr: &'a Option<~str>) -> &'a str {
+pub fn opt_str<'a>(maybestr: &'a Option<StrBuf>) -> &'a str {
     match *maybestr {
         None => "(none)",
-        Some(ref s) => {
-            let s: &'a str = *s;
-            s
-        }
+        Some(ref s) => s.as_slice(),
     }
 }
 
-pub fn opt_str2(maybestr: Option<~str>) -> ~str {
-    match maybestr { None => "(none)".to_owned(), Some(s) => { s } }
+pub fn opt_str2(maybestr: Option<StrBuf>) -> StrBuf {
+    match maybestr {
+        None => "(none)".to_strbuf(),
+        Some(s) => s,
+    }
 }
 
 pub fn run_tests(config: &Config) {
-    if config.target == "arm-linux-androideabi".to_owned() {
+    if config.target.as_slice() == "arm-linux-androideabi" {
         match config.mode {
             DebugInfoGdb => {
                 println!("arm-linux-androideabi debug-info \
@@ -321,11 +347,11 @@ pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn)
 pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName {
 
     // Try to elide redundant long paths
-    fn shorten(path: &Path) -> ~str {
+    fn shorten(path: &Path) -> StrBuf {
         let filename = path.filename_str();
         let p = path.dir_path();
         let dir = p.filename_str();
-        format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or(""))
+        format_strbuf!("{}/{}", dir.unwrap_or(""), filename.unwrap_or(""))
     }
 
     test::DynTestName(format_strbuf!("[{}] {}",
@@ -336,14 +362,16 @@ pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName {
 pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn {
     let config = (*config).clone();
     // FIXME (#9639): This needs to handle non-utf8 paths
-    let testfile = testfile.as_str().unwrap().to_owned();
-    test::DynTestFn(proc() { runtest::run(config, testfile) })
+    let testfile = testfile.as_str().unwrap().to_strbuf();
+    test::DynTestFn(proc() {
+        runtest::run(config, testfile)
+    })
 }
 
 pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::TestFn {
     let config = (*config).clone();
     // FIXME (#9639): This needs to handle non-utf8 paths
-    let testfile = testfile.as_str().unwrap().to_owned();
+    let testfile = testfile.as_str().unwrap().to_strbuf();
     test::DynMetricFn(proc(mm) {
         runtest::run_metrics(config, testfile, mm)
     })
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs
index 9300cee432f..4e65115caa2 100644
--- a/src/compiletest/errors.rs
+++ b/src/compiletest/errors.rs
@@ -12,8 +12,8 @@ use std::io::{BufferedReader, File};
 
 pub struct ExpectedError {
     pub line: uint,
-    pub kind: ~str,
-    pub msg: ~str,
+    pub kind: StrBuf,
+    pub msg: StrBuf,
 }
 
 // Load any test directives embedded in the file
@@ -23,17 +23,18 @@ pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
     let mut rdr = BufferedReader::new(File::open(testfile).unwrap());
     let mut line_num = 1u;
     for ln in rdr.lines() {
-        error_patterns.push_all_move(parse_expected(line_num, ln.unwrap()));
+        error_patterns.push_all_move(parse_expected(line_num,
+                                                    ln.unwrap().to_strbuf()));
         line_num += 1u;
     }
     return error_patterns;
 }
 
-fn parse_expected(line_num: uint, line: ~str) -> Vec<ExpectedError> {
-    let line = line.trim();
-    let error_tag = "//~".to_owned();
+fn parse_expected(line_num: uint, line: StrBuf) -> Vec<ExpectedError> {
+    let line = line.as_slice().trim().to_strbuf();
+    let error_tag = "//~".to_strbuf();
     let mut idx;
-    match line.find_str(error_tag) {
+    match line.as_slice().find_str(error_tag.as_slice()) {
       None => return Vec::new(),
       Some(nn) => { idx = (nn as uint) + error_tag.len(); }
     }
@@ -42,25 +43,34 @@ fn parse_expected(line_num: uint, line: ~str) -> Vec<ExpectedError> {
     // three lines above current line:
     let mut adjust_line = 0u;
     let len = line.len();
-    while idx < len && line[idx] == ('^' as u8) {
+    while idx < len && line.as_slice()[idx] == ('^' as u8) {
         adjust_line += 1u;
         idx += 1u;
     }
 
     // Extract kind:
-    while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
+    while idx < len && line.as_slice()[idx] == (' ' as u8) {
+        idx += 1u;
+    }
     let start_kind = idx;
-    while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
+    while idx < len && line.as_slice()[idx] != (' ' as u8) {
+        idx += 1u;
+    }
 
-    let kind = line.slice(start_kind, idx);
-    let kind = kind.to_ascii().to_lower().into_str();
+    let kind = line.as_slice().slice(start_kind, idx);
+    let kind = kind.to_ascii().to_lower().into_str().to_strbuf();
 
     // Extract msg:
-    while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
-    let msg = line.slice(idx, len).to_owned();
+    while idx < len && line.as_slice()[idx] == (' ' as u8) {
+        idx += 1u;
+    }
+    let msg = line.as_slice().slice(idx, len).to_strbuf();
 
     debug!("line={} kind={} msg={}", line_num - adjust_line, kind, msg);
 
-    return vec!(ExpectedError{line: line_num - adjust_line, kind: kind,
-                           msg: msg});
+    return vec!(ExpectedError{
+        line: line_num - adjust_line,
+        kind: kind,
+        msg: msg,
+    });
 }
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index 047be955477..5729a11d7ad 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -14,20 +14,20 @@ use util;
 
 pub struct TestProps {
     // Lines that should be expected, in order, on standard out
-    pub error_patterns: Vec<~str> ,
+    pub error_patterns: Vec<StrBuf> ,
     // Extra flags to pass to the compiler
-    pub compile_flags: Option<~str>,
+    pub compile_flags: Option<StrBuf>,
     // Extra flags to pass when the compiled code is run (such as --bench)
-    pub run_flags: Option<~str>,
+    pub run_flags: Option<StrBuf>,
     // If present, the name of a file that this test should match when
     // pretty-printed
     pub pp_exact: Option<Path>,
     // Modules from aux directory that should be compiled
-    pub aux_builds: Vec<~str> ,
+    pub aux_builds: Vec<StrBuf> ,
     // Environment settings to use during execution
-    pub exec_env: Vec<(~str,~str)> ,
+    pub exec_env: Vec<(StrBuf,StrBuf)> ,
     // Lines to check if they appear in the expected debugger output
-    pub check_lines: Vec<~str> ,
+    pub check_lines: Vec<StrBuf> ,
     // Flag to force a crate to be built with the host architecture
     pub force_host: bool,
     // Check stdout for error-pattern output as well as stderr
@@ -119,22 +119,30 @@ pub fn load_props(testfile: &Path) -> TestProps {
 }
 
 pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
-    fn ignore_target(config: &Config) -> ~str {
-        "ignore-".to_owned() + util::get_os(config.target)
+    fn ignore_target(config: &Config) -> StrBuf {
+        format_strbuf!("ignore-{}", util::get_os(config.target.as_slice()))
     }
-    fn ignore_stage(config: &Config) -> ~str {
-        "ignore-".to_owned() + config.stage_id.split('-').next().unwrap()
+    fn ignore_stage(config: &Config) -> StrBuf {
+        format_strbuf!("ignore-{}",
+                       config.stage_id.as_slice().split('-').next().unwrap())
     }
 
     let val = iter_header(testfile, |ln| {
-        if parse_name_directive(ln, "ignore-test") { false }
-        else if parse_name_directive(ln, ignore_target(config)) { false }
-        else if parse_name_directive(ln, ignore_stage(config)) { false }
-        else if config.mode == common::Pretty &&
-            parse_name_directive(ln, "ignore-pretty") { false }
-        else if config.target != config.host &&
-            parse_name_directive(ln, "ignore-cross-compile") { false }
-        else { true }
+        if parse_name_directive(ln, "ignore-test") {
+            false
+        } else if parse_name_directive(ln, ignore_target(config).as_slice()) {
+            false
+        } else if parse_name_directive(ln, ignore_stage(config).as_slice()) {
+            false
+        } else if config.mode == common::Pretty &&
+                parse_name_directive(ln, "ignore-pretty") {
+            false
+        } else if config.target != config.host &&
+                parse_name_directive(ln, "ignore-cross-compile") {
+            false
+        } else {
+            true
+        }
     });
 
     !val
@@ -156,24 +164,24 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
     return true;
 }
 
-fn parse_error_pattern(line: &str) -> Option<~str> {
-    parse_name_value_directive(line, "error-pattern".to_owned())
+fn parse_error_pattern(line: &str) -> Option<StrBuf> {
+    parse_name_value_directive(line, "error-pattern".to_strbuf())
 }
 
-fn parse_aux_build(line: &str) -> Option<~str> {
-    parse_name_value_directive(line, "aux-build".to_owned())
+fn parse_aux_build(line: &str) -> Option<StrBuf> {
+    parse_name_value_directive(line, "aux-build".to_strbuf())
 }
 
-fn parse_compile_flags(line: &str) -> Option<~str> {
-    parse_name_value_directive(line, "compile-flags".to_owned())
+fn parse_compile_flags(line: &str) -> Option<StrBuf> {
+    parse_name_value_directive(line, "compile-flags".to_strbuf())
 }
 
-fn parse_run_flags(line: &str) -> Option<~str> {
-    parse_name_value_directive(line, "run-flags".to_owned())
+fn parse_run_flags(line: &str) -> Option<StrBuf> {
+    parse_name_value_directive(line, "run-flags".to_strbuf())
 }
 
-fn parse_check_line(line: &str) -> Option<~str> {
-    parse_name_value_directive(line, "check".to_owned())
+fn parse_check_line(line: &str) -> Option<StrBuf> {
+    parse_name_value_directive(line, "check".to_strbuf())
 }
 
 fn parse_force_host(line: &str) -> bool {
@@ -192,13 +200,16 @@ fn parse_no_pretty_expanded(line: &str) -> bool {
     parse_name_directive(line, "no-pretty-expanded")
 }
 
-fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
-    parse_name_value_directive(line, "exec-env".to_owned()).map(|nv| {
+fn parse_exec_env(line: &str) -> Option<(StrBuf, StrBuf)> {
+    parse_name_value_directive(line, "exec-env".to_strbuf()).map(|nv| {
         // nv is either FOO or FOO=BAR
-        let mut strs: Vec<~str> = nv.splitn('=', 1).map(|s| s.to_owned()).collect();
+        let mut strs: Vec<StrBuf> = nv.as_slice()
+                                      .splitn('=', 1)
+                                      .map(|s| s.to_strbuf())
+                                      .collect();
 
         match strs.len() {
-          1u => (strs.pop().unwrap(), "".to_owned()),
+          1u => (strs.pop().unwrap(), "".to_strbuf()),
           2u => {
               let end = strs.pop().unwrap();
               (strs.pop().unwrap(), end)
@@ -209,7 +220,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".to_owned()) {
+    match parse_name_value_directive(line, "pp-exact".to_strbuf()) {
       Some(s) => Some(Path::new(s)),
       None => {
         if parse_name_directive(line, "pp-exact") {
@@ -225,14 +236,14 @@ fn parse_name_directive(line: &str, directive: &str) -> bool {
     line.contains(directive)
 }
 
-pub fn parse_name_value_directive(line: &str,
-                              directive: ~str) -> Option<~str> {
-    let keycolon = directive + ":";
-    match line.find_str(keycolon) {
+pub fn parse_name_value_directive(line: &str, directive: StrBuf)
+                                  -> Option<StrBuf> {
+    let keycolon = format_strbuf!("{}:", directive);
+    match line.find_str(keycolon.as_slice()) {
         Some(colon) => {
             let value = line.slice(colon + keycolon.len(),
-                                   line.len()).to_owned();
-            debug!("{}: {}", directive,  value);
+                                   line.len()).to_strbuf();
+            debug!("{}: {}", directive, value);
             Some(value)
         }
         None => None
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs
index 27a31ea909f..9f62fd7096c 100644
--- a/src/compiletest/procsrv.rs
+++ b/src/compiletest/procsrv.rs
@@ -13,7 +13,7 @@ use std::str;
 use std::io::process::{ProcessExit, Command, Process, ProcessOutput};
 
 #[cfg(target_os = "win32")]
-fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
+fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf, StrBuf)> {
     let env = os::env();
 
     // Make sure we include the aux directory in the path
@@ -22,14 +22,14 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
 
     let mut new_env: Vec<_> = env.move_iter().map(|(k, v)| {
         let new_v = if "PATH" == k {
-            format!("{};{};{}", v, lib_path, aux_path)
+            format_strbuf!("{};{};{}", v, lib_path, aux_path)
         } else {
-            v
+            v.to_strbuf()
         };
-        (k, new_v)
+        (k.to_strbuf(), new_v)
     }).collect();
     if prog.ends_with("rustc.exe") {
-        new_env.push(("RUST_THREADS".to_owned(), "1".to_owned()));
+        new_env.push(("RUST_THREADS".to_strbuf(), "1".to_strbuf()));
     }
     return new_env;
 }
@@ -37,11 +37,14 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "macos")]
 #[cfg(target_os = "freebsd")]
-fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
+fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf,StrBuf)> {
     // Make sure we include the aux directory in the path
     let aux_path = prog + ".libaux";
 
-    let mut env: Vec<(~str,~str)> = os::env().move_iter().collect();
+    let mut env: Vec<(StrBuf,StrBuf)> =
+        os::env().move_iter()
+                 .map(|(ref k, ref v)| (k.to_strbuf(), v.to_strbuf()))
+                 .collect();
     let var = if cfg!(target_os = "macos") {
         "DYLD_LIBRARY_PATH"
     } else {
@@ -49,23 +52,23 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
     };
     let prev = match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
         Some(i) => env.remove(i).unwrap().val1(),
-        None => "".to_owned(),
+        None => "".to_strbuf(),
     };
-    env.push((var.to_owned(), if prev.is_empty() {
-        lib_path + ":" + aux_path
+    env.push((var.to_strbuf(), if prev.is_empty() {
+        format_strbuf!("{}:{}", lib_path, aux_path)
     } else {
-        lib_path + ":" + aux_path + ":" + prev
+        format_strbuf!("{}:{}:{}", lib_path, aux_path, prev)
     }));
     return env;
 }
 
-pub struct Result {pub status: ProcessExit, pub out: ~str, pub err: ~str}
+pub struct Result {pub status: ProcessExit, pub out: StrBuf, pub err: StrBuf}
 
 pub fn run(lib_path: &str,
            prog: &str,
-           args: &[~str],
-           env: Vec<(~str, ~str)> ,
-           input: Option<~str>) -> Option<Result> {
+           args: &[StrBuf],
+           env: Vec<(StrBuf, StrBuf)> ,
+           input: Option<StrBuf>) -> Option<Result> {
 
     let env = env.clone().append(target_env(lib_path, prog).as_slice());
     match Command::new(prog).args(args).env(env.as_slice()).spawn() {
@@ -78,8 +81,8 @@ pub fn run(lib_path: &str,
 
             Some(Result {
                 status: status,
-                out: str::from_utf8(output.as_slice()).unwrap().to_owned(),
-                err: str::from_utf8(error.as_slice()).unwrap().to_owned()
+                out: str::from_utf8(output.as_slice()).unwrap().to_strbuf(),
+                err: str::from_utf8(error.as_slice()).unwrap().to_strbuf()
             })
         },
         Err(..) => None
@@ -88,9 +91,9 @@ pub fn run(lib_path: &str,
 
 pub fn run_background(lib_path: &str,
            prog: &str,
-           args: &[~str],
-           env: Vec<(~str, ~str)> ,
-           input: Option<~str>) -> Option<Process> {
+           args: &[StrBuf],
+           env: Vec<(StrBuf, StrBuf)> ,
+           input: Option<StrBuf>) -> Option<Process> {
 
     let env = env.clone().append(target_env(lib_path, prog).as_slice());
     match Command::new(prog).args(args).env(env.as_slice()).spawn() {
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index fbbfcf94eb1..55c3b6a34e5 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -31,7 +31,7 @@ use std::strbuf::StrBuf;
 use std::task;
 use test::MetricMap;
 
-pub fn run(config: Config, testfile: ~str) {
+pub fn run(config: Config, testfile: StrBuf) {
 
     match config.target.as_slice() {
 
@@ -48,7 +48,7 @@ pub fn run(config: Config, testfile: ~str) {
     run_metrics(config, testfile, &mut _mm);
 }
 
-pub fn run_metrics(config: Config, testfile: ~str, mm: &mut MetricMap) {
+pub fn run_metrics(config: Config, testfile: StrBuf, mm: &mut MetricMap) {
     if config.verbose {
         // We're going to be dumping a lot of info. Start on a new line.
         print!("\n\n");
@@ -72,7 +72,8 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
     let proc_res = compile_test(config, props, testfile);
 
     if proc_res.status.success() {
-        fatal_ProcRes("compile-fail test compiled successfully!".to_owned(), &proc_res);
+        fatal_ProcRes("compile-fail test compiled successfully!".to_strbuf(),
+                      &proc_res);
     }
 
     check_correct_failure_status(&proc_res);
@@ -80,7 +81,8 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
     let expected_errors = errors::load_errors(testfile);
     if !expected_errors.is_empty() {
         if !props.error_patterns.is_empty() {
-            fatal("both error pattern and expected errors specified".to_owned());
+            fatal("both error pattern and expected errors \
+                   specified".to_strbuf());
         }
         check_expected_errors(expected_errors, testfile, &proc_res);
     } else {
@@ -94,7 +96,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
         let proc_res = compile_test(config, props, testfile);
 
         if !proc_res.status.success() {
-            fatal_ProcRes("compilation failed!".to_owned(), &proc_res);
+            fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res);
         }
 
         exec_compiled_test(config, props, testfile)
@@ -105,7 +107,8 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
     // The value our Makefile configures valgrind to return on failure
     static VALGRIND_ERR: int = 100;
     if proc_res.status.matches_exit_status(VALGRIND_ERR) {
-        fatal_ProcRes("run-fail test isn't valgrind-clean!".to_owned(), &proc_res);
+        fatal_ProcRes("run-fail test isn't valgrind-clean!".to_strbuf(),
+                      &proc_res);
     }
 
     check_correct_failure_status(&proc_res);
@@ -117,7 +120,8 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
     static RUST_ERR: int = 101;
     if !proc_res.status.matches_exit_status(RUST_ERR) {
         fatal_ProcRes(
-            format!("failure produced the wrong error: {}", proc_res.status),
+            format_strbuf!("failure produced the wrong error: {}",
+                           proc_res.status),
             proc_res);
     }
 }
@@ -127,40 +131,49 @@ fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) {
         let mut proc_res = compile_test(config, props, testfile);
 
         if !proc_res.status.success() {
-            fatal_ProcRes("compilation failed!".to_owned(), &proc_res);
+            fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res);
         }
 
         proc_res = exec_compiled_test(config, props, testfile);
 
         if !proc_res.status.success() {
-            fatal_ProcRes("test run failed!".to_owned(), &proc_res);
+            fatal_ProcRes("test run failed!".to_strbuf(), &proc_res);
         }
     } else {
         let proc_res = jit_test(config, props, testfile);
 
-        if !proc_res.status.success() { fatal_ProcRes("jit failed!".to_owned(), &proc_res); }
+        if !proc_res.status.success() {
+            fatal_ProcRes("jit failed!".to_strbuf(), &proc_res);
+        }
     }
 }
 
 fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
     if props.pp_exact.is_some() {
-        logv(config, "testing for exact pretty-printing".to_owned());
-    } else { logv(config, "testing for converging pretty-printing".to_owned()); }
+        logv(config, "testing for exact pretty-printing".to_strbuf());
+    } else {
+        logv(config, "testing for converging pretty-printing".to_strbuf());
+    }
 
     let rounds =
         match props.pp_exact { Some(_) => 1, None => 2 };
 
     let src = File::open(testfile).read_to_end().unwrap();
-    let src = str::from_utf8(src.as_slice()).unwrap().to_owned();
+    let src = str::from_utf8(src.as_slice()).unwrap().to_strbuf();
     let mut srcs = vec!(src);
 
     let mut round = 0;
     while round < rounds {
-        logv(config, format!("pretty-printing round {}", round));
-        let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "normal");
+        logv(config, format_strbuf!("pretty-printing round {}", round));
+        let proc_res = print_source(config,
+                                    props,
+                                    testfile,
+                                    (*srcs.get(round)).to_strbuf(),
+                                    "normal");
 
         if !proc_res.status.success() {
-            fatal_ProcRes(format!("pretty-printing failed in round {}", round),
+            fatal_ProcRes(format_strbuf!("pretty-printing failed in round {}",
+                                         round),
                           &proc_res);
         }
 
@@ -173,7 +186,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
         Some(ref file) => {
             let filepath = testfile.dir_path().join(file);
             let s = File::open(&filepath).read_to_end().unwrap();
-            str::from_utf8(s.as_slice()).unwrap().to_owned()
+            str::from_utf8(s.as_slice()).unwrap().to_strbuf()
           }
           None => { (*srcs.get(srcs.len() - 2u)).clone() }
         };
@@ -181,31 +194,35 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
 
     if props.pp_exact.is_some() {
         // Now we have to care about line endings
-        let cr = "\r".to_owned();
-        actual = actual.replace(cr, "");
-        expected = expected.replace(cr, "");
+        let cr = "\r".to_strbuf();
+        actual = actual.replace(cr.as_slice(), "").to_strbuf();
+        expected = expected.replace(cr.as_slice(), "").to_strbuf();
     }
 
-    compare_source(expected, actual);
+    compare_source(expected.as_slice(), actual.as_slice());
 
     // Finally, let's make sure it actually appears to remain valid code
     let proc_res = typecheck_source(config, props, testfile, actual);
 
     if !proc_res.status.success() {
-        fatal_ProcRes("pretty-printed source does not typecheck".to_owned(), &proc_res);
+        fatal_ProcRes("pretty-printed source does not typecheck".to_strbuf(),
+                      &proc_res);
     }
     if props.no_pretty_expanded { return }
 
     // additionally, run `--pretty expanded` and try to build it.
     let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "expanded");
     if !proc_res.status.success() {
-        fatal_ProcRes(format!("pretty-printing (expanded) failed"), &proc_res);
+        fatal_ProcRes(format_strbuf!("pretty-printing (expanded) failed"),
+                                     &proc_res);
     }
 
     let ProcRes{ stdout: expanded_src, .. } = proc_res;
     let proc_res = typecheck_source(config, props, testfile, expanded_src);
     if !proc_res.status.success() {
-        fatal_ProcRes(format!("pretty-printed source (expanded) does not typecheck"), &proc_res);
+        fatal_ProcRes(format_strbuf!("pretty-printed source (expanded) does \
+                                      not typecheck"),
+                      &proc_res);
     }
 
     return;
@@ -213,30 +230,43 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
     fn print_source(config: &Config,
                     props: &TestProps,
                     testfile: &Path,
-                    src: ~str,
+                    src: StrBuf,
                     pretty_type: &str) -> ProcRes {
-        compose_and_run(config, testfile,
-                        make_pp_args(config, props, testfile, pretty_type.to_owned()),
-                        props.exec_env.clone(), config.compile_lib_path, Some(src))
+        compose_and_run(config,
+                        testfile,
+                        make_pp_args(config,
+                                     props,
+                                     testfile,
+                                     pretty_type.to_strbuf()),
+                        props.exec_env.clone(),
+                        config.compile_lib_path.as_slice(),
+                        Some(src))
     }
 
     fn make_pp_args(config: &Config,
                     props: &TestProps,
                     testfile: &Path,
-                    pretty_type: ~str) -> ProcArgs {
+                    pretty_type: StrBuf) -> ProcArgs {
         let aux_dir = aux_output_dir_name(config, testfile);
         // FIXME (#9639): This needs to handle non-utf8 paths
-        let mut args = vec!("-".to_owned(), "--pretty".to_owned(), pretty_type,
-                            "--target=".to_owned() + config.target,
-                            "-L".to_owned(), aux_dir.as_str().unwrap().to_owned());
+        let mut args = vec!("-".to_strbuf(),
+                            "--pretty".to_strbuf(),
+                            pretty_type,
+                            format_strbuf!("--target={}", config.target),
+                            "-L".to_strbuf(),
+                            aux_dir.as_str().unwrap().to_strbuf());
         args.push_all_move(split_maybe_args(&config.target_rustcflags));
         args.push_all_move(split_maybe_args(&props.compile_flags));
-        return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args};
+        return ProcArgs {
+            prog: config.rustc_path.as_str().unwrap().to_strbuf(),
+            args: args,
+        };
     }
 
     fn compare_source(expected: &str, actual: &str) {
         if expected != actual {
-            error("pretty-printed source does not match expected source".to_owned());
+            error("pretty-printed source does not match expected \
+                   source".to_strbuf());
             println!("\n\
 expected:\n\
 ------------------------------------------\n\
@@ -253,7 +283,7 @@ actual:\n\
     }
 
     fn typecheck_source(config: &Config, props: &TestProps,
-                        testfile: &Path, src: ~str) -> ProcRes {
+                        testfile: &Path, src: StrBuf) -> ProcRes {
         let args = make_typecheck_args(config, props, testfile);
         compose_and_run_compiler(config, props, testfile, args, Some(src))
     }
@@ -266,16 +296,21 @@ actual:\n\
             config.target.as_slice()
         };
         // FIXME (#9639): This needs to handle non-utf8 paths
-        let mut args = vec!("-".to_owned(),
-                         "--no-trans".to_owned(), "--crate-type=lib".to_owned(),
-                         "--target=".to_owned() + target,
-                         "-L".to_owned(), config.build_base.as_str().unwrap().to_owned(),
-                         "-L".to_owned(),
-                         aux_dir.as_str().unwrap().to_owned());
+        let mut args = vec!("-".to_strbuf(),
+                            "--no-trans".to_strbuf(),
+                            "--crate-type=lib".to_strbuf(),
+                            format_strbuf!("--target={}", target),
+                            "-L".to_strbuf(),
+                            config.build_base.as_str().unwrap().to_strbuf(),
+                            "-L".to_strbuf(),
+                            aux_dir.as_str().unwrap().to_strbuf());
         args.push_all_move(split_maybe_args(&config.target_rustcflags));
         args.push_all_move(split_maybe_args(&props.compile_flags));
         // FIXME (#9639): This needs to handle non-utf8 paths
-        return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args};
+        return ProcArgs {
+            prog: config.rustc_path.as_str().unwrap().to_strbuf(),
+            args: args,
+        };
     }
 }
 
@@ -288,12 +323,12 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
 
     let config = &mut config;
     let DebuggerCommands { commands, check_lines, .. } = parse_debugger_commands(testfile, "gdb");
-    let mut cmds = commands.connect("\n");
+    let mut cmds = commands.connect("\n").to_strbuf();
 
     // compile test file (it shoud have 'compile-flags:-g' in the header)
     let compiler_run_result = compile_test(config, props, testfile);
     if !compiler_run_result.status.success() {
-        fatal_ProcRes("compilation failed!".to_owned(), &compiler_run_result);
+        fatal_ProcRes("compilation failed!".to_strbuf(), &compiler_run_result);
     }
 
     let exe_file = make_exe_name(config, testfile);
@@ -303,38 +338,64 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
     match config.target.as_slice() {
         "arm-linux-androideabi" => {
 
-            cmds = cmds.replace("run","continue");
+            cmds = cmds.replace("run", "continue").to_strbuf();
 
             // write debugger script
-            let script_str = ["set charset UTF-8".to_owned(),
-                              format!("file {}",exe_file.as_str().unwrap().to_owned()),
-                              "target remote :5039".to_owned(),
+            let script_str = ["set charset UTF-8".to_strbuf(),
+                              format_strbuf!("file {}",
+                                             exe_file.as_str()
+                                                     .unwrap()
+                                                     .to_strbuf()),
+                              "target remote :5039".to_strbuf(),
                               cmds,
-                              "quit".to_owned()].connect("\n");
+                              "quit".to_strbuf()].connect("\n");
             debug!("script_str = {}", script_str);
             dump_output_file(config, testfile, script_str, "debugger.script");
 
 
-            procsrv::run("", config.adb_path,
-                         ["push".to_owned(), exe_file.as_str().unwrap().to_owned(),
-                          config.adb_test_dir.clone()],
-                         vec!(("".to_owned(),"".to_owned())), Some("".to_owned()))
-                .expect(format!("failed to exec `{}`", config.adb_path));
-
-            procsrv::run("", config.adb_path,
-                         ["forward".to_owned(), "tcp:5039".to_owned(), "tcp:5039".to_owned()],
-                         vec!(("".to_owned(),"".to_owned())), Some("".to_owned()))
-                .expect(format!("failed to exec `{}`", config.adb_path));
-
-            let adb_arg = format!("export LD_LIBRARY_PATH={}; gdbserver :5039 {}/{}",
-                                  config.adb_test_dir.clone(), config.adb_test_dir.clone(),
-                                  str::from_utf8(exe_file.filename().unwrap()).unwrap());
-
-            let mut process = procsrv::run_background("", config.adb_path,
-                                                      ["shell".to_owned(),adb_arg.clone()],
-                                                      vec!(("".to_owned(),"".to_owned())),
-                                                      Some("".to_owned()))
-                .expect(format!("failed to exec `{}`", config.adb_path));
+            procsrv::run("",
+                         config.adb_path.as_slice(),
+                         [
+                            "push".to_strbuf(),
+                            exe_file.as_str().unwrap().to_strbuf(),
+                            config.adb_test_dir.clone()
+                         ],
+                         vec!(("".to_strbuf(), "".to_strbuf())),
+                         Some("".to_strbuf()))
+                .expect(format_strbuf!("failed to exec `{}`",
+                                       config.adb_path));
+
+            procsrv::run("",
+                         config.adb_path.as_slice(),
+                         [
+                            "forward".to_strbuf(),
+                            "tcp:5039".to_strbuf(),
+                            "tcp:5039".to_strbuf()
+                         ],
+                         vec!(("".to_strbuf(), "".to_strbuf())),
+                         Some("".to_strbuf()))
+                .expect(format_strbuf!("failed to exec `{}`", config.adb_path));
+
+            let adb_arg = format_strbuf!("export LD_LIBRARY_PATH={}; \
+                                          gdbserver :5039 {}/{}",
+                                         config.adb_test_dir.clone(),
+                                         config.adb_test_dir.clone(),
+                                         str::from_utf8(
+                                             exe_file.filename()
+                                             .unwrap()).unwrap());
+
+            let mut process = procsrv::run_background("",
+                                                      config.adb_path
+                                                            .as_slice(),
+                                                      [
+                                                        "shell".to_strbuf(),
+                                                        adb_arg.clone()
+                                                      ],
+                                                      vec!(("".to_strbuf(),
+                                                            "".to_strbuf())),
+                                                      Some("".to_strbuf()))
+                .expect(format_strbuf!("failed to exec `{}`",
+                                       config.adb_path));
             loop {
                 //waiting 1 second for gdbserver start
                 timer::sleep(1000);
@@ -349,27 +410,34 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
 
             let tool_path = match config.android_cross_path.as_str() {
                 Some(x) => x.to_strbuf(),
-                None => fatal("cannot find android cross path".to_owned())
+                None => fatal("cannot find android cross path".to_strbuf())
             };
 
             let debugger_script = make_out_name(config, testfile, "debugger.script");
             // FIXME (#9639): This needs to handle non-utf8 paths
-            let debugger_opts = vec!("-quiet".to_owned(), "-batch".to_owned(), "-nx".to_owned(),
-                                  "-command=" + debugger_script.as_str().unwrap().to_owned());
+            let debugger_opts =
+                vec!("-quiet".to_strbuf(),
+                     "-batch".to_strbuf(),
+                     "-nx".to_strbuf(),
+                     format_strbuf!("-command={}",
+                                    debugger_script.as_str().unwrap()));
 
             let gdb_path = tool_path.append("/bin/arm-linux-androideabi-gdb");
-            let procsrv::Result{ out, err, status }=
-                procsrv::run("",
+            let procsrv::Result {
+                out,
+                err,
+                status
+            } = procsrv::run("",
                              gdb_path.as_slice(),
                              debugger_opts.as_slice(),
-                             vec!(("".to_owned(),"".to_owned())),
+                             vec!(("".to_strbuf(), "".to_strbuf())),
                              None)
-                .expect(format!("failed to exec `{}`", gdb_path));
+                .expect(format_strbuf!("failed to exec `{}`", gdb_path));
             let cmdline = {
                 let cmdline = make_cmdline("",
                                            "arm-linux-androideabi-gdb",
                                            debugger_opts.as_slice());
-                logv(config, format!("executing {}", cmdline));
+                logv(config, format_strbuf!("executing {}", cmdline));
                 cmdline
             };
 
@@ -384,25 +452,38 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
 
         _=> {
             // write debugger script
-            let script_str = ["set charset UTF-8".to_owned(),
+            let script_str = [
+                "set charset UTF-8".to_strbuf(),
                 cmds,
-                "quit\n".to_owned()].connect("\n");
+                "quit\n".to_strbuf()
+            ].connect("\n");
             debug!("script_str = {}", script_str);
             dump_output_file(config, testfile, script_str, "debugger.script");
 
             // run debugger script with gdb
             #[cfg(windows)]
-            fn debugger() -> ~str { "gdb.exe".to_owned() }
+            fn debugger() -> StrBuf {
+                "gdb.exe".to_strbuf()
+            }
             #[cfg(unix)]
-            fn debugger() -> ~str { "gdb".to_owned() }
+            fn debugger() -> StrBuf {
+                "gdb".to_strbuf()
+            }
 
             let debugger_script = make_out_name(config, testfile, "debugger.script");
 
             // FIXME (#9639): This needs to handle non-utf8 paths
-            let debugger_opts = vec!("-quiet".to_owned(), "-batch".to_owned(), "-nx".to_owned(),
-                "-command=" + debugger_script.as_str().unwrap().to_owned(),
-                exe_file.as_str().unwrap().to_owned());
-            proc_args = ProcArgs {prog: debugger(), args: debugger_opts};
+            let debugger_opts =
+                vec!("-quiet".to_strbuf(),
+                     "-batch".to_strbuf(),
+                     "-nx".to_strbuf(),
+                     format_strbuf!("-command={}",
+                                    debugger_script.as_str().unwrap()),
+                     exe_file.as_str().unwrap().to_strbuf());
+            proc_args = ProcArgs {
+                prog: debugger(),
+                args: debugger_opts,
+            };
             debugger_run_result = compose_and_run(config,
                                                   testfile,
                                                   proc_args,
@@ -413,7 +494,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
     }
 
     if !debugger_run_result.status.success() {
-        fatal("gdb failed to execute".to_owned());
+        fatal("gdb failed to execute".to_strbuf());
     }
 
     check_debugger_output(&debugger_run_result, check_lines.as_slice());
@@ -423,7 +504,8 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
     use std::io::process::{Command, ProcessOutput};
 
     if config.lldb_python_dir.is_none() {
-        fatal("Can't run LLDB test because LLDB's python path is not set.".to_owned());
+        fatal("Can't run LLDB test because LLDB's python path is not \
+               set.".to_strbuf());
     }
 
     let mut config = Config {
@@ -437,7 +519,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
     // compile test file (it shoud have 'compile-flags:-g' in the header)
     let compile_result = compile_test(config, props, testfile);
     if !compile_result.status.success() {
-        fatal_ProcRes("compilation failed!".to_owned(), &compile_result);
+        fatal_ProcRes("compilation failed!".to_strbuf(), &compile_result);
     }
 
     let exe_file = make_exe_name(config, testfile);
@@ -476,7 +558,8 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
     let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
 
     if !debugger_run_result.status.success() {
-        fatal_ProcRes("Error while running LLDB".to_owned(), &debugger_run_result);
+        fatal_ProcRes("Error while running LLDB".to_strbuf(),
+                      &debugger_run_result);
     }
 
     check_debugger_output(&debugger_run_result, check_lines.as_slice());
@@ -495,32 +578,34 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
                     process.wait_with_output().unwrap();
 
                 (status,
-                 str::from_utf8(output.as_slice()).unwrap().to_owned(),
-                 str::from_utf8(error.as_slice()).unwrap().to_owned())
+                 str::from_utf8(output.as_slice()).unwrap().to_strbuf(),
+                 str::from_utf8(error.as_slice()).unwrap().to_strbuf())
             },
             Err(e) => {
-                fatal(format!("Failed to setup Python process for LLDB script: {}", e))
+                fatal(format_strbuf!("Failed to setup Python process for \
+                                      LLDB script: {}",
+                                     e))
             }
         };
 
-        dump_output(config, test_executable, out, err);
+        dump_output(config, test_executable, out.as_slice(), err.as_slice());
         return ProcRes {
             status: status,
             stdout: out,
             stderr: err,
-            cmdline: format!("{}", cmd)
+            cmdline: format_strbuf!("{}", cmd)
         };
     }
 }
 
-struct DebuggerCommands
-{
-    commands: Vec<~str>,
-    check_lines: Vec<~str>,
-    breakpoint_lines: Vec<uint>
+struct DebuggerCommands {
+    commands: Vec<StrBuf>,
+    check_lines: Vec<StrBuf>,
+    breakpoint_lines: Vec<uint>,
 }
 
-fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) -> DebuggerCommands {
+fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
+                           -> DebuggerCommands {
     use std::io::{BufferedReader, File};
 
     let command_directive = debugger_prefix + "-command";
@@ -538,14 +623,22 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) -> DebuggerC
                     breakpoint_lines.push(counter);
                 }
 
-                header::parse_name_value_directive(line, command_directive.clone())
-                    .map(|cmd| commands.push(cmd));
+                header::parse_name_value_directive(
+                        line,
+                        command_directive.to_strbuf()).map(|cmd| {
+                    commands.push(cmd)
+                });
 
-                header::parse_name_value_directive(line, check_directive.clone())
-                    .map(|cmd| check_lines.push(cmd));
+                header::parse_name_value_directive(
+                        line,
+                        check_directive.to_strbuf()).map(|cmd| {
+                    check_lines.push(cmd)
+                });
             }
             Err(e) => {
-                fatal(format!("Error while parsing debugger commands: {}", e))
+                fatal(format_strbuf!("Error while parsing debugger commands: \
+                                      {}",
+                                     e))
             }
         }
         counter += 1;
@@ -558,41 +651,55 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) -> DebuggerC
     }
 }
 
-fn cleanup_debug_info_options(options: &Option<~str>) -> Option<~str> {
+fn cleanup_debug_info_options(options: &Option<StrBuf>) -> Option<StrBuf> {
     if options.is_none() {
         return None;
     }
 
     // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
-    let options_to_remove = ["-O".to_owned(), "-g".to_owned(), "--debuginfo".to_owned()];
-    let new_options = split_maybe_args(options).move_iter()
-                                               .filter(|x| !options_to_remove.contains(x))
-                                               .collect::<Vec<~str>>()
-                                               .connect(" ");
+    let options_to_remove = [
+        "-O".to_strbuf(),
+        "-g".to_strbuf(),
+        "--debuginfo".to_strbuf()
+    ];
+    let new_options =
+        split_maybe_args(options).move_iter()
+                                 .filter(|x| !options_to_remove.contains(x))
+                                 .collect::<Vec<StrBuf>>()
+                                 .connect(" ")
+                                 .to_strbuf();
     Some(new_options)
 }
 
-fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[~str]) {
+fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[StrBuf]) {
     let num_check_lines = check_lines.len();
     if num_check_lines > 0 {
         // Allow check lines to leave parts unspecified (e.g., uninitialized
         // bits in the wrong case of an enum) with the notation "[...]".
-        let check_fragments: Vec<Vec<~str>> =
+        let check_fragments: Vec<Vec<StrBuf>> =
             check_lines.iter().map(|s| {
-                s.trim().split_str("[...]").map(|x| x.to_str()).collect()
+                s.as_slice()
+                 .trim()
+                 .split_str("[...]")
+                 .map(|x| x.to_strbuf())
+                 .collect()
             }).collect();
         // check if each line in props.check_lines appears in the
         // output (in order)
         let mut i = 0u;
-        for line in debugger_run_result.stdout.lines() {
+        for line in debugger_run_result.stdout.as_slice().lines() {
             let mut rest = line.trim();
             let mut first = true;
             let mut failed = false;
             for frag in check_fragments.get(i).iter() {
                 let found = if first {
-                    if rest.starts_with(*frag) { Some(0) } else { None }
+                    if rest.starts_with(frag.as_slice()) {
+                        Some(0)
+                    } else {
+                        None
+                    }
                 } else {
-                    rest.find_str(*frag)
+                    rest.find_str(frag.as_slice())
                 };
                 match found {
                     None => {
@@ -614,8 +721,10 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[~str]) {
             }
         }
         if i != num_check_lines {
-            fatal_ProcRes(format!("line not found in debugger output: {}",
-                                  check_lines.get(i).unwrap()), debugger_run_result);
+            fatal_ProcRes(format_strbuf!("line not found in debugger output: \
+                                          {}",
+                                         check_lines.get(i).unwrap()),
+                          debugger_run_result);
         }
     }
 }
@@ -624,24 +733,24 @@ fn check_error_patterns(props: &TestProps,
                         testfile: &Path,
                         proc_res: &ProcRes) {
     if props.error_patterns.is_empty() {
-        fatal("no error pattern specified in ".to_owned() +
-              testfile.display().as_maybe_owned().as_slice());
+        fatal(format_strbuf!("no error pattern specified in {}",
+                             testfile.display().as_maybe_owned().as_slice()));
     }
 
     if proc_res.status.success() {
-        fatal("process did not return an error status".to_owned());
+        fatal("process did not return an error status".to_strbuf());
     }
 
     let mut next_err_idx = 0u;
     let mut next_err_pat = props.error_patterns.get(next_err_idx);
     let mut done = false;
     let output_to_check = if props.check_stdout {
-        proc_res.stdout + proc_res.stderr
+        format_strbuf!("{}{}", proc_res.stdout, proc_res.stderr)
     } else {
         proc_res.stderr.clone()
     };
-    for line in output_to_check.lines() {
-        if line.contains(*next_err_pat) {
+    for line in output_to_check.as_slice().lines() {
+        if line.contains(next_err_pat.as_slice()) {
             debug!("found error pattern {}", *next_err_pat);
             next_err_idx += 1u;
             if next_err_idx == props.error_patterns.len() {
@@ -657,20 +766,22 @@ fn check_error_patterns(props: &TestProps,
     let missing_patterns =
         props.error_patterns.slice(next_err_idx, props.error_patterns.len());
     if missing_patterns.len() == 1u {
-        fatal_ProcRes(format!("error pattern '{}' not found!",
-                              missing_patterns[0]), proc_res);
+        fatal_ProcRes(format_strbuf!("error pattern '{}' not found!",
+                                     missing_patterns[0]),
+                      proc_res);
     } else {
         for pattern in missing_patterns.iter() {
-            error(format!("error pattern '{}' not found!", *pattern));
+            error(format_strbuf!("error pattern '{}' not found!", *pattern));
         }
-        fatal_ProcRes("multiple error patterns not found".to_owned(), proc_res);
+        fatal_ProcRes("multiple error patterns not found".to_strbuf(),
+                      proc_res);
     }
 }
 
 fn check_no_compiler_crash(proc_res: &ProcRes) {
-    for line in proc_res.stderr.lines() {
+    for line in proc_res.stderr.as_slice().lines() {
         if line.starts_with("error: internal compiler error:") {
-            fatal_ProcRes("compiler encountered internal error".to_owned(),
+            fatal_ProcRes("compiler encountered internal error".to_strbuf(),
                           proc_res);
         }
     }
@@ -685,15 +796,15 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
         expected_errors.len(), false);
 
     if proc_res.status.success() {
-        fatal("process did not return an error status".to_owned());
+        fatal("process did not return an error status".to_strbuf());
     }
 
     let prefixes = expected_errors.iter().map(|ee| {
-        format!("{}:{}:", testfile.display(), ee.line)
-    }).collect::<Vec<~str> >();
+        format_strbuf!("{}:{}:", testfile.display(), ee.line)
+    }).collect::<Vec<StrBuf> >();
 
     #[cfg(target_os = "win32")]
-    fn to_lower( s : &str ) -> ~str {
+    fn to_lower( s : &str ) -> StrBuf {
         let i = s.chars();
         let c : Vec<char> = i.map( |c| {
             if c.is_ascii() {
@@ -702,12 +813,12 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
                 c
             }
         } ).collect();
-        str::from_chars(c.as_slice())
+        str::from_chars(c.as_slice()).to_strbuf()
     }
 
     #[cfg(target_os = "win32")]
     fn prefix_matches( line : &str, prefix : &str ) -> bool {
-        to_lower(line).starts_with( to_lower(prefix) )
+        to_lower(line).as_slice().starts_with(to_lower(prefix).as_slice())
     }
 
     #[cfg(target_os = "linux")]
@@ -723,15 +834,18 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
     //    filename:line1:col1: line2:col2: *warning:* msg
     // where line1:col1: is the starting point, line2:col2:
     // is the ending point, and * represents ANSI color codes.
-    for line in proc_res.stderr.lines() {
+    for line in proc_res.stderr.as_slice().lines() {
         let mut was_expected = false;
         for (i, ee) in expected_errors.iter().enumerate() {
             if !*found_flags.get(i) {
                 debug!("prefix={} ee.kind={} ee.msg={} line={}",
-                       *prefixes.get(i), ee.kind, ee.msg, line);
-                if prefix_matches(line, *prefixes.get(i)) &&
-                    line.contains(ee.kind) &&
-                    line.contains(ee.msg) {
+                       prefixes.get(i).as_slice(),
+                       ee.kind,
+                       ee.msg,
+                       line);
+                if prefix_matches(line, prefixes.get(i).as_slice()) &&
+                    line.contains(ee.kind.as_slice()) &&
+                    line.contains(ee.msg.as_slice()) {
                     *found_flags.get_mut(i) = true;
                     was_expected = true;
                     break;
@@ -745,8 +859,9 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
         }
 
         if !was_expected && is_compiler_error_or_warning(line) {
-            fatal_ProcRes(format!("unexpected compiler error or warning: '{}'",
-                               line),
+            fatal_ProcRes(format_strbuf!("unexpected compiler error or \
+                                          warning: '{}'",
+                                         line),
                           proc_res);
         }
     }
@@ -754,8 +869,12 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
     for (i, &flag) in found_flags.iter().enumerate() {
         if !flag {
             let ee = expected_errors.get(i);
-            fatal_ProcRes(format!("expected {} on line {} not found: {}",
-                               ee.kind, ee.line, ee.msg), proc_res);
+            fatal_ProcRes(format_strbuf!("expected {} on line {} not found: \
+                                          {}",
+                                         ee.kind,
+                                         ee.line,
+                                         ee.msg),
+                          proc_res);
         }
     }
 }
@@ -835,9 +954,17 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
     return true;
 }
 
-struct ProcArgs {prog: ~str, args: Vec<~str> }
+struct ProcArgs {
+    prog: StrBuf,
+    args: Vec<StrBuf>,
+}
 
-struct ProcRes {status: ProcessExit, stdout: ~str, stderr: ~str, cmdline: ~str}
+struct ProcRes {
+    status: ProcessExit,
+    stdout: StrBuf,
+    stderr: StrBuf,
+    cmdline: StrBuf,
+}
 
 fn compile_test(config: &Config, props: &TestProps,
                 testfile: &Path) -> ProcRes {
@@ -845,14 +972,15 @@ fn compile_test(config: &Config, props: &TestProps,
 }
 
 fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes {
-    compile_test_(config, props, testfile, ["--jit".to_owned()])
+    compile_test_(config, props, testfile, ["--jit".to_strbuf()])
 }
 
 fn compile_test_(config: &Config, props: &TestProps,
-                 testfile: &Path, extra_args: &[~str]) -> ProcRes {
+                 testfile: &Path, extra_args: &[StrBuf]) -> ProcRes {
     let aux_dir = aux_output_dir_name(config, testfile);
     // FIXME (#9639): This needs to handle non-utf8 paths
-    let link_args = vec!("-L".to_owned(), aux_dir.as_str().unwrap().to_owned());
+    let link_args = vec!("-L".to_strbuf(),
+                         aux_dir.as_str().unwrap().to_strbuf());
     let args = make_compile_args(config,
                                  props,
                                  link_args.append(extra_args),
@@ -872,10 +1000,12 @@ fn exec_compiled_test(config: &Config, props: &TestProps,
         }
 
         _=> {
-            compose_and_run(config, testfile,
+            compose_and_run(config,
+                            testfile,
                             make_run_args(config, props, testfile),
                             env,
-                            config.run_lib_path, None)
+                            config.run_lib_path.as_slice(),
+                            None)
         }
     }
 }
@@ -885,7 +1015,7 @@ fn compose_and_run_compiler(
     props: &TestProps,
     testfile: &Path,
     args: ProcArgs,
-    input: Option<~str>) -> ProcRes {
+    input: Option<StrBuf>) -> ProcRes {
 
     if !props.aux_builds.is_empty() {
         ensure_dir(&aux_output_dir_name(config, testfile));
@@ -901,37 +1031,48 @@ fn compose_and_run_compiler(
         let crate_type = if aux_props.no_prefer_dynamic {
             Vec::new()
         } else {
-            vec!("--crate-type=dylib".to_owned())
+            vec!("--crate-type=dylib".to_strbuf())
         };
         let aux_args =
             make_compile_args(config,
                               &aux_props,
-                              crate_type.append(extra_link_args.as_slice()),
+                              crate_type.append(
+                                  extra_link_args.iter()
+                                                 .map(|x| x.to_strbuf())
+                                                 .collect::<Vec<_>>()
+                                                 .as_slice()),
                               |a,b| {
                                   let f = make_lib_name(a, b, testfile);
                                   ThisDirectory(f.dir_path())
-                              }, &abs_ab);
-        let auxres = compose_and_run(config, &abs_ab, aux_args, Vec::new(),
-                                     config.compile_lib_path, None);
+                              },
+                              &abs_ab);
+        let auxres = compose_and_run(config,
+                                     &abs_ab,
+                                     aux_args,
+                                     Vec::new(),
+                                     config.compile_lib_path.as_slice(),
+                                     None);
         if !auxres.status.success() {
             fatal_ProcRes(
-                format!("auxiliary build of {} failed to compile: ",
-                     abs_ab.display()),
+                format_strbuf!("auxiliary build of {} failed to compile: ",
+                               abs_ab.display()),
                 &auxres);
         }
 
         match config.target.as_slice() {
-
             "arm-linux-androideabi" => {
                 _arm_push_aux_shared_library(config, testfile);
             }
-
-            _=> { }
+            _ => {}
         }
     }
 
-    compose_and_run(config, testfile, args, Vec::new(),
-                    config.compile_lib_path, input)
+    compose_and_run(config,
+                    testfile,
+                    args,
+                    Vec::new(),
+                    config.compile_lib_path.as_slice(),
+                    input)
 }
 
 fn ensure_dir(path: &Path) {
@@ -941,9 +1082,9 @@ fn ensure_dir(path: &Path) {
 
 fn compose_and_run(config: &Config, testfile: &Path,
                    ProcArgs{ args, prog }: ProcArgs,
-                   procenv: Vec<(~str, ~str)> ,
+                   procenv: Vec<(StrBuf, StrBuf)> ,
                    lib_path: &str,
-                   input: Option<~str>) -> ProcRes {
+                   input: Option<StrBuf>) -> ProcRes {
     return program_output(config, testfile, lib_path,
                           prog, args, procenv, input);
 }
@@ -955,7 +1096,7 @@ enum TargetLocation {
 
 fn make_compile_args(config: &Config,
                      props: &TestProps,
-                     extras: Vec<~str> ,
+                     extras: Vec<StrBuf> ,
                      xform: |&Config, &Path| -> TargetLocation,
                      testfile: &Path)
                      -> ProcArgs {
@@ -966,26 +1107,36 @@ fn make_compile_args(config: &Config,
         config.target.as_slice()
     };
     // FIXME (#9639): This needs to handle non-utf8 paths
-    let mut args = vec!(testfile.as_str().unwrap().to_owned(),
-                     "-L".to_owned(), config.build_base.as_str().unwrap().to_owned(),
-                     "--target=".to_owned() + target);
+    let mut args = vec!(testfile.as_str().unwrap().to_strbuf(),
+                        "-L".to_strbuf(),
+                        config.build_base.as_str().unwrap().to_strbuf(),
+                        format_strbuf!("--target={}", target));
     args.push_all(extras.as_slice());
     if !props.no_prefer_dynamic {
-        args.push("-C".to_owned());
-        args.push("prefer-dynamic".to_owned());
+        args.push("-C".to_strbuf());
+        args.push("prefer-dynamic".to_strbuf());
     }
     let path = match xform_file {
-        ThisFile(path) => { args.push("-o".to_owned()); path }
-        ThisDirectory(path) => { args.push("--out-dir".to_owned()); path }
+        ThisFile(path) => {
+            args.push("-o".to_strbuf());
+            path
+        }
+        ThisDirectory(path) => {
+            args.push("--out-dir".to_strbuf());
+            path
+        }
     };
-    args.push(path.as_str().unwrap().to_owned());
+    args.push(path.as_str().unwrap().to_strbuf());
     if props.force_host {
         args.push_all_move(split_maybe_args(&config.host_rustcflags));
     } else {
         args.push_all_move(split_maybe_args(&config.target_rustcflags));
     }
     args.push_all_move(split_maybe_args(&props.compile_flags));
-    return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args};
+    return ProcArgs {
+        prog: config.rustc_path.as_str().unwrap().to_strbuf(),
+        args: args,
+    };
 }
 
 fn make_lib_name(config: &Config, auxfile: &Path, testfile: &Path) -> Path {
@@ -1014,64 +1165,88 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) ->
     let exe_file = make_exe_name(config, testfile);
 
     // FIXME (#9639): This needs to handle non-utf8 paths
-    args.push(exe_file.as_str().unwrap().to_owned());
+    args.push(exe_file.as_str().unwrap().to_strbuf());
 
     // Add the arguments in the run_flags directive
     args.push_all_move(split_maybe_args(&props.run_flags));
 
     let prog = args.shift().unwrap();
-    return ProcArgs {prog: prog, args: args};
+    return ProcArgs {
+        prog: prog,
+        args: args,
+    };
 }
 
-fn split_maybe_args(argstr: &Option<~str>) -> Vec<~str> {
+fn split_maybe_args(argstr: &Option<StrBuf>) -> Vec<StrBuf> {
     match *argstr {
         Some(ref s) => {
-            s.split(' ')
-                .filter_map(|s| if s.is_whitespace() {None} else {Some(s.to_owned())})
-                .collect()
+            s.as_slice()
+             .split(' ')
+             .filter_map(|s| {
+                 if s.is_whitespace() {
+                     None
+                 } else {
+                     Some(s.to_strbuf())
+                 }
+             }).collect()
         }
         None => Vec::new()
     }
 }
 
-fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: ~str,
-                  args: Vec<~str> , env: Vec<(~str, ~str)> ,
-                  input: Option<~str>) -> ProcRes {
+fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: StrBuf,
+                  args: Vec<StrBuf> , env: Vec<(StrBuf, StrBuf)> ,
+                  input: Option<StrBuf>) -> ProcRes {
     let cmdline =
         {
-            let cmdline = make_cmdline(lib_path, prog, args.as_slice());
-            logv(config, format!("executing {}", cmdline));
+            let cmdline = make_cmdline(lib_path,
+                                       prog.as_slice(),
+                                       args.as_slice());
+            logv(config, format_strbuf!("executing {}", cmdline));
             cmdline
         };
-    let procsrv::Result{ out, err, status } =
-            procsrv::run(lib_path, prog, args.as_slice(), env, input)
-            .expect(format!("failed to exec `{}`", prog));
-    dump_output(config, testfile, out, err);
-    return ProcRes {status: status,
-         stdout: out,
-         stderr: err,
-         cmdline: cmdline};
+    let procsrv::Result {
+        out,
+        err,
+        status
+    } = procsrv::run(lib_path,
+                     prog.as_slice(),
+                     args.as_slice(),
+                     env,
+                     input).expect(format_strbuf!("failed to exec `{}`",
+                                                  prog));
+    dump_output(config, testfile, out.as_slice(), err.as_slice());
+    return ProcRes {
+        status: status,
+        stdout: out,
+        stderr: err,
+        cmdline: cmdline,
+    };
 }
 
 // Linux and mac don't require adjusting the library search path
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "macos")]
 #[cfg(target_os = "freebsd")]
-fn make_cmdline(_libpath: &str, prog: &str, args: &[~str]) -> ~str {
-    format!("{} {}", prog, args.connect(" "))
+fn make_cmdline(_libpath: &str, prog: &str, args: &[StrBuf]) -> StrBuf {
+    format_strbuf!("{} {}", prog, args.connect(" "))
 }
 
 #[cfg(target_os = "win32")]
-fn make_cmdline(libpath: &str, prog: &str, args: &[~str]) -> ~str {
-    format!("{} {} {}", lib_path_cmd_prefix(libpath), prog,
-         args.connect(" "))
+fn make_cmdline(libpath: &str, prog: &str, args: &[StrBuf]) -> StrBuf {
+    format_strbuf!("{} {} {}",
+                   lib_path_cmd_prefix(libpath),
+                   prog,
+                   args.connect(" "))
 }
 
 // Build the LD_LIBRARY_PATH variable as it would be seen on the command line
 // for diagnostic purposes
 #[cfg(target_os = "win32")]
-fn lib_path_cmd_prefix(path: &str) -> ~str {
-    format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path))
+fn lib_path_cmd_prefix(path: &str) -> StrBuf {
+    format_strbuf!("{}=\"{}\"",
+                   util::lib_path_env_var(),
+                   util::make_new_path(path))
 }
 
 fn dump_output(config: &Config, testfile: &Path, out: &str, err: &str) {
@@ -1119,11 +1294,11 @@ fn maybe_dump_to_stdout(config: &Config, out: &str, err: &str) {
     }
 }
 
-fn error(err: ~str) { println!("\nerror: {}", err); }
+fn error(err: StrBuf) { println!("\nerror: {}", err); }
 
-fn fatal(err: ~str) -> ! { error(err); fail!(); }
+fn fatal(err: StrBuf) -> ! { error(err); fail!(); }
 
-fn fatal_ProcRes(err: ~str, proc_res: &ProcRes) -> ! {
+fn fatal_ProcRes(err: StrBuf, proc_res: &ProcRes) -> ! {
     print!("\n\
 error: {}\n\
 status: {}\n\
@@ -1142,63 +1317,85 @@ stderr:\n\
     fail!();
 }
 
-fn _arm_exec_compiled_test(config: &Config, props: &TestProps,
-                      testfile: &Path, env: Vec<(~str, ~str)> ) -> ProcRes {
-
+fn _arm_exec_compiled_test(config: &Config,
+                           props: &TestProps,
+                           testfile: &Path,
+                           env: Vec<(StrBuf, StrBuf)>)
+                           -> ProcRes {
     let args = make_run_args(config, props, testfile);
-    let cmdline = make_cmdline("", args.prog, args.args.as_slice());
+    let cmdline = make_cmdline("",
+                               args.prog.as_slice(),
+                               args.args.as_slice());
 
     // get bare program string
-    let mut tvec: Vec<~str> = args.prog.split('/').map(|ts| ts.to_owned()).collect();
+    let mut tvec: Vec<StrBuf> = args.prog
+                                    .as_slice()
+                                    .split('/')
+                                    .map(|ts| ts.to_strbuf())
+                                    .collect();
     let prog_short = tvec.pop().unwrap();
 
     // copy to target
-    let copy_result = procsrv::run("", config.adb_path,
-        ["push".to_owned(), args.prog.clone(), config.adb_test_dir.clone()],
-        vec!(("".to_owned(),"".to_owned())), Some("".to_owned()))
-        .expect(format!("failed to exec `{}`", config.adb_path));
+    let copy_result = procsrv::run("",
+                                   config.adb_path.as_slice(),
+                                   [
+                                    "push".to_strbuf(),
+                                    args.prog.clone(),
+                                    config.adb_test_dir.clone()
+                                   ],
+                                   vec!(("".to_strbuf(), "".to_strbuf())),
+                                   Some("".to_strbuf()))
+        .expect(format_strbuf!("failed to exec `{}`", config.adb_path));
 
     if config.verbose {
         println!("push ({}) {} {} {}",
-            config.target, args.prog,
-            copy_result.out, copy_result.err);
+                 config.target,
+                 args.prog,
+                 copy_result.out,
+                 copy_result.err);
     }
 
-    logv(config, format!("executing ({}) {}", config.target, cmdline));
+    logv(config, format_strbuf!("executing ({}) {}", config.target, cmdline));
 
     let mut runargs = Vec::new();
 
     // run test via adb_run_wrapper
-    runargs.push("shell".to_owned());
+    runargs.push("shell".to_strbuf());
     for (key, val) in env.move_iter() {
-        runargs.push(format!("{}={}", key, val));
+        runargs.push(format_strbuf!("{}={}", key, val));
     }
-    runargs.push(format!("{}/adb_run_wrapper.sh", config.adb_test_dir));
-    runargs.push(format!("{}", config.adb_test_dir));
-    runargs.push(format!("{}", prog_short));
+    runargs.push(format_strbuf!("{}/adb_run_wrapper.sh",
+                                config.adb_test_dir));
+    runargs.push(format_strbuf!("{}", config.adb_test_dir));
+    runargs.push(format_strbuf!("{}", prog_short));
 
     for tv in args.args.iter() {
-        runargs.push(tv.to_owned());
+        runargs.push(tv.to_strbuf());
     }
     procsrv::run("",
-                 config.adb_path,
+                 config.adb_path.as_slice(),
                  runargs.as_slice(),
-                 vec!(("".to_owned(),"".to_owned())), Some("".to_owned()))
-        .expect(format!("failed to exec `{}`", config.adb_path));
+                 vec!(("".to_strbuf(), "".to_strbuf())), Some("".to_strbuf()))
+        .expect(format_strbuf!("failed to exec `{}`", config.adb_path));
 
     // get exitcode of result
     runargs = Vec::new();
-    runargs.push("shell".to_owned());
-    runargs.push("cat".to_owned());
-    runargs.push(format!("{}/{}.exitcode", config.adb_test_dir, prog_short));
+    runargs.push("shell".to_strbuf());
+    runargs.push("cat".to_strbuf());
+    runargs.push(format_strbuf!("{}/{}.exitcode",
+                                config.adb_test_dir,
+                                prog_short));
 
     let procsrv::Result{ out: exitcode_out, err: _, status: _ } =
-        procsrv::run("", config.adb_path, runargs.as_slice(), vec!(("".to_owned(),"".to_owned())),
-                     Some("".to_owned()))
-        .expect(format!("failed to exec `{}`", config.adb_path));
+        procsrv::run("",
+                     config.adb_path.as_slice(),
+                     runargs.as_slice(),
+                     vec!(("".to_strbuf(), "".to_strbuf())),
+                     Some("".to_strbuf()))
+        .expect(format_strbuf!("failed to exec `{}`", config.adb_path));
 
-    let mut exitcode : int = 0;
-    for c in exitcode_out.chars() {
+    let mut exitcode: int = 0;
+    for c in exitcode_out.as_slice().chars() {
         if !c.is_digit() { break; }
         exitcode = exitcode * 10 + match c {
             '0' .. '9' => c as int - ('0' as int),
@@ -1208,31 +1405,40 @@ fn _arm_exec_compiled_test(config: &Config, props: &TestProps,
 
     // get stdout of result
     runargs = Vec::new();
-    runargs.push("shell".to_owned());
-    runargs.push("cat".to_owned());
-    runargs.push(format!("{}/{}.stdout", config.adb_test_dir, prog_short));
+    runargs.push("shell".to_strbuf());
+    runargs.push("cat".to_strbuf());
+    runargs.push(format_strbuf!("{}/{}.stdout",
+                                config.adb_test_dir,
+                                prog_short));
 
     let procsrv::Result{ out: stdout_out, err: _, status: _ } =
         procsrv::run("",
-                     config.adb_path,
+                     config.adb_path.as_slice(),
                      runargs.as_slice(),
-                     vec!(("".to_owned(),"".to_owned())), Some("".to_owned()))
-        .expect(format!("failed to exec `{}`", config.adb_path));
+                     vec!(("".to_strbuf(), "".to_strbuf())),
+                     Some("".to_strbuf()))
+        .expect(format_strbuf!("failed to exec `{}`", config.adb_path));
 
     // get stderr of result
     runargs = Vec::new();
-    runargs.push("shell".to_owned());
-    runargs.push("cat".to_owned());
-    runargs.push(format!("{}/{}.stderr", config.adb_test_dir, prog_short));
+    runargs.push("shell".to_strbuf());
+    runargs.push("cat".to_strbuf());
+    runargs.push(format_strbuf!("{}/{}.stderr",
+                                config.adb_test_dir,
+                                prog_short));
 
     let procsrv::Result{ out: stderr_out, err: _, status: _ } =
         procsrv::run("",
-                     config.adb_path,
+                     config.adb_path.as_slice(),
                      runargs.as_slice(),
-                     vec!(("".to_owned(),"".to_owned())), Some("".to_owned()))
-        .expect(format!("failed to exec `{}`", config.adb_path));
+                     vec!(("".to_strbuf(), "".to_strbuf())),
+                     Some("".to_strbuf()))
+        .expect(format_strbuf!("failed to exec `{}`", config.adb_path));
 
-    dump_output(config, testfile, stdout_out, stderr_out);
+    dump_output(config,
+                testfile,
+                stdout_out.as_slice(),
+                stderr_out.as_slice());
 
     ProcRes {
         status: process::ExitStatus(exitcode),
@@ -1249,10 +1455,20 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
     for file in dirs.iter() {
         if file.extension_str() == Some("so") {
             // FIXME (#9639): This needs to handle non-utf8 paths
-            let copy_result = procsrv::run("", config.adb_path,
-                ["push".to_owned(), file.as_str().unwrap().to_owned(), config.adb_test_dir.clone()],
-                vec!(("".to_owned(),"".to_owned())), Some("".to_owned()))
-                .expect(format!("failed to exec `{}`", config.adb_path));
+            let copy_result = procsrv::run("",
+                                           config.adb_path.as_slice(),
+                                           [
+                                            "push".to_strbuf(),
+                                            file.as_str()
+                                                .unwrap()
+                                                .to_strbuf(),
+                                            config.adb_test_dir.to_strbuf()
+                                           ],
+                                           vec!(("".to_strbuf(),
+                                                 "".to_strbuf())),
+                                           Some("".to_strbuf()))
+                .expect(format_strbuf!("failed to exec `{}`",
+                                       config.adb_path));
 
             if config.verbose {
                 println!("push ({}) {} {} {}",
@@ -1282,9 +1498,12 @@ fn compile_test_and_save_bitcode(config: &Config, props: &TestProps,
                                  testfile: &Path) -> ProcRes {
     let aux_dir = aux_output_dir_name(config, testfile);
     // FIXME (#9639): This needs to handle non-utf8 paths
-    let link_args = vec!("-L".to_owned(), aux_dir.as_str().unwrap().to_owned());
-    let llvm_args = vec!("--emit=obj".to_owned(), "--crate-type=lib".to_owned(),
-                         "-C".to_owned(), "save-temps".to_owned());
+    let link_args = vec!("-L".to_strbuf(),
+                         aux_dir.as_str().unwrap().to_strbuf());
+    let llvm_args = vec!("--emit=obj".to_strbuf(),
+                         "--crate-type=lib".to_strbuf(),
+                         "-C".to_strbuf(),
+                         "save-temps".to_strbuf());
     let args = make_compile_args(config,
                                  props,
                                  link_args.append(llvm_args.as_slice()),
@@ -1299,11 +1518,12 @@ fn compile_cc_with_clang_and_save_bitcode(config: &Config, _props: &TestProps,
     let testcc = testfile.with_extension("cc");
     let proc_args = ProcArgs {
         // FIXME (#9639): This needs to handle non-utf8 paths
-        prog: config.clang_path.get_ref().as_str().unwrap().to_owned(),
-        args: vec!("-c".to_owned(),
-                "-emit-llvm".to_owned(),
-                "-o".to_owned(), bitcodefile.as_str().unwrap().to_owned(),
-                testcc.as_str().unwrap().to_owned() )
+        prog: config.clang_path.get_ref().as_str().unwrap().to_strbuf(),
+        args: vec!("-c".to_strbuf(),
+                   "-emit-llvm".to_strbuf(),
+                   "-o".to_strbuf(),
+                   bitcodefile.as_str().unwrap().to_strbuf(),
+                   testcc.as_str().unwrap().to_strbuf())
     };
     compose_and_run(config, testfile, proc_args, Vec::new(), "", None)
 }
@@ -1317,10 +1537,10 @@ fn extract_function_from_bitcode(config: &Config, _props: &TestProps,
     let prog = config.llvm_bin_path.get_ref().join("llvm-extract");
     let proc_args = ProcArgs {
         // FIXME (#9639): This needs to handle non-utf8 paths
-        prog: prog.as_str().unwrap().to_owned(),
-        args: vec!("-func=" + fname,
-                "-o=" + extracted_bc.as_str().unwrap(),
-                bitcodefile.as_str().unwrap().to_owned() )
+        prog: prog.as_str().unwrap().to_strbuf(),
+        args: vec!(format_strbuf!("-func={}", fname),
+                   format_strbuf!("-o={}", extracted_bc.as_str().unwrap()),
+                   bitcodefile.as_str().unwrap().to_strbuf())
     };
     compose_and_run(config, testfile, proc_args, Vec::new(), "", None)
 }
@@ -1334,9 +1554,9 @@ fn disassemble_extract(config: &Config, _props: &TestProps,
     let prog = config.llvm_bin_path.get_ref().join("llvm-dis");
     let proc_args = ProcArgs {
         // FIXME (#9639): This needs to handle non-utf8 paths
-        prog: prog.as_str().unwrap().to_owned(),
-        args: vec!("-o=" + extracted_ll.as_str().unwrap(),
-                extracted_bc.as_str().unwrap().to_owned() )
+        prog: prog.as_str().unwrap().to_strbuf(),
+        args: vec!(format_strbuf!("-o={}", extracted_ll.as_str().unwrap()),
+                   extracted_bc.as_str().unwrap().to_strbuf())
     };
     compose_and_run(config, testfile, proc_args, Vec::new(), "", None)
 }
@@ -1353,42 +1573,44 @@ fn run_codegen_test(config: &Config, props: &TestProps,
                     testfile: &Path, mm: &mut MetricMap) {
 
     if config.llvm_bin_path.is_none() {
-        fatal("missing --llvm-bin-path".to_owned());
+        fatal("missing --llvm-bin-path".to_strbuf());
     }
 
     if config.clang_path.is_none() {
-        fatal("missing --clang-path".to_owned());
+        fatal("missing --clang-path".to_strbuf());
     }
 
     let mut proc_res = compile_test_and_save_bitcode(config, props, testfile);
     if !proc_res.status.success() {
-        fatal_ProcRes("compilation failed!".to_owned(), &proc_res);
+        fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res);
     }
 
     proc_res = extract_function_from_bitcode(config, props, "test", testfile, "");
     if !proc_res.status.success() {
-        fatal_ProcRes("extracting 'test' function failed".to_owned(), &proc_res);
+        fatal_ProcRes("extracting 'test' function failed".to_strbuf(),
+                      &proc_res);
     }
 
     proc_res = disassemble_extract(config, props, testfile, "");
     if !proc_res.status.success() {
-        fatal_ProcRes("disassembling extract failed".to_owned(), &proc_res);
+        fatal_ProcRes("disassembling extract failed".to_strbuf(), &proc_res);
     }
 
 
     let mut proc_res = compile_cc_with_clang_and_save_bitcode(config, props, testfile);
     if !proc_res.status.success() {
-        fatal_ProcRes("compilation failed!".to_owned(), &proc_res);
+        fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res);
     }
 
     proc_res = extract_function_from_bitcode(config, props, "test", testfile, "clang");
     if !proc_res.status.success() {
-        fatal_ProcRes("extracting 'test' function failed".to_owned(), &proc_res);
+        fatal_ProcRes("extracting 'test' function failed".to_strbuf(),
+                      &proc_res);
     }
 
     proc_res = disassemble_extract(config, props, testfile, "clang");
     if !proc_res.status.success() {
-        fatal_ProcRes("disassembling extract failed".to_owned(), &proc_res);
+        fatal_ProcRes("disassembling extract failed".to_strbuf(), &proc_res);
     }
 
     let base = output_base_name(config, testfile);
diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs
index 253b7e87d02..942541c79ee 100644
--- a/src/compiletest/util.rs
+++ b/src/compiletest/util.rs
@@ -33,25 +33,25 @@ pub fn get_os(triple: &str) -> &'static str {
 }
 
 #[cfg(target_os = "win32")]
-pub fn make_new_path(path: &str) -> ~str {
+pub fn make_new_path(path: &str) -> StrBuf {
 
     // Windows just uses PATH as the library search path, so we have to
     // maintain the current value while adding our own
-    match getenv(lib_path_env_var()) {
+    match getenv(lib_path_env_var().as_slice()) {
       Some(curr) => {
-        format!("{}{}{}", path, path_div(), curr)
+        format_strbuf!("{}{}{}", path, path_div(), curr)
       }
-      None => path.to_str()
+      None => path.to_str().to_strbuf()
     }
 }
 
 #[cfg(target_os = "win32")]
-pub fn lib_path_env_var() -> ~str { "PATH".to_owned() }
+pub fn lib_path_env_var() -> StrBuf { "PATH".to_strbuf() }
 
 #[cfg(target_os = "win32")]
-pub fn path_div() -> ~str { ";".to_owned() }
+pub fn path_div() -> StrBuf { ";".to_strbuf() }
 
-pub fn logv(config: &Config, s: ~str) {
+pub fn logv(config: &Config, s: StrBuf) {
     debug!("{}", s);
     if config.verbose { println!("{}", s); }
 }