pub fn parse_config(args: ~[~str]) -> config {
let opts =
- ~[getopts::reqopt(~"compile-lib-path"),
- getopts::reqopt(~"run-lib-path"),
- getopts::reqopt(~"rustc-path"), getopts::reqopt(~"src-base"),
- getopts::reqopt(~"build-base"), getopts::reqopt(~"aux-base"),
- getopts::reqopt(~"stage-id"),
- getopts::reqopt(~"mode"), getopts::optflag(~"ignored"),
- getopts::optopt(~"runtool"), getopts::optopt(~"rustcflags"),
- getopts::optflag(~"verbose"),
- getopts::optopt(~"logfile"),
- getopts::optflag(~"jit"),
- getopts::optflag(~"newrt"),
- getopts::optopt(~"target"),
- getopts::optopt(~"adb-path"),
- getopts::optopt(~"adb-test-dir")
+ ~[getopts::reqopt("compile-lib-path"),
+ getopts::reqopt("run-lib-path"),
+ getopts::reqopt("rustc-path"), getopts::reqopt("src-base"),
+ getopts::reqopt("build-base"), getopts::reqopt("aux-base"),
+ getopts::reqopt("stage-id"),
+ getopts::reqopt("mode"), getopts::optflag("ignored"),
+ getopts::optopt("runtool"), getopts::optopt("rustcflags"),
+ getopts::optflag("verbose"),
+ getopts::optopt("logfile"),
+ getopts::optflag("jit"),
+ getopts::optflag("newrt"),
+ getopts::optopt("target"),
+ getopts::optopt("adb-path"),
+ getopts::optopt("adb-test-dir")
];
assert!(!args.is_empty());
Err(f) => fail!(getopts::fail_str(f))
};
- fn opt_path(m: &getopts::Matches, nm: ~str) -> Path {
+ fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
Path(getopts::opt_str(m, nm))
}
config {
- compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
- run_lib_path: getopts::opt_str(matches, ~"run-lib-path"),
- rustc_path: opt_path(matches, ~"rustc-path"),
- src_base: opt_path(matches, ~"src-base"),
- build_base: opt_path(matches, ~"build-base"),
- aux_base: opt_path(matches, ~"aux-base"),
- stage_id: getopts::opt_str(matches, ~"stage-id"),
- mode: str_mode(getopts::opt_str(matches, ~"mode")),
- run_ignored: getopts::opt_present(matches, ~"ignored"),
+ compile_lib_path: getopts::opt_str(matches, "compile-lib-path"),
+ run_lib_path: getopts::opt_str(matches, "run-lib-path"),
+ rustc_path: opt_path(matches, "rustc-path"),
+ src_base: opt_path(matches, "src-base"),
+ build_base: opt_path(matches, "build-base"),
+ aux_base: opt_path(matches, "aux-base"),
+ stage_id: getopts::opt_str(matches, "stage-id"),
+ mode: str_mode(getopts::opt_str(matches, "mode")),
+ run_ignored: getopts::opt_present(matches, "ignored"),
filter:
if vec::len(matches.free) > 0u {
option::Some(copy matches.free[0])
} else { option::None },
- logfile: getopts::opt_maybe_str(matches, ~"logfile").map(|s| Path(*s)),
- runtool: getopts::opt_maybe_str(matches, ~"runtool"),
- rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
- jit: getopts::opt_present(matches, ~"jit"),
- newrt: getopts::opt_present(matches, ~"newrt"),
- target: opt_str2(getopts::opt_maybe_str(matches, ~"target")).to_str(),
- adb_path: opt_str2(getopts::opt_maybe_str(matches, ~"adb-path")).to_str(),
+ logfile: getopts::opt_maybe_str(matches, "logfile").map(|s| Path(*s)),
+ runtool: getopts::opt_maybe_str(matches, "runtool"),
+ rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
+ jit: getopts::opt_present(matches, "jit"),
+ newrt: getopts::opt_present(matches, "newrt"),
+ target: opt_str2(getopts::opt_maybe_str(matches, "target")).to_str(),
+ adb_path: opt_str2(getopts::opt_maybe_str(matches, "adb-path")).to_str(),
adb_test_dir:
- opt_str2(getopts::opt_maybe_str(matches, ~"adb-test-dir")).to_str(),
+ opt_str2(getopts::opt_maybe_str(matches, "adb-test-dir")).to_str(),
adb_device_status:
- if (opt_str2(getopts::opt_maybe_str(matches, ~"target")) ==
+ if (opt_str2(getopts::opt_maybe_str(matches, "target")) ==
~"arm-linux-androideabi") {
- if (opt_str2(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
+ if (opt_str2(getopts::opt_maybe_str(matches, "adb-test-dir")) !=
~"(none)" &&
- opt_str2(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
+ opt_str2(getopts::opt_maybe_str(matches, "adb-test-dir")) !=
~"") { true }
else { false }
} else { false },
- verbose: getopts::opt_present(matches, ~"verbose")
+ verbose: getopts::opt_present(matches, "verbose")
}
}
pub fn run(config: config, testfile: ~str) {
if config.verbose {
// We're going to be dumping a lot of info. Start on a new line.
- io::stdout().write_str(~"\n\n");
+ io::stdout().write_str("\n\n");
}
let testfile = Path(testfile);
debug!("running %s", testfile.to_str());
// do not optimize debuginfo tests
let mut config = match config.rustcflags {
Some(ref flags) => config {
- rustcflags: Some(str::replace(*flags, ~"-O", ~"")),
+ rustcflags: Some(str::replace(*flags, "-O", "")),
.. copy *config
},
None => copy *config
// write debugger script
let script_str = str::append(cmds, "\nquit\n");
debug!("script_str = %s", script_str);
- dump_output_file(config, testfile, script_str, ~"debugger.script");
+ dump_output_file(config, testfile, script_str, "debugger.script");
// run debugger script with gdb
#[cfg(windows)]
fn debugger() -> ~str { ~"gdb.exe" }
#[cfg(unix)]
fn debugger() -> ~str { ~"gdb" }
- let debugger_script = make_out_name(config, testfile, ~"debugger.script");
+ let debugger_script = make_out_name(config, testfile, "debugger.script");
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
~"-command=" + debugger_script.to_str(),
make_exe_name(config, testfile).to_str()];
let ProcArgs = ProcArgs {prog: debugger(), args: debugger_opts};
- ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], ~"", None);
+ ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], "", None);
if ProcRes.status != 0 {
fatal(~"gdb failed to execute");
}
}
// ignore this msg which gets printed at the end
- if str::contains(line, ~"aborting due to") {
+ if str::contains(line, "aborting due to") {
was_expected = true;
}
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
fn make_cmdline(_libpath: &str, prog: &str, args: &[~str]) -> ~str {
- fmt!("%s %s", prog, str::connect(args, ~" "))
+ fmt!("%s %s", prog, str::connect(args, " "))
}
#[cfg(target_os = "win32")]
out: &str, extension: &str) {
let outfile = make_out_name(config, testfile, extension);
let writer =
- io::file_writer(&outfile, ~[io::Create, io::Truncate]).get();
+ io::file_writer(&outfile, [io::Create, io::Truncate]).get();
writer.write_str(out);
}
fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) {
if config.verbose {
- let sep1 = fmt!("------%s------------------------------", ~"stdout");
- let sep2 = fmt!("------%s------------------------------", ~"stderr");
+ let sep1 = fmt!("------%s------------------------------", "stdout");
+ let sep2 = fmt!("------%s------------------------------", "stderr");
let sep3 = ~"------------------------------------------";
io::stdout().write_line(sep1);
io::stdout().write_line(out);
newargs_err.push(newcmd_err);
let procsrv::Result{ out: out_out, err: _out_err, status: out_status } =
- procsrv::run(~"", config.adb_path, newargs_out, ~[(~"",~"")],
+ procsrv::run("", config.adb_path, newargs_out, ~[(~"",~"")],
Some(~""));
let procsrv::Result{ out: err_out, err: _err_err, status: _err_status } =
- procsrv::run(~"", config.adb_path, newargs_err, ~[(~"",~"")],
+ procsrv::run("", config.adb_path, newargs_err, ~[(~"",~"")],
Some(~""));
dump_output(config, testfile, out_out, err_out);
if (file.filetype() == Some(~".so")) {
- let copy_result = procsrv::run(~"", config.adb_path,
- ~[~"push", file.to_str(), copy config.adb_test_dir],
+ let copy_result = procsrv::run("", config.adb_path,
+ [~"push", file.to_str(), copy config.adb_test_dir],
~[(~"",~"")], Some(~""));
if config.verbose {