mirror of
https://github.com/servo/servo.git
synced 2025-07-30 18:50:36 +01:00
Run style unit tests in testing mode, disable some properties in testing mode
This commit is contained in:
parent
28bce69d24
commit
e1e512f86b
6 changed files with 39 additions and 18 deletions
|
@ -24,6 +24,7 @@ default = ["webdriver", "max_log_level"]
|
||||||
max_log_level = ["log/release_max_level_info"]
|
max_log_level = ["log/release_max_level_info"]
|
||||||
webdriver = ["webdriver_server"]
|
webdriver = ["webdriver_server"]
|
||||||
energy-profiling = ["profile_traits/energy-profiling"]
|
energy-profiling = ["profile_traits/energy-profiling"]
|
||||||
|
testing = ["style/testing"]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
|
@ -185,9 +185,9 @@ class PropertiesData(object):
|
||||||
def active_style_structs(self):
|
def active_style_structs(self):
|
||||||
return [s for s in self.style_structs if s.additional_methods or s.longhands]
|
return [s for s in self.style_structs if s.additional_methods or s.longhands]
|
||||||
|
|
||||||
def declare_longhand(self, name, products="gecko servo", **kwargs):
|
def declare_longhand(self, name, products="gecko servo", disable_when_testing=False, **kwargs):
|
||||||
products = products.split()
|
products = products.split()
|
||||||
if self.product not in products and not self.testing:
|
if self.product not in products and not (self.testing and not disable_when_testing):
|
||||||
return
|
return
|
||||||
|
|
||||||
longhand = Longhand(self.current_style_struct, name, **kwargs)
|
longhand = Longhand(self.current_style_struct, name, **kwargs)
|
||||||
|
@ -200,9 +200,10 @@ class PropertiesData(object):
|
||||||
|
|
||||||
return longhand
|
return longhand
|
||||||
|
|
||||||
def declare_shorthand(self, name, sub_properties, products="gecko servo", *args, **kwargs):
|
def declare_shorthand(self, name, sub_properties, products="gecko servo",
|
||||||
|
disable_when_testing=False, *args, **kwargs):
|
||||||
products = products.split()
|
products = products.split()
|
||||||
if self.product not in products and not self.testing:
|
if self.product not in products and not (self.testing and not disable_when_testing):
|
||||||
return
|
return
|
||||||
|
|
||||||
sub_properties = [self.longhands_by_name[s] for s in sub_properties]
|
sub_properties = [self.longhands_by_name[s] for s in sub_properties]
|
||||||
|
|
|
@ -920,7 +920,7 @@ ${helpers.single_keyword("-moz-appearance",
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
||||||
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding
|
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding
|
||||||
<%helpers:longhand name="-moz-binding" products="gecko" animatable="False">
|
<%helpers:longhand name="-moz-binding" products="gecko" animatable="False" disable_when_testing="True">
|
||||||
use cssparser::{CssStringWriter, ToCss};
|
use cssparser::{CssStringWriter, ToCss};
|
||||||
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
|
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
|
|
|
@ -21,7 +21,8 @@ ${helpers.single_keyword("unicode-bidi",
|
||||||
// FIXME: This prop should be animatable.
|
// FIXME: This prop should be animatable.
|
||||||
<%helpers:longhand name="${'text-decoration' if product == 'servo' else 'text-decoration-line'}"
|
<%helpers:longhand name="${'text-decoration' if product == 'servo' else 'text-decoration-line'}"
|
||||||
custom_cascade="${product == 'servo'}"
|
custom_cascade="${product == 'servo'}"
|
||||||
animatable="False">
|
animatable="False"
|
||||||
|
disable_when_testing="True">
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
sub_properties="text-decoration-color
|
sub_properties="text-decoration-color
|
||||||
text-decoration-line
|
text-decoration-line
|
||||||
text-decoration-style"
|
text-decoration-style"
|
||||||
products="gecko">
|
products="gecko"
|
||||||
|
disable_when_testing="True">
|
||||||
use cssparser::Color as CSSParserColor;
|
use cssparser::Color as CSSParserColor;
|
||||||
use properties::longhands::{text_decoration_color, text_decoration_line, text_decoration_style};
|
use properties::longhands::{text_decoration_color, text_decoration_line, text_decoration_style};
|
||||||
use values::specified::CSSColor;
|
use values::specified::CSSColor;
|
||||||
|
|
|
@ -210,14 +210,11 @@ class MachCommands(CommandBase):
|
||||||
|
|
||||||
packages.discard('stylo')
|
packages.discard('stylo')
|
||||||
|
|
||||||
args = ["cargo", "test"]
|
has_style = True
|
||||||
for crate in packages:
|
try:
|
||||||
args += ["-p", "%s_tests" % crate]
|
packages.remove('style')
|
||||||
args += test_patterns
|
except KeyError:
|
||||||
|
has_style = False
|
||||||
features = self.servo_features()
|
|
||||||
if features:
|
|
||||||
args += ["--features", "%s" % ' '.join(features)]
|
|
||||||
|
|
||||||
env = self.build_env()
|
env = self.build_env()
|
||||||
env["RUST_BACKTRACE"] = "1"
|
env["RUST_BACKTRACE"] = "1"
|
||||||
|
@ -230,9 +227,29 @@ class MachCommands(CommandBase):
|
||||||
else:
|
else:
|
||||||
env["RUSTFLAGS"] = "-C link-args=-Wl,--subsystem,windows"
|
env["RUSTFLAGS"] = "-C link-args=-Wl,--subsystem,windows"
|
||||||
|
|
||||||
result = call(args, env=env, cwd=self.servo_crate())
|
features = self.servo_features()
|
||||||
if result != 0:
|
if len(packages) > 0:
|
||||||
return result
|
args = ["cargo", "test"]
|
||||||
|
for crate in packages:
|
||||||
|
args += ["-p", "%s_tests" % crate]
|
||||||
|
args += test_patterns
|
||||||
|
|
||||||
|
if features:
|
||||||
|
args += ["--features", "%s" % ' '.join(features)]
|
||||||
|
result = call(args, env=env, cwd=self.servo_crate())
|
||||||
|
if result != 0:
|
||||||
|
return result
|
||||||
|
|
||||||
|
# Run style tests with the testing feature
|
||||||
|
if has_style:
|
||||||
|
args = ["cargo", "test", "-p", "style_tests", "--features"]
|
||||||
|
if features:
|
||||||
|
args += ["%s" % ' '.join(features + ["testing"])]
|
||||||
|
else:
|
||||||
|
args += ["testing"]
|
||||||
|
result = call(args, env=env, cwd=self.servo_crate())
|
||||||
|
if result != 0:
|
||||||
|
return result
|
||||||
|
|
||||||
@Command('test-stylo',
|
@Command('test-stylo',
|
||||||
description='Run stylo unit tests',
|
description='Run stylo unit tests',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue