use std::from_str::FromStr;
use getopts::{optopt, optflag, reqopt};
use common::Config;
-use common::{Pretty, DebugInfoGdb, Codegen};
+use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
use util::logv;
use regex::Regex;
optflag("", "jit", "run tests under the JIT"),
optopt("", "target", "the target to build for", "TARGET"),
optopt("", "host", "the host to build for", "HOST"),
+ optopt("", "gdb-version", "the version of GDB used", "MAJOR.MINOR"),
optopt("", "android-cross-path", "Android NDK standalone path", "PATH"),
optopt("", "adb-path", "path to the android debugger", "PATH"),
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
optflag("h", "help", "show this message"));
assert!(!args.is_empty());
- let argv0 = (*args.get(0)).clone();
+ let argv0 = args[0].clone();
let args_ = args.tail();
- if args.get(1).as_slice() == "-h" || args.get(1).as_slice() == "--help" {
+ if args[1].as_slice() == "-h" || args[1].as_slice() == "--help" {
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
println!("{}", getopts::usage(message.as_slice(), groups.as_slice()));
println!("");
}
let filter = if !matches.free.is_empty() {
- let s = matches.free.get(0).as_slice();
+ let s = matches.free[0].as_slice();
match regex::Regex::new(s) {
Ok(re) => Some(re),
Err(e) => {
jit: matches.opt_present("jit"),
target: opt_str2(matches.opt_str("target")),
host: opt_str2(matches.opt_str("host")),
+ gdb_version: extract_gdb_version(matches.opt_str("gdb-version")),
android_cross_path: opt_path(matches, "android-cross-path"),
adb_path: opt_str2(matches.opt_str("adb-path")),
adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")),
os::setenv("RUST_TEST_TASKS","1");
}
+ match config.mode {
+ DebugInfoLldb => {
+ // Some older versions of LLDB seem to have problems with multiple
+ // instances running in parallel, so only run one test task at a
+ // time.
+ os::setenv("RUST_TEST_TASKS", "1");
+ }
+ _ => { /* proceed */ }
+ }
+
let opts = test_opts(config);
let tests = make_tests(config);
// sadly osx needs some file descriptor limits raised for running tests in
// parallel (especially when we have lots and lots of child processes).
// For context, see #8904
io::test::raise_fd_limit();
- let res = test::run_tests_console(&opts, tests.move_iter().collect());
+ let res = test::run_tests_console(&opts, tests.into_iter().collect());
match res {
Ok(true) => {}
Ok(false) => fail!("Some tests failed"),
runtest::run_metrics(config, testfile, mm)
})
}
+
+fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
+ match full_version_line {
+ Some(ref full_version_line)
+ if full_version_line.as_slice().trim().len() > 0 => {
+ let full_version_line = full_version_line.as_slice().trim();
+
+ let re = Regex::new(r"(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)").unwrap();
+
+ match re.captures(full_version_line) {
+ Some(captures) => {
+ Some(captures.at(2).to_string())
+ }
+ None => {
+ println!("Could not extract GDB version from line '{}'",
+ full_version_line);
+ None
+ }
+ }
+ },
+ _ => None
+ }
+}