зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #5776 - Split the unit tests crate (from servo:split-unit-tests); r=mbrubeck
Closes #5707. (Includes a rebase of it.) Fixes #5688. r? @mbrubeck Source-Repo: https://github.com/servo/servo Source-Revision: f795440ee3be976d9819b011d4add7ceee3ade1e --HG-- rename : servo/tests/unit/gfx/mod.rs => servo/tests/unit/gfx/lib.rs
This commit is contained in:
Родитель
2b41fd7ef3
Коммит
d117879670
|
@ -8,18 +8,22 @@ dependencies = [
|
|||
"devtools 0.0.1",
|
||||
"devtools_traits 0.0.1",
|
||||
"gfx 0.0.1",
|
||||
"gfx_tests 0.0.1",
|
||||
"glutin_app 0.0.1",
|
||||
"layout 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"net_tests 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png)",
|
||||
"profile 0.0.1",
|
||||
"script 0.0.1",
|
||||
"script_tests 0.0.1",
|
||||
"style_tests 0.0.1",
|
||||
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unit_tests 0.0.1",
|
||||
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"util_tests 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -346,6 +350,13 @@ dependencies = [
|
|||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"gfx 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gl_common"
|
||||
version = "0.0.4"
|
||||
|
@ -661,6 +672,19 @@ dependencies = [
|
|||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "net_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"profile 0.0.1",
|
||||
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "net_traits"
|
||||
version = "0.0.1"
|
||||
|
@ -824,6 +848,13 @@ dependencies = [
|
|||
"uuid 0.1.11 (git+https://github.com/rust-lang/uuid)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "script_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"script 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "script_traits"
|
||||
version = "0.0.1"
|
||||
|
@ -905,6 +936,20 @@ dependencies = [
|
|||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "style_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)",
|
||||
"string_cache 0.0.0 (git+https://github.com/servo/string-cache)",
|
||||
"string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)",
|
||||
"style 0.0.1",
|
||||
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "task_info"
|
||||
version = "0.0.1"
|
||||
|
@ -928,27 +973,6 @@ name = "unicase"
|
|||
version = "0.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unit_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cookie 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||
"gfx 0.0.1",
|
||||
"hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"profile 0.0.1",
|
||||
"script 0.0.1",
|
||||
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)",
|
||||
"string_cache 0.0.0 (git+https://github.com/servo/string-cache)",
|
||||
"string_cache_plugin 0.0.0 (git+https://github.com/servo/string-cache)",
|
||||
"style 0.0.1",
|
||||
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.2.23"
|
||||
|
@ -987,6 +1011,14 @@ dependencies = [
|
|||
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "util_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.1.11"
|
||||
|
|
|
@ -16,8 +16,20 @@ test = false
|
|||
doc = false
|
||||
bench = false
|
||||
|
||||
[dev-dependencies.unit_tests]
|
||||
path = "../../tests/unit"
|
||||
[dev-dependencies.gfx_tests]
|
||||
path = "../../tests/unit/gfx"
|
||||
|
||||
[dev-dependencies.net_tests]
|
||||
path = "../../tests/unit/net"
|
||||
|
||||
[dev-dependencies.script_tests]
|
||||
path = "../../tests/unit/script"
|
||||
|
||||
[dev-dependencies.style_tests]
|
||||
path = "../../tests/unit/style"
|
||||
|
||||
[dev-dependencies.util_tests]
|
||||
path = "../../tests/unit/util"
|
||||
|
||||
[[test]]
|
||||
name = "reftest"
|
||||
|
|
|
@ -101,17 +101,26 @@ class MachCommands(CommandBase):
|
|||
@Command('test-unit',
|
||||
description='Run unit tests',
|
||||
category='testing')
|
||||
@CommandArgument('--package', '-p', default=None, help="Specific package to test")
|
||||
@CommandArgument('test_name', nargs=argparse.REMAINDER,
|
||||
help="Only run tests that match this pattern")
|
||||
def test_unit(self, test_name=None, component=None, package=None):
|
||||
def test_unit(self, test_name=None, package=None):
|
||||
if test_name is None:
|
||||
test_name = []
|
||||
|
||||
self.ensure_bootstrapped()
|
||||
|
||||
return 0 != subprocess.call(
|
||||
["cargo", "test", "-p", "unit_tests"]
|
||||
+ test_name, env=self.build_env(), cwd=self.servo_crate())
|
||||
if package:
|
||||
packages = [package]
|
||||
else:
|
||||
packages = os.listdir(path.join(self.context.topdir, "tests", "unit"))
|
||||
|
||||
for crate in packages:
|
||||
result = subprocess.call(
|
||||
["cargo", "test", "-p", "%s_tests" % crate] + test_name,
|
||||
env=self.build_env(), cwd=self.servo_crate())
|
||||
if result != 0:
|
||||
return result
|
||||
|
||||
@Command('test-ref',
|
||||
description='Run the reference tests',
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "gfx_tests"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "gfx_tests"
|
||||
path = "lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies.gfx]
|
||||
path = "../../../components/gfx"
|
|
@ -2,4 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
mod text_util;
|
||||
extern crate gfx;
|
||||
|
||||
#[cfg(test)] mod text_util;
|
|
@ -0,0 +1,26 @@
|
|||
[package]
|
||||
name = "net_tests"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "net_tests"
|
||||
path = "lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies.net]
|
||||
path = "../../../components/net"
|
||||
|
||||
[dependencies.net_traits]
|
||||
path = "../../../components/net_traits"
|
||||
|
||||
[dependencies.profile]
|
||||
path = "../../../components/profile"
|
||||
|
||||
[dependencies.util]
|
||||
path = "../../../components/util"
|
||||
|
||||
[dependencies]
|
||||
cookie = "*"
|
||||
hyper = "*"
|
||||
url = "*"
|
|
@ -0,0 +1,17 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![cfg_attr(test, feature(net, alloc, path, io))]
|
||||
|
||||
extern crate net;
|
||||
extern crate net_traits;
|
||||
extern crate profile;
|
||||
extern crate url;
|
||||
extern crate util;
|
||||
|
||||
#[cfg(test)] mod cookie;
|
||||
#[cfg(test)] mod data_loader;
|
||||
#[cfg(test)] mod image_cache_task;
|
||||
#[cfg(test)] mod mime_classifier;
|
||||
#[cfg(test)] mod resource_task;
|
|
@ -23,7 +23,7 @@ fn read_file(path: &path::Path) -> io::Result<Vec<u8>> {
|
|||
fn test_sniff_mp4_matcher() {
|
||||
let matcher = Mp4Matcher;
|
||||
|
||||
let p = PathBuf::new("../../tests/unit/net/parsable_mime/video/mp4/test.mp4");
|
||||
let p = PathBuf::new("parsable_mime/video/mp4/test.mp4");
|
||||
let read_result = read_file(&p);
|
||||
|
||||
match read_result {
|
||||
|
@ -43,7 +43,7 @@ fn test_sniff_full(filename_orig: &path::Path,type_string: &str,subtype_string:
|
|||
let current_working_directory = env::current_dir().unwrap();
|
||||
println!("The current directory is {}", current_working_directory.display());
|
||||
|
||||
let mut filename = PathBuf::new("../../tests/unit/net/parsable_mime/");
|
||||
let mut filename = PathBuf::new("parsable_mime/");
|
||||
filename.push(filename_orig);
|
||||
|
||||
let classifier = MIMEClassifier::new();
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
mod cookie;
|
||||
mod data_loader;
|
||||
mod image_cache_task;
|
||||
mod mime_classifier;
|
||||
mod resource_task;
|
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "script_tests"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "script_tests"
|
||||
path = "lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies.script]
|
||||
path = "../../../components/script"
|
|
@ -2,5 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#[cfg(target_pointer_width = "64")] mod size_of;
|
||||
mod textinput;
|
||||
extern crate script;
|
||||
|
||||
#[cfg(all(test, target_pointer_width = "64"))] mod size_of;
|
||||
#[cfg(test)] mod textinput;
|
|
@ -1,50 +1,33 @@
|
|||
[package]
|
||||
name = "unit_tests"
|
||||
name = "style_tests"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "unit_tests"
|
||||
name = "style_tests"
|
||||
path = "lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies.util]
|
||||
path = "../../components/util"
|
||||
|
||||
[dependencies.gfx]
|
||||
path = "../../components/gfx"
|
||||
|
||||
[dependencies.net]
|
||||
path = "../../components/net"
|
||||
|
||||
[dependencies.net_traits]
|
||||
path = "../../components/net_traits"
|
||||
|
||||
[dependencies.profile]
|
||||
path = "../../components/profile"
|
||||
|
||||
[dependencies.style]
|
||||
path = "../../components/style"
|
||||
path = "../../../components/style"
|
||||
|
||||
[dependencies.script]
|
||||
path = "../../components/script"
|
||||
|
||||
[dependencies.geom]
|
||||
git = "https://github.com/servo/rust-geom"
|
||||
|
||||
[dependencies.cssparser]
|
||||
git = "https://github.com/servo/rust-cssparser"
|
||||
|
||||
[dependencies.selectors]
|
||||
git = "https://github.com/servo/rust-selectors"
|
||||
|
||||
[dependencies.string_cache]
|
||||
git = "https://github.com/servo/string-cache"
|
||||
[dependencies.util]
|
||||
path = "../../../components/util"
|
||||
|
||||
[dependencies.string_cache_plugin]
|
||||
git = "https://github.com/servo/string-cache"
|
||||
|
||||
[dependencies.string_cache]
|
||||
git = "https://github.com/servo/string-cache"
|
||||
|
||||
[dependencies.geom]
|
||||
git = "https://github.com/servo/rust-geom"
|
||||
|
||||
[dependencies.selectors]
|
||||
git = "https://github.com/servo/rust-selectors"
|
||||
|
||||
[dependencies.cssparser]
|
||||
git = "https://github.com/servo/rust-cssparser"
|
||||
|
||||
[dependencies]
|
||||
cookie = "*"
|
||||
url = "*"
|
||||
hyper = "0.3"
|
|
@ -3,25 +3,26 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(plugin)]
|
||||
#![cfg_attr(test, feature(net, alloc, path, io))]
|
||||
|
||||
#![plugin(string_cache_plugin)]
|
||||
|
||||
extern crate cssparser;
|
||||
extern crate geom;
|
||||
extern crate gfx;
|
||||
extern crate net;
|
||||
extern crate net_traits;
|
||||
extern crate profile;
|
||||
extern crate script;
|
||||
extern crate selectors;
|
||||
extern crate string_cache;
|
||||
extern crate style;
|
||||
extern crate util;
|
||||
extern crate url;
|
||||
extern crate util;
|
||||
|
||||
#[cfg(test)] #[path="gfx/mod.rs"] mod gfx_tests;
|
||||
#[cfg(test)] #[path="net/mod.rs"] mod net_tests;
|
||||
#[cfg(test)] #[path="script/mod.rs"] mod script_tests;
|
||||
#[cfg(test)] #[path="style/mod.rs"] mod style_tests;
|
||||
#[cfg(test)] #[path="util/mod.rs"] mod util_tests;
|
||||
|
||||
#[cfg(test)] mod stylesheets;
|
||||
#[cfg(test)] mod media_queries;
|
||||
|
||||
#[cfg(test)] mod writing_modes {
|
||||
use util::logical_geometry::WritingMode;
|
||||
use style::properties::{INITIAL_VALUES, get_writing_mode};
|
||||
|
||||
#[test]
|
||||
fn initial_writing_mode_is_empty() {
|
||||
assert_eq!(get_writing_mode(INITIAL_VALUES.get_inheritedbox()), WritingMode::empty())
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use util::logical_geometry::WritingMode;
|
||||
use style::properties::{INITIAL_VALUES, get_writing_mode};
|
||||
|
||||
|
||||
mod stylesheets;
|
||||
mod media_queries;
|
||||
|
||||
|
||||
#[test]
|
||||
fn initial_writing_mode_is_empty() {
|
||||
assert_eq!(get_writing_mode(INITIAL_VALUES.get_inheritedbox()), WritingMode::empty())
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
name = "util_tests"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "util_tests"
|
||||
path = "lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies.util]
|
||||
path = "../../../components/util"
|
||||
|
||||
[dependencies.geom]
|
||||
git = "https://github.com/servo/rust-geom"
|
|
@ -2,7 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
mod cache;
|
||||
mod logical_geometry;
|
||||
mod task;
|
||||
mod vec;
|
||||
extern crate util;
|
||||
extern crate geom;
|
||||
|
||||
#[cfg(test)] mod cache;
|
||||
#[cfg(test)] mod logical_geometry;
|
||||
#[cfg(test)] mod task;
|
||||
#[cfg(test)] mod vec;
|
Загрузка…
Ссылка в новой задаче