Auto merge of #16935 - servo:out-of-crate-bindings-tests, r=emilio

Move bindings tests out of the style crate

This cuts in almost half the time to run:

```
touch components/style/lib.rs
./mach test-stylo
```

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16935)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-19 03:48:14 -05:00 committed by GitHub
commit a01ab9ad34
13 changed files with 37 additions and 41 deletions

View file

@ -24,6 +24,7 @@ rustc-serialize = "0.3"
selectors = {path = "../../../components/selectors"}
servo_atoms = {path = "../../../components/atoms"}
servo_config = {path = "../../../components/config"}
servo_url = {path = "../../../components/url"}
size_of_test = {path = "../../../components/size_of_test"}
style = {path = "../../../components/style"}
style_traits = {path = "../../../components/style_traits"}
servo_url = {path = "../../../components/url"}

View file

@ -17,6 +17,7 @@ extern crate selectors;
extern crate servo_atoms;
extern crate servo_config;
extern crate servo_url;
#[macro_use] extern crate size_of_test;
extern crate style;
extern crate style_traits;
extern crate test;

View file

@ -2,10 +2,9 @@
* 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/. */
#[test]
fn size_of_property_declaration() {
::style::properties::test_size_of_property_declaration();
}
use style::properties;
size_of_test!(test_size_of_property_declaration, properties::PropertyDeclaration, 32);
#[test]
fn size_of_specified_values() {

View file

@ -19,9 +19,10 @@ atomic_refcell = "0.1"
cssparser = "0.13.3"
env_logger = "0.4"
euclid = "0.11"
geckoservo = {path = "../../../ports/geckolib"}
libc = "0.2"
log = {version = "0.3.5", features = ["release_max_level_info"]}
selectors = {path = "../../../components/selectors", features = ["gecko_like_types"]}
size_of_test = {path = "../../../components/size_of_test"}
style_traits = {path = "../../../components/style_traits"}
geckoservo = {path = "../../../ports/geckolib"}
style = {path = "../../../components/style", features = ["gecko"]}

View file

@ -2,6 +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/. */
use std::env;
use std::fs;
use std::io::Write;
use std::path;
use std::process::Command;
fn main() {
@ -11,4 +15,13 @@ fn main() {
println!("cargo:rerun-if-changed=../../../components/style/gecko_bindings/bindings.rs");
assert!(Command::new("python").arg("./check_bindings.py")
.spawn().unwrap().wait().unwrap().success());
// https://github.com/rust-lang/cargo/issues/3544
let style_out_dir = env::var_os("DEP_FOR SOME REASON THE LINKS KEY IS REQUIRED \
TO PASS DATA AROUND BETWEEN BUILD SCRIPTS_OUT_DIR").unwrap();
fs::File::create(path::PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("bindings.rs"))
.unwrap()
.write_all(format!("include!(concat!({:?}, \"/gecko/structs_debug.rs\"));",
style_out_dir).as_bytes())
.unwrap();
}

View file

@ -8,6 +8,7 @@ extern crate env_logger;
extern crate geckoservo;
#[macro_use] extern crate log;
extern crate selectors;
#[macro_use] extern crate size_of_test;
#[macro_use] extern crate style;
extern crate style_traits;
@ -16,3 +17,9 @@ mod size_of;
mod servo_function_signatures;
use style::*;
#[allow(dead_code, improper_ctypes)]
mod bindings {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}

View file

@ -19,10 +19,7 @@ fn size_of_selectors_dummy_types() {
assert_eq!(align_of::<dummies::Atom>(), align_of::<style::Atom>());
}
#[test]
fn size_of_property_declaration() {
::style::properties::test_size_of_property_declaration();
}
size_of_test!(test_size_of_property_declaration, style::properties::PropertyDeclaration, 32);
#[test]
fn size_of_specified_values() {