diff options
-rw-r--r-- | tests/reftest.rs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/reftest.rs b/tests/reftest.rs index 0c747be8b5b..af186eeffa2 100644 --- a/tests/reftest.rs +++ b/tests/reftest.rs @@ -17,7 +17,7 @@ extern crate url; use std::ascii::AsciiExt; use std::io; -use std::io::{File, Reader, Command}; +use std::io::{File, Reader, Command, IoResult}; use std::io::process::ExitStatus; use std::io::fs::PathExtensions; use std::os; @@ -98,13 +98,34 @@ fn main() { color: AutoColor }; - match run_tests_console(&test_opts, all_tests) { + match run(test_opts, + all_tests, + servo_args.iter().map(|x| x.clone()).collect()) { Ok(false) => os::set_exit_status(1), // tests failed Err(_) => os::set_exit_status(2), // I/O-related failure _ => (), } } +fn run(test_opts: TestOpts, all_tests: Vec<TestDescAndFn>, + servo_args: Vec<String>) -> IoResult<bool> { + // Verify that we're passing in valid servo arguments. Otherwise, servo + // will exit before we've run any tests, and it will appear to us as if + // all the tests are failing. + let mut command = match Command::new("target/servo").args(servo_args.as_slice()).spawn() { + Ok(p) => p, + Err(e) => panic!("failed to execute process: {}", e), + }; + let stderr = command.stderr.as_mut().unwrap().read_to_string().unwrap(); + + if stderr.as_slice().contains("Unrecognized") { + println!("Servo: {}", stderr.as_slice()); + return Ok(false); + } + + run_tests_console(&test_opts, all_tests) +} + #[deriving(PartialEq)] enum ReftestKind { Same, |