Verify that reftest passes valid servo args

Fixes #4101
This commit is contained in:
Matthew Rasmus 2014-11-30 11:49:40 -08:00
parent 9cea3ce266
commit 41e50b043d

View file

@ -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,