Skip to content

Commit

Permalink
auto merge of #20677 : alexcrichton/rust/rollup, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Jan 7, 2015
2 parents ea6f65c + a640008 commit 9e4e524
Show file tree
Hide file tree
Showing 732 changed files with 8,950 additions and 13,793 deletions.
13 changes: 9 additions & 4 deletions src/compiletest/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ impl FromStr for Mode {
}
}

impl fmt::Show for Mode {
impl fmt::String for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let msg = match *self {
fmt::String::fmt(match *self {
CompileFail => "compile-fail",
RunFail => "run-fail",
RunPass => "run-pass",
Expand All @@ -54,8 +54,13 @@ impl fmt::Show for Mode {
DebugInfoGdb => "debuginfo-gdb",
DebugInfoLldb => "debuginfo-lldb",
Codegen => "codegen",
};
msg.fmt(f)
}, f)
}
}

impl fmt::Show for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f)
}
}

Expand Down
34 changes: 14 additions & 20 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,15 @@
// except according to those terms.

#![crate_type = "bin"]
#![feature(phase, slicing_syntax, globs, unboxed_closures)]
#![feature(slicing_syntax, unboxed_closures)]

#![deny(warnings)]

extern crate test;
extern crate getopts;

#[cfg(stage0)]
#[phase(plugin, link)]
extern crate log;

#[cfg(not(stage0))]
#[macro_use]
extern crate log;

extern crate regex;

use std::os;
Expand Down Expand Up @@ -108,7 +102,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
let matches =
&match getopts::getopts(args_.as_slice(), groups.as_slice()) {
Ok(m) => m,
Err(f) => panic!("{}", f)
Err(f) => panic!("{:?}", f)
};

