Auto merge of #17974 - froydnj:remove-testing-feature, r=SimonSapin

remove testing feature from stylo_tests

`stylo_tests` currently requires a separate version of the `style` crate, compiled with the `testing` feature, so a function testing the size of specified values can be accessed.  With a few tweaks, we can make the information needed for the test available to the `stylo_tests` crate directly, eliminating the need for a separately-compiled `style` crate.

This doesn't matter much for Servo itself (it might make CI times slightly faster?), but Gecko automation/development would like to run `stylo_tests`, and not having to compile two versions of the `style` crate (or have a dead, test-only function hanging around in the `style` crate) would be a win.

---

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

<!-- 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/17974)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-05 09:58:26 -05:00 committed by GitHub
commit a6369149dc
9 changed files with 56 additions and 56 deletions

View file

@ -171,7 +171,7 @@ pub mod gecko_properties {
}
macro_rules! reexport_computed_values {
( $( $name: ident )+ ) => {
( $( { $name: ident, $boxed: expr } )+ ) => {
/// Types for [computed values][computed].
///
/// [computed]: https://drafts.csswg.org/css-cascade/#computed

View file

@ -3442,49 +3442,13 @@ macro_rules! css_properties_accessors {
}
}
#[macro_export]
macro_rules! longhand_properties_idents {
($macro_name: ident) => {
$macro_name! {
% for property in data.longhands:
${property.ident}
{ ${property.ident}, ${"true" if property.boxed else "false"} }
% endfor
}
}
}
/// Testing function to check the size of all SpecifiedValues.
#[cfg(feature = "testing")]
pub fn test_size_of_specified_values() {
use std::mem::size_of;
let threshold = 24;
let mut longhands = vec![];
% for property in data.longhands:
longhands.push(("${property.name}",
size_of::<longhands::${property.ident}::SpecifiedValue>(),
${"true" if property.boxed else "false"}));
% endfor
let mut failing_messages = vec![];
for specified_value in longhands {
if specified_value.1 > threshold && !specified_value.2 {
failing_messages.push(
format!("Your changes have increased the size of {} SpecifiedValue to {}. The threshold is \
currently {}. SpecifiedValues affect size of PropertyDeclaration enum and \
increasing the size may negative affect style system performance. Please consider \
using `boxed=\"True\"` in this longhand.",
specified_value.0, specified_value.1, threshold));
} else if specified_value.1 <= threshold && specified_value.2 {
failing_messages.push(
format!("Your changes have decreased the size of {} SpecifiedValue to {}. Good work! \
The threshold is currently {}. Please consider removing `boxed=\"True\"` from this longhand.",
specified_value.0, specified_value.1, threshold));
}
}
if !failing_messages.is_empty() {
panic!("{}", failing_messages.join("\n\n"));
}
}