From 1a950d263a631c59534eb2c97e92348321e42d63 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 4 Dec 2017 10:54:32 +0100 Subject: [PATCH 1/5] Upgrade to rustc 1.24.0-nightly (5a2465e2b 2017-12-06) --- components/dom_struct/lib.rs | 4 ++++ python/servo/testing_commands.py | 3 +++ rust-toolchain | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/dom_struct/lib.rs b/components/dom_struct/lib.rs index a955f00ce87..41cf4a67527 100644 --- a/components/dom_struct/lib.rs +++ b/components/dom_struct/lib.rs @@ -19,5 +19,9 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream { #[must_root] #[repr(C)] }; + + // Work around https://github.com/rust-lang/rust/issues/46489 + let attributes = attributes.to_string().parse().unwrap(); + iter::once(attributes).chain(iter::once(input)).collect() } diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index a72b6ef8f70..e0b9a4e7b28 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -254,6 +254,9 @@ class MachCommands(CommandBase): env = self.build_env() env["RUST_BACKTRACE"] = "1" + # Work around https://github.com/rust-lang/cargo/issues/4790 + del env["RUSTDOCFLAGS"] + if "msvc" in host_triple(): # on MSVC, we need some DLLs in the path. They were copied # in to the servo.exe build dir, so just point PATH to that. diff --git a/rust-toolchain b/rust-toolchain index 45c170f9e3f..3e5d257a285 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2017-11-14 +nightly-2017-12-07 From 05a364c7b8d5787fdd25f42a874c949ebaca1e56 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 30 Nov 2017 16:04:11 +0100 Subject: [PATCH 2/5] Move Stylo unit tests out of tests/unit This will allow writing `tests/unit/*` in the root `Cargo.toml` file to designate Servo unit tests. --- ports/geckolib/Cargo.toml | 2 +- {tests/unit/stylo => ports/geckolib/tests}/Cargo.toml | 0 {tests/unit/stylo => ports/geckolib/tests}/build.rs | 0 {tests/unit/stylo => ports/geckolib/tests}/lib.rs | 0 .../stylo => ports/geckolib/tests}/servo_function_signatures.rs | 0 {tests/unit/stylo => ports/geckolib/tests}/size_of.rs | 0 {tests/unit/stylo => ports/geckolib/tests}/specified_values.rs | 0 tests/unit/style/lib.rs | 2 +- 8 files changed, 2 insertions(+), 2 deletions(-) rename {tests/unit/stylo => ports/geckolib/tests}/Cargo.toml (100%) rename {tests/unit/stylo => ports/geckolib/tests}/build.rs (100%) rename {tests/unit/stylo => ports/geckolib/tests}/lib.rs (100%) rename {tests/unit/stylo => ports/geckolib/tests}/servo_function_signatures.rs (100%) rename {tests/unit/stylo => ports/geckolib/tests}/size_of.rs (100%) rename {tests/unit/stylo => ports/geckolib/tests}/specified_values.rs (100%) diff --git a/ports/geckolib/Cargo.toml b/ports/geckolib/Cargo.toml index 70ffc615d9b..5f370937b68 100644 --- a/ports/geckolib/Cargo.toml +++ b/ports/geckolib/Cargo.toml @@ -33,4 +33,4 @@ style = {path = "../../components/style", features = ["gecko"]} style_traits = {path = "../../components/style_traits"} [dev-dependencies] -stylo_tests = {path = "../../tests/unit/stylo"} +stylo_tests = {path = "./tests"} diff --git a/tests/unit/stylo/Cargo.toml b/ports/geckolib/tests/Cargo.toml similarity index 100% rename from tests/unit/stylo/Cargo.toml rename to ports/geckolib/tests/Cargo.toml diff --git a/tests/unit/stylo/build.rs b/ports/geckolib/tests/build.rs similarity index 100% rename from tests/unit/stylo/build.rs rename to ports/geckolib/tests/build.rs diff --git a/tests/unit/stylo/lib.rs b/ports/geckolib/tests/lib.rs similarity index 100% rename from tests/unit/stylo/lib.rs rename to ports/geckolib/tests/lib.rs diff --git a/tests/unit/stylo/servo_function_signatures.rs b/ports/geckolib/tests/servo_function_signatures.rs similarity index 100% rename from tests/unit/stylo/servo_function_signatures.rs rename to ports/geckolib/tests/servo_function_signatures.rs diff --git a/tests/unit/stylo/size_of.rs b/ports/geckolib/tests/size_of.rs similarity index 100% rename from tests/unit/stylo/size_of.rs rename to ports/geckolib/tests/size_of.rs diff --git a/tests/unit/stylo/specified_values.rs b/ports/geckolib/tests/specified_values.rs similarity index 100% rename from tests/unit/stylo/specified_values.rs rename to ports/geckolib/tests/specified_values.rs diff --git a/tests/unit/style/lib.rs b/tests/unit/style/lib.rs index 07d83afa261..9bcc92965e8 100644 --- a/tests/unit/style/lib.rs +++ b/tests/unit/style/lib.rs @@ -32,7 +32,7 @@ mod parsing; mod properties; mod rule_tree; mod size_of; -#[path = "../stylo/specified_values.rs"] +#[path = "../../../ports/geckolib/tests/specified_values.rs"] mod specified_values; mod str; mod stylesheets; From 9d898cd460712adbacddcfe45f11173605d6cf7b Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 30 Nov 2017 16:46:14 +0100 Subject: [PATCH 3/5] Include test crates as workspace members rather that dev-dependencies --- Cargo.lock | 15 --------------- Cargo.toml | 8 ++++++-- ports/geckolib/Cargo.toml | 3 --- ports/servo/Cargo.toml | 18 +----------------- tests/unit/profile/Cargo.toml | 3 --- 5 files changed, 7 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f7834fc5ff..acf8dfff8ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1050,7 +1050,6 @@ dependencies = [ "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "style 0.0.1", "style_traits 0.0.1", - "stylo_tests 0.0.1", ] [[package]] @@ -2807,24 +2806,10 @@ dependencies = [ "android_injected_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)", - "deny_public_fields_tests 0.0.1", - "gfx_tests 0.0.1", "glutin_app 0.0.1", - "layout_tests 0.0.1", "libservo 0.0.1", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "malloc_size_of_tests 0.0.1", - "metrics_tests 0.0.1", - "msg_tests 0.0.1", - "net_tests 0.0.1", - "net_traits_tests 0.0.1", - "profile_tests 0.0.1", - "script_plugins_tests 0.0.1", - "script_tests 0.0.1", - "servo_config_tests 0.0.1", - "servo_remutex_tests 0.0.1", "sig 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "style_tests 0.0.1", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 4dc921c54e6..7c32ef6cf8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,12 @@ [workspace] members = [ - "ports/cef", - "ports/geckolib", "ports/servo", + "tests/unit/*", + + "ports/geckolib", + "ports/geckolib/tests", + + "ports/cef", ] exclude = [".cargo"] diff --git a/ports/geckolib/Cargo.toml b/ports/geckolib/Cargo.toml index 5f370937b68..9fbe688571a 100644 --- a/ports/geckolib/Cargo.toml +++ b/ports/geckolib/Cargo.toml @@ -31,6 +31,3 @@ servo_arc = {path = "../../components/servo_arc"} smallvec = "0.6" style = {path = "../../components/style", features = ["gecko"]} style_traits = {path = "../../components/style_traits"} - -[dev-dependencies] -stylo_tests = {path = "./tests"} diff --git a/ports/servo/Cargo.toml b/ports/servo/Cargo.toml index 489b6f63515..e872da5fe11 100644 --- a/ports/servo/Cargo.toml +++ b/ports/servo/Cargo.toml @@ -13,22 +13,6 @@ path = "main.rs" test = false bench = false -[dev-dependencies] -deny_public_fields_tests = {path = "../../tests/unit/deny_public_fields"} -gfx_tests = {path = "../../tests/unit/gfx"} -layout_tests = {path = "../../tests/unit/layout"} -malloc_size_of_tests = {path = "../../tests/unit/malloc_size_of"} -metrics_tests = {path = "../../tests/unit/metrics"} -msg_tests = {path = "../../tests/unit/msg"} -net_tests = {path = "../../tests/unit/net"} -net_traits_tests = {path = "../../tests/unit/net_traits"} -profile_tests = {path = "../../tests/unit/profile"} -script_tests = {path = "../../tests/unit/script"} -script_plugins_tests = {path = "../../tests/unit/script_plugins"} -servo_config_tests = {path = "../../tests/unit/servo_config"} -servo_remutex_tests = {path = "../../tests/unit/servo_remutex"} -style_tests = {path = "../../tests/unit/style"} - [features] default = ["unstable", "default-except-unstable"] default-except-unstable = ["webdriver", "max_log_level"] @@ -38,7 +22,7 @@ energy-profiling = ["libservo/energy-profiling"] debugmozjs = ["libservo/debugmozjs"] googlevr = ["libservo/googlevr"] oculusvr = ["libservo/oculusvr"] -unstable = ["libservo/unstable", "profile_tests/unstable"] +unstable = ["libservo/unstable"] [dependencies] backtrace = "0.3" diff --git a/tests/unit/profile/Cargo.toml b/tests/unit/profile/Cargo.toml index 0d04fba813f..026593d80fa 100644 --- a/tests/unit/profile/Cargo.toml +++ b/tests/unit/profile/Cargo.toml @@ -9,9 +9,6 @@ name = "profile_tests" path = "lib.rs" doctest = false -[features] -unstable = ["servo_allocator/unstable"] - [dependencies] ipc-channel = "0.9" profile = {path = "../../../components/profile"} From 2a5c4133f9da508949e875ed41b60a2d041e17c7 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 30 Nov 2017 16:49:57 +0100 Subject: [PATCH 4/5] Make tests/units/* compile without warnings in non-test mode (if not usefully) --- tests/unit/gfx/lib.rs | 4 +++- tests/unit/layout/lib.rs | 5 ++--- tests/unit/metrics/lib.rs | 4 ++-- tests/unit/msg/lib.rs | 5 ++--- tests/unit/net/lib.rs | 26 ++++++++++++++------------ tests/unit/net_traits/lib.rs | 6 ++++-- tests/unit/profile/lib.rs | 3 ++- 7 files changed, 29 insertions(+), 24 deletions(-) diff --git a/tests/unit/gfx/lib.rs b/tests/unit/gfx/lib.rs index 9a5040b6fe1..a8120a50138 100644 --- a/tests/unit/gfx/lib.rs +++ b/tests/unit/gfx/lib.rs @@ -2,6 +2,8 @@ * 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(test)] + extern crate gfx; -#[cfg(test)] mod text_util; +mod text_util; diff --git a/tests/unit/layout/lib.rs b/tests/unit/layout/lib.rs index a763135260a..d9e72841199 100644 --- a/tests/unit/layout/lib.rs +++ b/tests/unit/layout/lib.rs @@ -2,7 +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/. */ -extern crate layout; -#[macro_use] extern crate size_of_test; - +#[cfg(all(test, target_pointer_width = "64"))] extern crate layout; +#[cfg(all(test, target_pointer_width = "64"))] #[macro_use] extern crate size_of_test; #[cfg(all(test, target_pointer_width = "64"))] mod size_of; diff --git a/tests/unit/metrics/lib.rs b/tests/unit/metrics/lib.rs index abd6970f848..d773a632867 100644 --- a/tests/unit/metrics/lib.rs +++ b/tests/unit/metrics/lib.rs @@ -2,6 +2,8 @@ * 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(test)] + extern crate euclid; extern crate gfx; extern crate gfx_traits; @@ -13,7 +15,5 @@ extern crate profile_traits; extern crate style; extern crate time; -#[cfg(test)] mod interactive_time; -#[cfg(test)] mod paint_time; diff --git a/tests/unit/msg/lib.rs b/tests/unit/msg/lib.rs index c1bc9a119d9..62e591ef800 100644 --- a/tests/unit/msg/lib.rs +++ b/tests/unit/msg/lib.rs @@ -2,7 +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/. */ -extern crate msg; -#[macro_use] extern crate size_of_test; - +#[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; diff --git a/tests/unit/net/lib.rs b/tests/unit/net/lib.rs index 1d34d700a60..773b7f387f8 100644 --- a/tests/unit/net/lib.rs +++ b/tests/unit/net/lib.rs @@ -2,6 +2,8 @@ * 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(test)] + extern crate cookie as cookie_rs; extern crate devtools_traits; extern crate flate2; @@ -19,18 +21,18 @@ extern crate time; extern crate unicase; extern crate url; -#[cfg(test)] mod chrome_loader; -#[cfg(test)] mod cookie; -#[cfg(test)] mod cookie_http_state; -#[cfg(test)] mod data_loader; -#[cfg(test)] mod file_loader; -#[cfg(test)] mod fetch; -#[cfg(test)] mod mime_classifier; -#[cfg(test)] mod resource_thread; -#[cfg(test)] mod hsts; -#[cfg(test)] mod http_loader; -#[cfg(test)] mod filemanager_thread; -#[cfg(test)] mod subresource_integrity; +mod chrome_loader; +mod cookie; +mod cookie_http_state; +mod data_loader; +mod fetch; +mod file_loader; +mod filemanager_thread; +mod hsts; +mod http_loader; +mod mime_classifier; +mod resource_thread; +mod subresource_integrity; use devtools_traits::DevtoolsControlMsg; use hyper::server::{Handler, Listening, Server}; diff --git a/tests/unit/net_traits/lib.rs b/tests/unit/net_traits/lib.rs index 3f722e5fc63..64135a6a2d4 100644 --- a/tests/unit/net_traits/lib.rs +++ b/tests/unit/net_traits/lib.rs @@ -2,10 +2,12 @@ * 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(test)] + extern crate net_traits; -#[cfg(test)] mod image; -#[cfg(test)] mod pub_domains; +mod image; +mod pub_domains; #[test] fn test_trim_http_whitespace() { diff --git a/tests/unit/profile/lib.rs b/tests/unit/profile/lib.rs index 110d8adedb4..2b97cd68cb3 100644 --- a/tests/unit/profile/lib.rs +++ b/tests/unit/profile/lib.rs @@ -2,10 +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(test)] + extern crate ipc_channel; extern crate profile; extern crate profile_traits; extern crate servo_allocator; -#[cfg(test)] mod time; From 1f2b66e2d77ffbe75f9d7487db0b90fa724c4692 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 30 Nov 2017 16:52:08 +0100 Subject: [PATCH 5/5] Use workspace.default-members to specify default crates for 'cargo build' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: https://github.com/rust-lang/cargo/issues/4463 `workspace.default-members` was added in https://github.com/rust-lang/cargo/pull/4743. Older Cargo versions ignore it. --- Cargo.toml | 4 ++++ python/servo/build_commands.py | 6 ++---- python/servo/devenv_commands.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7c32ef6cf8e..3bde2968df8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,10 @@ members = [ "ports/cef", ] +default-members = [ + "ports/servo", + "tests/unit/*", +] exclude = [".cargo"] [profile.dev] diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 2ec27f00364..ea6ddca8725 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -402,8 +402,7 @@ class MachCommands(CommandBase): self.ensure_clobbered() ret = None - opts = [] - opts += ["--manifest-path", self.cef_manifest()] + opts = ["-p", "embedding"] if jobs is not None: opts += ["-j", jobs] @@ -458,8 +457,7 @@ class MachCommands(CommandBase): env = self.build_env(is_build=True, geckolib=True) ret = None - opts = [] - opts += ["--manifest-path", self.geckolib_manifest()] + opts = ["-p", "geckoservo"] features = [] if jobs is not None: diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index e6cb91bd20a..1ddba4af445 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -94,7 +94,7 @@ class MachCommands(CommandBase): 'params', default=None, nargs='...', help="Command-line arguments to be passed through to cargo check") def check_geckolib(self, params): - return self.run_cargo(params, check=True, geckolib=True) + return self.run_cargo(["-p", "geckoservo"] + (params or []), check=True, geckolib=True) @Command('cargo-update', description='Same as update-cargo',