mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
commit
a5aabefa4c
4 changed files with 21 additions and 7 deletions
|
@ -39,6 +39,7 @@ pub struct Opts {
|
||||||
|
|
||||||
output_file: Option<~str>,
|
output_file: Option<~str>,
|
||||||
headless: bool,
|
headless: bool,
|
||||||
|
hard_fail: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_usage(app: &str, opts: &[groups::OptGroup]) {
|
fn print_usage(app: &str, opts: &[groups::OptGroup]) {
|
||||||
|
@ -59,6 +60,7 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts {
|
||||||
groups::optflagopt("p", "profile", "Profiler flag and output interval", "10"),
|
groups::optflagopt("p", "profile", "Profiler flag and output interval", "10"),
|
||||||
groups::optflag("x", "exit", "Exit after load flag"),
|
groups::optflag("x", "exit", "Exit after load flag"),
|
||||||
groups::optflag("z", "headless", "Headless mode"),
|
groups::optflag("z", "headless", "Headless mode"),
|
||||||
|
groups::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"),
|
||||||
groups::optflag("h", "help", "Print this message")
|
groups::optflag("h", "help", "Print this message")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -127,5 +129,6 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts {
|
||||||
exit_after_load: opt_match.opt_present("x"),
|
exit_after_load: opt_match.opt_present("x"),
|
||||||
output_file: opt_match.opt_str("o"),
|
output_file: opt_match.opt_str("o"),
|
||||||
headless: opt_match.opt_present("z"),
|
headless: opt_match.opt_present("z"),
|
||||||
|
hard_fail: opt_match.opt_present("f"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,9 @@ impl<C: RenderListener + Send,T:Send+Freeze> RenderTask<C,T> {
|
||||||
render_task.start();
|
render_task.start();
|
||||||
|
|
||||||
// Destroy all the buffers.
|
// Destroy all the buffers.
|
||||||
render_task.buffer_map.clear(native_graphics_context!(render_task));
|
render_task.native_graphics_context.as_ref().map(|ctx|
|
||||||
|
render_task.buffer_map.clear(ctx)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ impl Pipeline {
|
||||||
|
|
||||||
// Wrap task creation within a supervised task so that failure will
|
// Wrap task creation within a supervised task so that failure will
|
||||||
// only tear down those tasks instead of ours.
|
// only tear down those tasks instead of ours.
|
||||||
|
let hard_fail = opts.hard_fail;
|
||||||
let failure_chan = constellation_chan.clone();
|
let failure_chan = constellation_chan.clone();
|
||||||
let mut supervised_task = task::task();
|
let mut supervised_task = task::task();
|
||||||
let task_port = supervised_task.future_result();
|
let task_port = supervised_task.future_result();
|
||||||
|
@ -139,6 +140,9 @@ impl Pipeline {
|
||||||
match task_port.recv() {
|
match task_port.recv() {
|
||||||
Ok(*) => (),
|
Ok(*) => (),
|
||||||
Err(*) => {
|
Err(*) => {
|
||||||
|
if hard_fail {
|
||||||
|
fail!("Pipeline failed in hard-fail mode");
|
||||||
|
}
|
||||||
failure_chan.send(FailureMsg(id, subpage_id));
|
failure_chan.send(FailureMsg(id, subpage_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ 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::Reader;
|
||||||
use std::rt::io::process::{Process, ProcessConfig, Ignored, CreatePipe};
|
use std::rt::io::process::{Process, ProcessConfig, Ignored, CreatePipe, InheritFd};
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
struct Config {
|
struct Config {
|
||||||
|
@ -88,21 +88,21 @@ 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 create_pipe = CreatePipe(true, false); // rustc #10228
|
let stdout = CreatePipe(true, false); // rustc #10228
|
||||||
|
let stderr = InheritFd(2);
|
||||||
|
|
||||||
let config = ProcessConfig {
|
let config = ProcessConfig {
|
||||||
program: "./servo",
|
program: "./servo",
|
||||||
args: [~"-z", infile.clone()],
|
args: [~"-z", ~"-f", infile.clone()],
|
||||||
env: None,
|
env: None,
|
||||||
cwd: None,
|
cwd: None,
|
||||||
io: [Ignored, create_pipe, Ignored]
|
io: [Ignored, stdout, stderr]
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut prc = Process::new(config).unwrap();
|
let mut prc = Process::new(config).unwrap();
|
||||||
let stdout = prc.io[1].get_mut_ref();
|
|
||||||
let mut output = ~[];
|
let mut output = ~[];
|
||||||
loop {
|
loop {
|
||||||
let byte = stdout.read_byte();
|
let byte = prc.io[1].get_mut_ref().read_byte();
|
||||||
match byte {
|
match byte {
|
||||||
Some(byte) => {
|
Some(byte) => {
|
||||||
print!("{}", byte as char);
|
print!("{}", byte as char);
|
||||||
|
@ -119,4 +119,9 @@ fn run_test(file: ~str) {
|
||||||
fail!(line);
|
fail!(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let retval = prc.wait();
|
||||||
|
if retval != 0 {
|
||||||
|
fail!("Servo exited with non-zero status {}", retval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue