mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Display live stdout from content tests.
This commit is contained in:
parent
ddce8b8fa0
commit
403a82eb82
1 changed files with 28 additions and 4 deletions
|
@ -12,9 +12,11 @@ extern mod extra;
|
||||||
|
|
||||||
use extra::test::{TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName};
|
use extra::test::{TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName};
|
||||||
use extra::getopts::{getopts, reqopt};
|
use extra::getopts::{getopts, reqopt};
|
||||||
use std::{os, run, str};
|
use std::{os, str};
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::os::list_dir_path;
|
use std::os::list_dir_path;
|
||||||
|
use std::rt::io::Reader;
|
||||||
|
use std::rt::io::process::{Process, ProcessConfig, Ignored, CreatePipe};
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
struct Config {
|
struct Config {
|
||||||
|
@ -87,9 +89,31 @@ fn run_test(file: ~str) {
|
||||||
let path = os::make_absolute(&Path::new(file));
|
let path = os::make_absolute(&Path::new(file));
|
||||||
// FIXME (#1094): not the right way to transform a path
|
// FIXME (#1094): not the right way to transform a path
|
||||||
let infile = ~"file://" + path.display().to_str();
|
let infile = ~"file://" + path.display().to_str();
|
||||||
let res = run::process_output("./servo", [~"-z", infile]);
|
let create_pipe = CreatePipe(true, false); // rustc #10228
|
||||||
let out = str::from_utf8(res.output);
|
|
||||||
print(out);
|
let config = ProcessConfig {
|
||||||
|
program: "./servo",
|
||||||
|
args: [~"-z", infile.clone()],
|
||||||
|
env: None,
|
||||||
|
cwd: None,
|
||||||
|
io: [Ignored, create_pipe, Ignored]
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut prc = Process::new(config).unwrap();
|
||||||
|
let stdout = prc.io[1].get_mut_ref();
|
||||||
|
let mut output = ~[];
|
||||||
|
loop {
|
||||||
|
let byte = stdout.read_byte();
|
||||||
|
match byte {
|
||||||
|
Some(byte) => {
|
||||||
|
print!("{}", byte as char);
|
||||||
|
output.push(byte);
|
||||||
|
}
|
||||||
|
None => break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let out = str::from_utf8(output);
|
||||||
let lines: ~[&str] = out.split_iter('\n').collect();
|
let lines: ~[&str] = out.split_iter('\n').collect();
|
||||||
for &line in lines.iter() {
|
for &line in lines.iter() {
|
||||||
if line.contains("TEST-UNEXPECTED-FAIL") {
|
if line.contains("TEST-UNEXPECTED-FAIL") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue