diff options
author | bors-servo <release+servo@mozilla.com> | 2014-02-26 22:37:38 -0500 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-02-26 22:37:38 -0500 |
commit | 94a12469f05f8f00092a88ff1ae11fc33c086bbb (patch) | |
tree | 17faa80d603f85a1ed19a9b91f6e5f5e4623d19c /src | |
parent | 421ba1a856358058abdac06f8132c114e3826268 (diff) | |
parent | 2f2df093036f40541eb9200751dfded2331c4024 (diff) | |
download | servo-94a12469f05f8f00092a88ff1ae11fc33c086bbb.tar.gz servo-94a12469f05f8f00092a88ff1ae11fc33c086bbb.zip |
auto merge of #1767 : kmcallister/servo/misc, r=metajack
Diffstat (limited to 'src')
-rwxr-xr-x | src/components/main/servo.rs | 4 | ||||
-rw-r--r-- | src/components/util/opts.rs | 25 | ||||
-rw-r--r-- | src/test/harness/reftest/rasterize.py | 31 | ||||
-rw-r--r-- | src/test/html/ref/blank.html | 5 | ||||
-rw-r--r-- | src/test/html/ref/boxes.png | bin | 4112 -> 0 bytes | |||
-rw-r--r-- | src/test/html/ref/compute_height_width.html | 14 | ||||
-rw-r--r-- | src/test/html/ref/height_compute.html | 14 | ||||
-rw-r--r-- | src/test/html/ref/height_compute_reset.html | 15 | ||||
-rw-r--r-- | src/test/html/ref/height_width.css | 10 | ||||
-rw-r--r-- | src/test/html/ref/simple-reset.css | 1 | ||||
-rw-r--r-- | src/test/html/ref/square.css | 2 | ||||
-rw-r--r-- | src/test/html/ref/square.html | 6 | ||||
-rw-r--r-- | src/test/html/ref/test-image.html | 12 | ||||
-rw-r--r-- | src/test/ref/basic.list | 1 | ||||
-rw-r--r-- | src/test/ref/height_compute.html (renamed from src/test/html/ref/height_compute.css) | 14 | ||||
-rw-r--r-- | src/test/ref/height_compute_reset.html (renamed from src/test/html/ref/height_compute_reset.css) | 15 | ||||
-rw-r--r-- | src/test/ref/reset.css (renamed from src/test/html/ref/reset.css) | 0 |
17 files changed, 49 insertions, 120 deletions
diff --git a/src/components/main/servo.rs b/src/components/main/servo.rs index 53071519273..a176fbb71f6 100755 --- a/src/components/main/servo.rs +++ b/src/components/main/servo.rs @@ -117,7 +117,7 @@ pub mod util; #[start] fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, proc() { - run(opts::from_cmdline_args(os::args())) + opts::from_cmdline_args(os::args()).map(run); }) } @@ -131,7 +131,7 @@ pub extern "C" fn android_start(argc: int, argv: **u8) -> int { args.push(str::raw::from_c_str(*argv.offset(i as int) as *i8)); } } - run(opts::from_cmdline_args(args)) + opts::from_cmdline_args(os::args()).map(run); }) } diff --git a/src/components/util/opts.rs b/src/components/util/opts.rs index 2f1d9777b8a..e33d5b87379 100644 --- a/src/components/util/opts.rs +++ b/src/components/util/opts.rs @@ -10,6 +10,8 @@ use azure::azure_hl::{CoreGraphicsAcceleratedBackend, Direct2DBackend, SkiaBacke use extra::getopts::groups; use std::num; use std::rt; +use std::io; +use std::os; /// Global flags for Servo, currently set on the command line. #[deriving(Clone)] @@ -59,7 +61,12 @@ fn print_usage(app: &str, opts: &[groups::OptGroup]) { println(groups::usage(message, opts)); } -pub fn from_cmdline_args(args: &[~str]) -> Opts { +fn args_fail(msg: &str) { + io::stderr().write_line(msg); + os::set_exit_status(1); +} + +pub fn from_cmdline_args(args: &[~str]) -> Option<Opts> { let app_name = args[0].to_str(); let args = args.tail(); @@ -80,19 +87,21 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts { let opt_match = match groups::getopts(args, opts) { Ok(m) => m, - Err(f) => fail!(f.to_err_msg()), + Err(f) => { + args_fail(f.to_err_msg()); + return None; + } }; if opt_match.opt_present("h") || opt_match.opt_present("help") { print_usage(app_name, opts); - // TODO: how to return a null struct and let the caller know that - // it should abort? - fail!("") + return None; }; let urls = if opt_match.free.is_empty() { print_usage(app_name, opts); - fail!(~"servo asks that you provide 1 or more URLs") + args_fail("servo asks that you provide 1 or more URLs"); + return None; } else { opt_match.free.clone() }; @@ -138,7 +147,7 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts { None => num::max(rt::default_sched_threads() * 3 / 4, 1), }; - Opts { + Some(Opts { urls: urls, render_backend: render_backend, n_render_threads: n_render_threads, @@ -151,5 +160,5 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts { headless: opt_match.opt_present("z"), hard_fail: opt_match.opt_present("f"), bubble_widths_separately: opt_match.opt_present("b"), - } + }) } diff --git a/src/test/harness/reftest/rasterize.py b/src/test/harness/reftest/rasterize.py deleted file mode 100644 index 44170e142a8..00000000000 --- a/src/test/harness/reftest/rasterize.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2013 The Servo Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution. -# -# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import sys, os -from selenium import webdriver - -input = sys.argv[1] -output = sys.argv[2] - -input = os.path.abspath(input) -output = os.path.abspath(output) - -input = "file://" + input - -print input -print output - -driver = webdriver.Firefox() - -driver.set_window_size(800, 1000) -driver.get(input) - -screenshot = driver.get_screenshot_as_file(output) - -driver.quit() diff --git a/src/test/html/ref/blank.html b/src/test/html/ref/blank.html deleted file mode 100644 index eaca3f49fd1..00000000000 --- a/src/test/html/ref/blank.html +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE html> -<html> -<body> -</body> -</html> diff --git a/src/test/html/ref/boxes.png b/src/test/html/ref/boxes.png Binary files differdeleted file mode 100644 index 10119280ce1..00000000000 --- a/src/test/html/ref/boxes.png +++ /dev/null diff --git a/src/test/html/ref/compute_height_width.html b/src/test/html/ref/compute_height_width.html deleted file mode 100644 index 5ecbdf0330f..00000000000 --- a/src/test/html/ref/compute_height_width.html +++ /dev/null @@ -1,14 +0,0 @@ -<!-- ignore --> -<head> - <link rel="stylesheet" href="height_width.css" /> -</head> -<body> - <div class="start"> - <div class="whole"></div> - <div class="half"></div> - <div class="quarter"></div> - <div class="eighth"></div> - <div class="sixteenth"></div> - <div class="thirtysecond"></div> - </div> -</body> diff --git a/src/test/html/ref/height_compute.html b/src/test/html/ref/height_compute.html deleted file mode 100644 index c1610bb4d91..00000000000 --- a/src/test/html/ref/height_compute.html +++ /dev/null @@ -1,14 +0,0 @@ -<!-- ignore --> -<head> - <link rel="stylesheet" href="height_compute.css" /> -</head> -<body> - <div class="start"> - <div class="half"></div> - <div class="quarter"></div> - <div class="eighth"></div> - <div class="sixteenth"></div> - <div class="thirtysecond"></div> - <div class="sixtyfourth"></div> - </div> -</body> diff --git a/src/test/html/ref/height_compute_reset.html b/src/test/html/ref/height_compute_reset.html deleted file mode 100644 index 2440844096c..00000000000 --- a/src/test/html/ref/height_compute_reset.html +++ /dev/null @@ -1,15 +0,0 @@ -<!-- ignore --> -<head> - <link rel="stylesheet" href="reset.css" /> - <link rel="stylesheet" href="height_compute_reset.css" /> -</head> -<body> - <div class="start"> - <div class="half"></div> - <div class="quarter"></div> - <div class="eighth"></div> - <div class="sixteenth"></div> - <div class="thirtysecond"></div> - <div class="sixtyfourth"></div> - </div> -</body> diff --git a/src/test/html/ref/height_width.css b/src/test/html/ref/height_width.css deleted file mode 100644 index 8e5f58aca10..00000000000 --- a/src/test/html/ref/height_width.css +++ /dev/null @@ -1,10 +0,0 @@ -div {display : inline} -div div {width : 120px} -.start {background-color : gray; height : 500px} -.whole {background-color : red; height : 100%} -.half {background-color : rgb(250, 125, 0); height : 50%} -.quarter {background-color : yellow; height : 25%} -.eighth {background-color : green; height : 12.5%} -.sixteenth {background-color : blue; height : 6.25%} -.thirtysecond {background-color : purple; height : 3.125%} - diff --git a/src/test/html/ref/simple-reset.css b/src/test/html/ref/simple-reset.css deleted file mode 100644 index 09f51257adc..00000000000 --- a/src/test/html/ref/simple-reset.css +++ /dev/null @@ -1 +0,0 @@ -body { margin: 0px } diff --git a/src/test/html/ref/square.css b/src/test/html/ref/square.css deleted file mode 100644 index f07bbe0595d..00000000000 --- a/src/test/html/ref/square.css +++ /dev/null @@ -1,2 +0,0 @@ -body {margin : 0px} -.box {background-color : green; height : 400px; width : 400px} diff --git a/src/test/html/ref/square.html b/src/test/html/ref/square.html deleted file mode 100644 index ac9ace5a979..00000000000 --- a/src/test/html/ref/square.html +++ /dev/null @@ -1,6 +0,0 @@ -<head> - <link rel="stylesheet" href="square.css" /> -</head> -<body> - <div class="box"></div> -</body> diff --git a/src/test/html/ref/test-image.html b/src/test/html/ref/test-image.html deleted file mode 100644 index 323f00da4eb..00000000000 --- a/src/test/html/ref/test-image.html +++ /dev/null @@ -1,12 +0,0 @@ - -<!DOCTYPE html> -<html> -<head> -<title>test</title> -<link rel="stylesheet" href="simple-reset.css" /> -</head> -<body> -<img src="boxes.png" width="640" height="480"/> -</body> -</html> - diff --git a/src/test/ref/basic.list b/src/test/ref/basic.list index 661974e2996..c6713e02f90 100644 --- a/src/test/ref/basic.list +++ b/src/test/ref/basic.list @@ -35,3 +35,4 @@ == block_image.html 500x300_green.html # == simple_iframe.html simple_iframe_ref.html -- disabled due to iframe crashiness == object_element_a.html object_element_b.html +== height_compute_reset.html height_compute.html diff --git a/src/test/html/ref/height_compute.css b/src/test/ref/height_compute.html index 9e1c7fb9679..0f017463495 100644 --- a/src/test/html/ref/height_compute.css +++ b/src/test/ref/height_compute.html @@ -1,3 +1,5 @@ +<head> +<style type="text/css"> body {margin : 0px} .start {background-color : gray; height : 600px} .half {background-color : red; height : 50%} @@ -6,3 +8,15 @@ body {margin : 0px} .sixteenth {background-color : green; height : 6.25%} .thirtysecond {background-color : blue; height : 3.125%} .sixtyfourth {background-color : purple; height : 1.5625%} +</style> +</head> +<body> + <div class="start"> + <div class="half"></div> + <div class="quarter"></div> + <div class="eighth"></div> + <div class="sixteenth"></div> + <div class="thirtysecond"></div> + <div class="sixtyfourth"></div> + </div> +</body> diff --git a/src/test/html/ref/height_compute_reset.css b/src/test/ref/height_compute_reset.html index 41031e2a517..114e7ef97c2 100644 --- a/src/test/html/ref/height_compute_reset.css +++ b/src/test/ref/height_compute_reset.html @@ -1,3 +1,6 @@ +<head> +<link rel="stylesheet" href="reset.css" /> +<style type="text/css"> .start {background-color : gray; height : 600px} .half {background-color : red; height : 50%} .quarter {background-color : rgb(250, 125, 0); height : 25%} @@ -5,3 +8,15 @@ .sixteenth {background-color : green; height : 6.25%} .thirtysecond {background-color : blue; height : 3.125%} .sixtyfourth {background-color : purple; height : 1.5625%} +</style> +</head> +<body> + <div class="start"> + <div class="half"></div> + <div class="quarter"></div> + <div class="eighth"></div> + <div class="sixteenth"></div> + <div class="thirtysecond"></div> + <div class="sixtyfourth"></div> + </div> +</body> diff --git a/src/test/html/ref/reset.css b/src/test/ref/reset.css index e5156472701..e5156472701 100644 --- a/src/test/html/ref/reset.css +++ b/src/test/ref/reset.css |