diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-10-01 11:29:27 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-10-01 11:29:27 -0600 |
commit | 9488013b59e54f9a39cc89362ee6b84f89cc8ed0 (patch) | |
tree | 5cd11fe9b150c96c66c2674b064bb001e9f2a459 /tests | |
parent | fd66620602474e2070dc6fd6429e64cc6145b01c (diff) | |
parent | ab68d51eda8979441400688f26ceffddf25120c8 (diff) | |
download | servo-9488013b59e54f9a39cc89362ee6b84f89cc8ed0.tar.gz servo-9488013b59e54f9a39cc89362ee6b84f89cc8ed0.zip |
Auto merge of #7815 - mbrubeck:test-ref-include, r=SimonSapin
Fixes for reftest command-line handling
r? @SimonSapin
* Allow reftest harness to take 0 or more testname arguments.
* Change `mach test-ref` parameter from `--name` to `--include`. This is consistent with other test suites, and also fixes a bug in `mach test` caused by a conflicting keyword parameter in `Registrar.dispatch`.
* Allow `mach test-ref` to take any number of `include` arguments.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7815)
<!-- Reviewable:end -->
Diffstat (limited to 'tests')
-rw-r--r-- | tests/reftest.rs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/reftest.rs b/tests/reftest.rs index b055f09580d..b3df1abb08c 100644 --- a/tests/reftest.rs +++ b/tests/reftest.rs @@ -48,11 +48,10 @@ fn main() { let harness_args = parts.next().unwrap(); // .split() is never empty let servo_args = parts.next().unwrap_or(&[]); - let (render_mode_string, base_path, testname) = match harness_args { - [] | [_] => panic!("USAGE: cpu|gpu base_path [testname regex]"), - [ref render_mode_string, ref base_path] => (render_mode_string, base_path, None), - [ref render_mode_string, ref base_path, ref testname, ..] => - (render_mode_string, base_path, Some(testname.clone())), + let (render_mode_string, base_path, testnames) = match harness_args { + [ref render_mode_string, ref base_path, testnames..] => + (render_mode_string, base_path, testnames), + _ => panic!("USAGE: cpu|gpu base_path [testname ...]"), }; let mut render_mode = match &**render_mode_string { @@ -79,7 +78,8 @@ fn main() { match maybe_extension { Some(extension) => { if extension == OsStr::new("list") && file.is_file() { - let mut tests = parse_lists(&file, servo_args, render_mode, all_tests.len()); + let len = all_tests.len(); + let mut tests = parse_lists(&file, testnames, servo_args, render_mode, len); println!("\t{} [{} tests]", file.display(), tests.len()); all_tests.append(&mut tests); } @@ -89,7 +89,7 @@ fn main() { } let test_opts = TestOpts { - filter: testname, + filter: None, run_ignored: false, logfile: None, run_tests: true, @@ -165,7 +165,12 @@ struct TestLine<'a> { file_right: &'a str, } -fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_offset: usize) -> Vec<TestDescAndFn> { +fn parse_lists(file: &Path, + filters: &[String], + servo_args: &[String], + render_mode: RenderMode, + id_offset: usize) + -> Vec<TestDescAndFn> { let mut tests = Vec::new(); let contents = { let mut f = File::open(file).unwrap(); @@ -254,7 +259,9 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o pixel_ratio: pixel_ratio, }; - tests.push(make_test(reftest)); + if filters.is_empty() || filters.iter().any(|pattern| reftest.name.contains(pattern)) { + tests.push(make_test(reftest)); + } } tests } |