if matches.opt_present("h") || matches.opt_present("help") {
Expand All @@ -127,7 +121,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
match regex::Regex::new(s) {
Ok(re) => Some(re),
Err(e) => {
println!("failed to parse filter /{}/: {}", s, e);
println!("failed to parse filter /{}/: {:?}", s, e);
panic!()
}
}
Expand Down Expand Up @@ -186,11 +180,11 @@ pub fn parse_config(args: Vec<String> ) -> 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!("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));
Expand All @@ -206,10 +200,10 @@ pub fn log_config(config: &Config) {
logv(c, format!("jit: {}", config.jit));
logv(c, format!("target: {}", config.target));
logv(c, format!("host: {}", config.host));
logv(c, format!("android-cross-path: {}",
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_path: {:?}", config.adb_path));
logv(c, format!("adb_test_dir: {:?}", config.adb_test_dir));
logv(c, format!("adb_device_status: {}",
config.adb_device_status));
match config.test_shard {
Expand Down Expand Up @@ -271,7 +265,7 @@ pub fn run_tests(config: &Config) {
Ok(true) => {}
Ok(false) => panic!("Some tests failed"),
Err(e) => {
println!("I/O failure during tests: {}", e);
println!("I/O failure during tests: {:?}", e);
}
}
}
Expand Down Expand Up @@ -299,13 +293,13 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
}

pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> {
debug!("making tests from {}",
debug!("making tests from {:?}",
config.src_base.display());
let mut tests = Vec::new();
let dirs = fs::readdir(&config.src_base).unwrap();
for file in dirs.iter() {
let file = file.clone();
debug!("inspecting file {}", file.display());
debug!("inspecting file {:?}", file.display());
if is_test(config, &file) {
let t = make_test(config, &file, || {
match config.mode {
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn parse_expected(last_nonfollow_error: Option<uint>,
(which, line)
};

debug!("line={} which={} kind={} msg={}", line_num, which, kind, msg);
debug!("line={} which={:?} kind={:?} msg={:?}", line_num, which, kind, msg);
Some((which, ExpectedError { line: line,
kind: kind,
msg: msg, }))
Expand Down
39 changes: 19 additions & 20 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn run_metrics(config: Config, testfile: String, mm: &mut MetricMap) {
print!("\n\n");
}
let testfile = Path::new(testfile);
debug!("running {}", testfile.display());
debug!("running {:?}", testfile.display());
let props = header::load_props(&testfile);
debug!("loaded props");
match config.mode {
Expand Down Expand Up @@ -141,7 +141,7 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
static RUST_ERR: int = 101;
if !proc_res.status.matches_exit_status(RUST_ERR) {
fatal_proc_rec(
format!("failure produced the wrong error: {}",
format!("failure produced the wrong error: {:?}",
proc_res.status).as_slice(),
proc_res);
}
Expand Down Expand Up @@ -410,7 +410,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
],
vec!(("".to_string(), "".to_string())),
Some("".to_string()))
.expect(format!("failed to exec `{}`", config.adb_path).as_slice());
.expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());

procsrv::run("",
config.adb_path.as_slice(),
Expand All @@ -422,7 +422,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
],
vec!(("".to_string(), "".to_string())),
Some("".to_string()))
.expect(format!("failed to exec `{}`", config.adb_path).as_slice());
.expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());

let adb_arg = format!("export LD_LIBRARY_PATH={}; \
gdbserver :5039 {}/{}",
Expand All @@ -443,11 +443,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
vec!(("".to_string(),
"".to_string())),
Some("".to_string()))
.expect(format!("failed to exec `{}`", config.adb_path).as_slice());
.expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());
loop {
//waiting 1 second for gdbserver start
timer::sleep(Duration::milliseconds(1000));
let result = Thread::spawn(move || {
let result = Thread::scoped(move || {
tcp::TcpStream::connect("127.0.0.1:5039").unwrap();
}).join();
if result.is_err() {
Expand Down Expand Up @@ -481,7 +481,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
debugger_opts.as_slice(),
vec!(("".to_string(), "".to_string())),
None)
.expect(format!("failed to exec `{}`", gdb_path).as_slice());
.expect(format!("failed to exec `{:?}`", gdb_path).as_slice());
let cmdline = {
let cmdline = make_cmdline("",
"arm-linux-androideabi-gdb",
Expand Down Expand Up @@ -539,18 +539,17 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
script_str.push_str("set print pretty off\n");

// Add the pretty printer directory to GDB's source-file search path
script_str.push_str(format!("directory {}\n", rust_pp_module_abs_path)[]);
script_str.push_str(&format!("directory {}\n", rust_pp_module_abs_path)[]);

// Load the target executable
script_str.push_str(format!("file {}\n",
exe_file.as_str().unwrap().replace("\\", "\\\\"))
.as_slice());
script_str.push_str(&format!("file {}\n",
exe_file.as_str().unwrap().replace("\\", "\\\\"))[]);

// Add line breakpoints
for line in breakpoint_lines.iter() {
script_str.push_str(format!("break '{}':{}\n",
testfile.filename_display(),
*line)[]);
script_str.push_str(&format!("break '{:?}':{}\n",
testfile.filename_display(),
*line)[]);
}

script_str.push_str(cmds.as_slice());
Expand Down Expand Up @@ -676,7 +675,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
.unwrap()
.to_string();

script_str.push_str(format!("command script import {}\n", rust_pp_module_abs_path[])[]);
script_str.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[])[]);
script_str.push_str("type summary add --no-value ");
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
script_str.push_str("-x \".*\" --category Rust\n");
Expand Down Expand Up @@ -889,7 +888,7 @@ fn check_error_patterns(props: &TestProps,
output_to_check: &str,
proc_res: &ProcRes) {
if props.error_patterns.is_empty() {
fatal(format!("no error pattern specified in {}",
fatal(format!("no error pattern specified in {:?}",
testfile.display()).as_slice());
}
let mut next_err_idx = 0u;
Expand All @@ -910,7 +909,7 @@ fn check_error_patterns(props: &TestProps,
if done { return; }

let missing_patterns =
props.error_patterns[next_err_idx..];
props.error_patterns.index(&(next_err_idx..));
if missing_patterns.len() == 1u {
fatal_proc_rec(format!("error pattern '{}' not found!",
missing_patterns[0]).as_slice(),
Expand Down Expand Up @@ -955,7 +954,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
}

let prefixes = expected_errors.iter().map(|ee| {
format!("{}:{}:", testfile.display(), ee.line)
format!("{:?}:{}:", testfile.display(), ee.line)
}).collect::<Vec<String> >();

#[cfg(windows)]
Expand Down Expand Up @@ -1191,7 +1190,7 @@ fn compose_and_run_compiler(
None);
if !auxres.status.success() {
fatal_proc_rec(
format!("auxiliary build of {} failed to compile: ",
format!("auxiliary build of {:?} failed to compile: ",
abs_ab.display()).as_slice(),
&auxres);
}
Expand Down Expand Up @@ -1601,7 +1600,7 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
.expect(format!("failed to exec `{}`", config.adb_path).as_slice());

if config.verbose {
println!("push ({}) {} {} {}",
println!("push ({}) {:?} {} {}",
config.target, file.display(),
copy_result.out, copy_result.err);
}
Expand Down
4 changes: 2 additions & 2 deletions src/doc/guide-error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ fn parse_version(header: &[u8]) -> Result<Version, ParseError> {
let version = parse_version(&[1, 2, 3, 4]);
match version {
Ok(v) => {
println!("working with version: {}", v);
println!("working with version: {:?}", v);
}
Err(e) => {
println!("error parsing header: {}", e);
println!("error parsing header: {:?}", e);
}
}
```
Expand Down
Loading

0 comments on commit 9e4e524

Please sign in to comment.