diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-12-02 17:51:50 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-12-02 17:51:50 -0700 |
commit | c68269097e8b6dfd363a74dcf6c5d7de1f675cd9 (patch) | |
tree | 0a22f9def524a2d1a0367c617a5cbf08150286b7 | |
parent | 600da2af7e6c886f46d013008d2f933b99a2b92f (diff) | |
parent | 41e50b043d4aa6a995be2295ba3e04efce86b3da (diff) | |
download | servo-c68269097e8b6dfd363a74dcf6c5d7de1f675cd9.tar.gz servo-c68269097e8b6dfd363a74dcf6c5d7de1f675cd9.zip |
auto merge of #4155 : mttr/servo/reftest_unknown_servo_args, r=jdm
Fixes #4101
-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, |