From a17a1fd06e25578f503c5d15ce662d1bf0d142f2 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Fri, 19 Jan 2018 11:34:22 +0100 Subject: [PATCH] Merge msg and msg_tests --- Cargo.lock | 9 +----- components/msg/Cargo.toml | 5 ++++ .../msg => components/msg/tests}/size_of.rs | 5 ++++ python/servo/testing_commands.py | 29 +++++++------------ tests/unit/msg/Cargo.toml | 14 --------- tests/unit/msg/lib.rs | 7 ----- 6 files changed, 21 insertions(+), 48 deletions(-) rename {tests/unit/msg => components/msg/tests}/size_of.rs (89%) delete mode 100644 tests/unit/msg/Cargo.toml delete mode 100644 tests/unit/msg/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 109bda5891c..cdd4c1f1f46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1916,15 +1916,8 @@ dependencies = [ "malloc_size_of_derive 0.0.1", "nonzero 0.0.1", "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.56.1 (git+https://github.com/servo/webrender)", -] - -[[package]] -name = "msg_tests" -version = "0.0.1" -dependencies = [ - "msg 0.0.1", "size_of_test 0.0.1", + "webrender_api 0.56.1 (git+https://github.com/servo/webrender)", ] [[package]] diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index a13fa591db6..2d275b7f027 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -8,6 +8,8 @@ publish = false [lib] name = "msg" path = "lib.rs" +test = false +doctest = false [features] unstable = ["nonzero/unstable"] @@ -19,3 +21,6 @@ malloc_size_of_derive = { path = "../malloc_size_of_derive" } nonzero = {path = "../nonzero"} serde = "1.0.14" webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} + +[dev-dependencies] +size_of_test = {path = "../size_of_test"} diff --git a/tests/unit/msg/size_of.rs b/components/msg/tests/size_of.rs similarity index 89% rename from tests/unit/msg/size_of.rs rename to components/msg/tests/size_of.rs index 124238f9457..54e5294c7d5 100644 --- a/tests/unit/msg/size_of.rs +++ b/components/msg/tests/size_of.rs @@ -2,6 +2,11 @@ * 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")] + +extern crate msg; +#[macro_use] extern crate size_of_test; + use msg::constellation_msg::BrowsingContextId; use msg::constellation_msg::PipelineId; use msg::constellation_msg::TopLevelBrowsingContextId; diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 03d567786f6..dfe78c0f36b 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -231,27 +231,18 @@ class MachCommands(CommandBase): else: test_patterns.append(test) - in_crate_packages = [] - - # Since the selectors tests have no corresponding selectors_tests crate in tests/unit, - # we need to treat them separately from those that do. - try: - packages.remove('selectors') - in_crate_packages += ["selectors"] - except KeyError: - pass - + self_contained_tests = ["msg", "selectors"] if not packages: packages = set(os.listdir(path.join(self.context.topdir, "tests", "unit"))) - set(['.DS_Store']) - in_crate_packages += ["selectors"] + packages |= set(self_contained_tests) - # Since the selectors tests have no corresponding selectors_tests crate in tests/unit, - # we need to treat them separately from those that do. - try: - packages.remove('selectors') - in_crate_packages += ["selectors"] - except KeyError: - pass + in_crate_packages = [] + for crate in self_contained_tests: + try: + packages.remove(crate) + in_crate_packages += [crate] + except KeyError: + pass packages.discard('stylo') @@ -264,7 +255,7 @@ class MachCommands(CommandBase): env["PATH"] = "%s%s%s" % (path.dirname(self.get_binary_path(False, False)), os.pathsep, env["PATH"]) features = self.servo_features() - if len(packages) > 0: + if len(packages) > 0 or len(in_crate_packages) > 0: args = ["cargo", "bench" if bench else "test", "--manifest-path", self.servo_manifest()] for crate in packages: args += ["-p", "%s_tests" % crate] diff --git a/tests/unit/msg/Cargo.toml b/tests/unit/msg/Cargo.toml deleted file mode 100644 index 89ee91d22c0..00000000000 --- a/tests/unit/msg/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "msg_tests" -version = "0.0.1" -authors = ["The Servo Project Developers"] -license = "MPL-2.0" - -[lib] -name = "msg_tests" -path = "lib.rs" -doctest = false - -[dependencies] -msg = {path = "../../../components/msg"} -size_of_test = {path = "../../../components/size_of_test"} diff --git a/tests/unit/msg/lib.rs b/tests/unit/msg/lib.rs deleted file mode 100644 index 62e591ef800..00000000000 --- a/tests/unit/msg/lib.rs +++ /dev/null @@ -1,7 +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/. */ - -#[cfg(all(test, target_pointer_width = "64"))] extern crate msg; -#[cfg(all(test, target_pointer_width = "64"))] #[macro_use] extern crate size_of_test; -#[cfg(all(test, target_pointer_width = "64"))] mod size_of;