Auto merge of #23676 - servo:check, r=Manishearth

Share more `./mach build` logic with mach check, doc, test-unit

Fixes #23659

<!-- 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/23676)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-02 23:55:44 -04:00 committed by GitHub
commit 50033878a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 268 additions and 302 deletions

View file

@ -11,10 +11,10 @@ name = "canvas"
path = "lib.rs" path = "lib.rs"
[features] [features]
azure_backend = ["azure"] canvas2d-azure = ["azure"]
default = ["azure_backend"] canvas2d-raqote = ["raqote"]
default = ["canvas2d-azure"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"] webgl_backtrace = ["canvas_traits/webgl_backtrace"]
raqote_backend = ["raqote"]
no_wgl = ["offscreen_gl_context/no_wgl"] no_wgl = ["offscreen_gl_context/no_wgl"]
[dependencies] [dependencies]

View file

@ -0,0 +1,20 @@
/* 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 https://mozilla.org/MPL/2.0/. */
fn main() {
let azure = std::env::var_os("CARGO_FEATURE_CANVAS2D_AZURE").is_some();
let raqote = std::env::var_os("CARGO_FEATURE_CANVAS2D_RAQOTE").is_some();
if !(azure || raqote) {
error("Must enable one of the `canvas2d-azure` or `canvas2d-raqote` features.")
}
if azure && raqote {
error("Must not enable both of the `canvas2d-azure` and `canvas2d-raqote` features.")
}
}
fn error(message: &str) {
print!("\n\n Error: {}\n\n", message);
std::process::exit(1)
}

View file

@ -281,92 +281,92 @@ pub trait GenericDrawTarget {
#[derive(Clone)] #[derive(Clone)]
pub enum ExtendMode { pub enum ExtendMode {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::ExtendMode), Azure(azure::azure_hl::ExtendMode),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
pub enum GradientStop { pub enum GradientStop {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::AzGradientStop), Azure(azure::AzGradientStop),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
pub enum GradientStops { pub enum GradientStops {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::GradientStops), Azure(azure::azure_hl::GradientStops),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
#[derive(Clone)] #[derive(Clone)]
pub enum Color { pub enum Color {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::Color), Azure(azure::azure_hl::Color),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
#[derive(Clone)] #[derive(Clone)]
pub enum CompositionOp { pub enum CompositionOp {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::CompositionOp), Azure(azure::azure_hl::CompositionOp),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
pub enum SurfaceFormat { pub enum SurfaceFormat {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::SurfaceFormat), Azure(azure::azure_hl::SurfaceFormat),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
#[derive(Clone)] #[derive(Clone)]
pub enum SourceSurface { pub enum SourceSurface {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::SourceSurface), Azure(azure::azure_hl::SourceSurface),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
pub enum Path { pub enum Path {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::Path), Azure(azure::azure_hl::Path),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
#[derive(Clone)] #[derive(Clone)]
pub enum Pattern { pub enum Pattern {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::Pattern), Azure(azure::azure_hl::Pattern),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
pub enum DrawSurfaceOptions { pub enum DrawSurfaceOptions {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::DrawSurfaceOptions), Azure(azure::azure_hl::DrawSurfaceOptions),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
#[derive(Clone)] #[derive(Clone)]
pub enum DrawOptions { pub enum DrawOptions {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::DrawOptions), Azure(azure::azure_hl::DrawOptions),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(()), Raqote(()),
} }
#[derive(Clone)] #[derive(Clone)]
pub enum StrokeOptions<'a> { pub enum StrokeOptions<'a> {
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
Azure(azure::azure_hl::StrokeOptions<'a>), Azure(azure::azure_hl::StrokeOptions<'a>),
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
Raqote(PhantomData<&'a ()>), Raqote(PhantomData<&'a ()>),
} }
@ -391,12 +391,12 @@ pub struct CanvasData<'a> {
pub canvas_id: CanvasId, pub canvas_id: CanvasId,
} }
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
fn create_backend() -> Box<dyn Backend> { fn create_backend() -> Box<dyn Backend> {
Box::new(crate::azure_backend::AzureBackend) Box::new(crate::azure_backend::AzureBackend)
} }
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
fn create_backend() -> Box<dyn Backend> { fn create_backend() -> Box<dyn Backend> {
Box::new(crate::raqote_backend::RaqoteBackend) Box::new(crate::raqote_backend::RaqoteBackend)
} }

View file

@ -7,10 +7,10 @@
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[cfg(feature = "azure_backend")] #[cfg(feature = "canvas2d-azure")]
mod azure_backend; mod azure_backend;
#[cfg(feature = "raqote_backend")] #[cfg(feature = "canvas2d-raqote")]
mod raqote_backend; mod raqote_backend;
pub mod canvas_data; pub mod canvas_data;

View file

@ -11,8 +11,8 @@ name = "constellation"
path = "lib.rs" path = "lib.rs"
[features] [features]
azure_backend = ["canvas/azure_backend"] canvas2d-azure = ["canvas/canvas2d-azure"]
raqote_backend = ["canvas/raqote_backend"] canvas2d-raqote = ["canvas/canvas2d-raqote"]
no_wgl = ["canvas/no_wgl"] no_wgl = ["canvas/no_wgl"]
[dependencies] [dependencies]

View file

@ -3,7 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![cfg_attr(feature = "unstable", feature(conservative_impl_trait))]
#[macro_use] #[macro_use]
extern crate crossbeam_channel; extern crate crossbeam_channel;

View file

@ -13,9 +13,6 @@ path = "lib.rs"
test = false test = false
doctest = false doctest = false
[features]
unstable = ["packed_simd"]
[dependencies] [dependencies]
app_units = "0.7" app_units = "0.7"
bitflags = "1.0" bitflags = "1.0"
@ -31,7 +28,7 @@ log = "0.4"
malloc_size_of = { path = "../malloc_size_of" } malloc_size_of = { path = "../malloc_size_of" }
net_traits = {path = "../net_traits"} net_traits = {path = "../net_traits"}
ordered-float = "1.0" ordered-float = "1.0"
packed_simd = {version = "0.3", optional = true} packed_simd = "0.3"
range = {path = "../range"} range = {path = "../range"}
serde = "1.0" serde = "1.0"
servo_arc = {path = "../servo_arc"} servo_arc = {path = "../servo_arc"}

View file

@ -4,10 +4,7 @@
use app_units::Au; use app_units::Au;
use euclid::Point2D; use euclid::Point2D;
#[cfg(all( #[cfg(any(target_feature = "sse2", target_feature = "neon"))]
feature = "unstable",
any(target_feature = "sse2", target_feature = "neon")
))]
use packed_simd::u32x4; use packed_simd::u32x4;
use range::{self, EachIndex, Range, RangeIndex}; use range::{self, EachIndex, Range, RangeIndex};
use std::cmp::{Ordering, PartialOrd}; use std::cmp::{Ordering, PartialOrd};
@ -75,7 +72,6 @@ pub type GlyphId = u32;
// TODO: make this more type-safe. // TODO: make this more type-safe.
const FLAG_CHAR_IS_SPACE: u32 = 0x40000000; const FLAG_CHAR_IS_SPACE: u32 = 0x40000000;
#[cfg(feature = "unstable")]
#[cfg(any(target_feature = "sse2", target_feature = "neon"))] #[cfg(any(target_feature = "sse2", target_feature = "neon"))]
const FLAG_CHAR_IS_SPACE_SHIFT: u32 = 30; const FLAG_CHAR_IS_SPACE_SHIFT: u32 = 30;
const FLAG_IS_SIMPLE_GLYPH: u32 = 0x80000000; const FLAG_IS_SIMPLE_GLYPH: u32 = 0x80000000;
@ -625,7 +621,6 @@ impl<'a> GlyphStore {
} }
#[inline] #[inline]
#[cfg(feature = "unstable")]
#[cfg(any(target_feature = "sse2", target_feature = "neon"))] #[cfg(any(target_feature = "sse2", target_feature = "neon"))]
fn advance_for_byte_range_simple_glyphs( fn advance_for_byte_range_simple_glyphs(
&self, &self,
@ -644,7 +639,7 @@ impl<'a> GlyphStore {
for i in 0..num_simd_iterations { for i in 0..num_simd_iterations {
let offset = begin + i * 4; let offset = begin + i * 4;
let v = u32x4::load_unaligned(&buf[offset..]); let v = u32x4::from_slice_unaligned(&buf[offset..]);
let advance = (v & advance_mask) >> GLYPH_ADVANCE_SHIFT; let advance = (v & advance_mask) >> GLYPH_ADVANCE_SHIFT;
let spaces = (v & space_flag_mask) >> FLAG_CHAR_IS_SPACE_SHIFT; let spaces = (v & space_flag_mask) >> FLAG_CHAR_IS_SPACE_SHIFT;
simd_advance = simd_advance + advance; simd_advance = simd_advance + advance;
@ -672,10 +667,7 @@ impl<'a> GlyphStore {
/// When SIMD isn't available, fallback to the slow path. /// When SIMD isn't available, fallback to the slow path.
#[inline] #[inline]
#[cfg(not(all( #[cfg(not(any(target_feature = "sse2", target_feature = "neon")))]
feature = "unstable",
any(target_feature = "sse2", target_feature = "neon")
)))]
fn advance_for_byte_range_simple_glyphs( fn advance_for_byte_range_simple_glyphs(
&self, &self,
range: &Range<ByteIndex>, range: &Range<ByteIndex>,
@ -686,7 +678,6 @@ impl<'a> GlyphStore {
/// Used for SIMD. /// Used for SIMD.
#[inline] #[inline]
#[cfg(feature = "unstable")]
#[cfg(any(target_feature = "sse2", target_feature = "neon"))] #[cfg(any(target_feature = "sse2", target_feature = "neon"))]
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn transmute_entry_buffer_to_u32_buffer(&self) -> &[u32] { fn transmute_entry_buffer_to_u32_buffer(&self) -> &[u32] {

View file

@ -10,9 +10,6 @@ publish = false
name = "layout_thread" name = "layout_thread"
path = "lib.rs" path = "lib.rs"
[features]
unstable = ["parking_lot/nightly"]
[dependencies] [dependencies]
app_units = "0.7" app_units = "0.7"
atomic_refcell = "0.1" atomic_refcell = "0.1"
@ -36,7 +33,7 @@ malloc_size_of = { path = "../malloc_size_of" }
metrics = {path = "../metrics"} metrics = {path = "../metrics"}
msg = {path = "../msg"} msg = {path = "../msg"}
net_traits = {path = "../net_traits"} net_traits = {path = "../net_traits"}
parking_lot = "0.8" parking_lot = {version = "0.8", features = ["nightly"]}
profile_traits = {path = "../profile_traits"} profile_traits = {path = "../profile_traits"}
range = {path = "../range"} range = {path = "../range"}
rayon = "1" rayon = "1"

View file

@ -10,9 +10,6 @@ publish = false
name = "profile" name = "profile"
path = "lib.rs" path = "lib.rs"
[features]
unstable = ["servo_allocator"]
[dependencies] [dependencies]
profile_traits = {path = "../profile_traits"} profile_traits = {path = "../profile_traits"}
influent = "0.5" influent = "0.5"
@ -33,4 +30,4 @@ regex = "1.1"
[target.'cfg(not(target_os = "windows"))'.dependencies] [target.'cfg(not(target_os = "windows"))'.dependencies]
libc = "0.2" libc = "0.2"
servo_allocator = {path = "../allocator", optional = true} servo_allocator = {path = "../allocator"}

View file

@ -389,14 +389,14 @@ mod system_reporter {
use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR}; use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR};
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use libc::c_int; use libc::c_int;
#[cfg(all(feature = "unstable", not(target_os = "windows")))] #[cfg(not(target_os = "windows"))]
use libc::{c_void, size_t}; use libc::{c_void, size_t};
use profile_traits::mem::{Report, ReportKind, ReporterRequest}; use profile_traits::mem::{Report, ReportKind, ReporterRequest};
#[cfg(all(feature = "unstable", not(target_os = "windows")))] #[cfg(not(target_os = "windows"))]
use std::ffi::CString; use std::ffi::CString;
#[cfg(all(feature = "unstable", not(target_os = "windows")))] #[cfg(not(target_os = "windows"))]
use std::mem::size_of; use std::mem::size_of;
#[cfg(all(feature = "unstable", not(target_os = "windows")))] #[cfg(not(target_os = "windows"))]
use std::ptr::null_mut; use std::ptr::null_mut;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use task_info::task_basic_info::{resident_size, virtual_size}; use task_info::task_basic_info::{resident_size, virtual_size};
@ -495,10 +495,10 @@ mod system_reporter {
None None
} }
#[cfg(all(feature = "unstable", not(target_os = "windows")))] #[cfg(not(target_os = "windows"))]
use servo_allocator::jemalloc_sys::mallctl; use servo_allocator::jemalloc_sys::mallctl;
#[cfg(all(feature = "unstable", not(target_os = "windows")))] #[cfg(not(target_os = "windows"))]
fn jemalloc_stat(value_name: &str) -> Option<usize> { fn jemalloc_stat(value_name: &str) -> Option<usize> {
// Before we request the measurement of interest, we first send an "epoch" // Before we request the measurement of interest, we first send an "epoch"
// request. Without that jemalloc gives cached statistics(!) which can be // request. Without that jemalloc gives cached statistics(!) which can be
@ -545,7 +545,7 @@ mod system_reporter {
Some(value as usize) Some(value as usize)
} }
#[cfg(any(target_os = "windows", not(feature = "unstable")))] #[cfg(target_os = "windows")]
fn jemalloc_stat(_value_name: &str) -> Option<usize> { fn jemalloc_stat(_value_name: &str) -> Option<usize> {
None None
} }

View file

@ -15,7 +15,6 @@ path = "lib.rs"
[features] [features]
debugmozjs = ['js/debugmozjs'] debugmozjs = ['js/debugmozjs']
profilemozjs = ['js/profilemozjs'] profilemozjs = ['js/profilemozjs']
unstable = []
unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"] unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
webidl_lint = ["script_plugins/webidl_lint"] webidl_lint = ["script_plugins/webidl_lint"]
default = ["unrooted_must_root_lint", "webidl_lint"] default = ["unrooted_must_root_lint", "webidl_lint"]

View file

@ -69,10 +69,7 @@ pub trait IDLInterface {
} }
/// A trait to mark an IDL interface as deriving from another one. /// A trait to mark an IDL interface as deriving from another one.
#[cfg_attr( #[rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")]
feature = "unstable",
rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")
)]
pub trait DerivedFrom<T: Castable>: Castable {} pub trait DerivedFrom<T: Castable>: Castable {}
impl<T: Float + ToJSValConvertible> ToJSValConvertible for Finite<T> { impl<T: Float + ToJSValConvertible> ToJSValConvertible for Finite<T> {

View file

@ -330,13 +330,13 @@ impl<T: DomObject> Deref for Dom<T> {
unsafe impl<T: DomObject> JSTraceable for Dom<T> { unsafe impl<T: DomObject> JSTraceable for Dom<T> {
unsafe fn trace(&self, trc: *mut JSTracer) { unsafe fn trace(&self, trc: *mut JSTracer) {
#[cfg(all(feature = "unstable", debug_assertions))] let trace_string;
let trace_str = format!("for {} on heap", ::std::intrinsics::type_name::<T>()); let trace_info = if cfg!(debug_assertions) {
#[cfg(all(feature = "unstable", debug_assertions))] trace_string = format!("for {} on heap", ::std::intrinsics::type_name::<T>());
let trace_info = &trace_str[..]; &trace_string[..]
#[cfg(not(all(feature = "unstable", debug_assertions)))] } else {
let trace_info = "for DOM object on heap"; "for DOM object on heap"
};
trace_reflector(trc, trace_info, (*self.ptr.as_ptr()).reflector()); trace_reflector(trc, trace_info, (*self.ptr.as_ptr()).reflector());
} }
} }

View file

@ -938,10 +938,7 @@ impl WindowMethods for Window {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn Trap(&self) { fn Trap(&self) {
#[cfg(feature = "unstable")] unsafe { ::std::intrinsics::breakpoint() }
unsafe {
::std::intrinsics::breakpoint()
}
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]

View file

@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![cfg_attr(feature = "unstable", feature(core_intrinsics))]
#![cfg_attr(feature = "unstable", feature(on_unimplemented))]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(inner_deref)] #![feature(inner_deref)]
#![feature(on_unimplemented)]
#![feature(plugin)] #![feature(plugin)]
#![feature(type_alias_enum_variants)] #![feature(type_alias_enum_variants)]
#![deny(unsafe_code)] #![deny(unsafe_code)]

View file

@ -32,14 +32,7 @@ macro_rules! task {
pub trait TaskOnce: Send { pub trait TaskOnce: Send {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn name(&self) -> &'static str { fn name(&self) -> &'static str {
#[cfg(feature = "unstable")] unsafe { ::std::intrinsics::type_name::<Self>() }
unsafe {
::std::intrinsics::type_name::<Self>()
}
#[cfg(not(feature = "unstable"))]
{
"(task name unknown)"
}
} }
fn run_once(self); fn run_once(self);

View file

@ -12,7 +12,8 @@ path = "lib.rs"
crate-type = ["rlib"] crate-type = ["rlib"]
[features] [features]
azure_backend = ["canvas/azure_backend"] canvas2d-azure = ["canvas/canvas2d-azure"]
canvas2d-raqote = ["canvas/canvas2d-raqote"]
debugmozjs = ["script/debugmozjs"] debugmozjs = ["script/debugmozjs"]
energy-profiling = ["profile_traits/energy-profiling"] energy-profiling = ["profile_traits/energy-profiling"]
profilemozjs = ["script/profilemozjs"] profilemozjs = ["script/profilemozjs"]
@ -21,16 +22,10 @@ js_backtrace = ["script/js_backtrace"]
max_log_level = ["log/release_max_level_info"] max_log_level = ["log/release_max_level_info"]
native-bluetooth = ["bluetooth/native-bluetooth"] native-bluetooth = ["bluetooth/native-bluetooth"]
no_wgl = ["canvas/no_wgl"] no_wgl = ["canvas/no_wgl"]
raqote_backend = ["canvas/raqote_backend"]
uwp = ["servo_config/uwp"] uwp = ["servo_config/uwp"]
webrender_debugger = ["webrender/debugger"] webrender_debugger = ["webrender/debugger"]
no_static_freetype = ["webrender/no_static_freetype"] no_static_freetype = ["webrender/no_static_freetype"]
oculusvr = ["webvr/oculusvr"] oculusvr = ["webvr/oculusvr"]
unstable = [
"euclid/unstable",
"profile/unstable",
"script/unstable",
]
webdriver = ["webdriver_server"] webdriver = ["webdriver_server"]
webgl_backtrace = [ webgl_backtrace = [
"script/webgl_backtrace", "script/webgl_backtrace",

View file

@ -183,9 +183,8 @@ def linux_tidy_unit_docs():
./mach build --dev ./mach build --dev
./mach test-unit ./mach test-unit
./mach package --dev ./mach package --dev
./mach build --dev --features raqote_backend ./mach build --dev --features canvas2d-raqote
./mach build --dev --libsimpleservo ./mach build --dev --libsimpleservo
./mach build --dev --no-default-features --features default-except-unstable
./mach test-tidy --no-progress --self-test ./mach test-tidy --no-progress --self-test
./etc/memory_reports_over_time.py --test ./etc/memory_reports_over_time.py --test
@ -194,12 +193,24 @@ def linux_tidy_unit_docs():
./etc/ci/check_no_panic.sh ./etc/ci/check_no_panic.sh
RUSTDOCFLAGS="--disable-minification" ./mach doc RUSTDOCFLAGS="--disable-minification" ./mach doc
cd target/doc (
git init cd target/doc
time git add . git init
git -c user.name="Taskcluster" -c user.email="" \ git add .
commit -q -m "Rebuild Servo documentation" git -c user.name="Taskcluster" -c user.email="" \
git bundle create docs.bundle HEAD commit -q -m "Rebuild Servo documentation"
git bundle create docs.bundle HEAD
)
"""
# Because `rustdoc` needs metadata of dependency crates,
# `cargo doc` does almost all of the work that `cargo check` does.
# Therefore, when running them in this order the second command does very little
# and should finish quickly.
# The reverse order would not increase the total amount of work to do,
# but would reduce the amount of parallelism available.
"""
./mach check
""") """)
.with_artifacts("/repo/target/doc/docs.bundle") .with_artifacts("/repo/target/doc/docs.bundle")
.find_or_create("docs." + CONFIG.task_id()) .find_or_create("docs." + CONFIG.task_id())

View file

@ -27,17 +27,15 @@ OriginalFilename = "servo.exe"
ProductName = "Servo" ProductName = "Servo"
[features] [features]
azure_backend = ["libservo/azure_backend"] canvas2d-azure = ["libservo/canvas2d-azure"]
default = ["unstable", "default-except-unstable"] canvas2d-raqote = ["libservo/canvas2d-raqote"]
default-except-unstable = ["webdriver", "max_log_level"] default = ["webdriver", "max_log_level"]
energy-profiling = ["libservo/energy-profiling"] energy-profiling = ["libservo/energy-profiling"]
debugmozjs = ["libservo/debugmozjs"] debugmozjs = ["libservo/debugmozjs"]
js_backtrace = ["libservo/js_backtrace"] js_backtrace = ["libservo/js_backtrace"]
max_log_level = ["log/release_max_level_info"] max_log_level = ["log/release_max_level_info"]
native-bluetooth = ["libservo/native-bluetooth"] native-bluetooth = ["libservo/native-bluetooth"]
profilemozjs = ["libservo/profilemozjs"] profilemozjs = ["libservo/profilemozjs"]
raqote_backend = ["libservo/raqote_backend"]
unstable = ["libservo/unstable"]
webdriver = ["libservo/webdriver"] webdriver = ["libservo/webdriver"]
webgl_backtrace = ["libservo/webgl_backtrace"] webgl_backtrace = ["libservo/webgl_backtrace"]
webrender_debugger = ["libservo/webrender_debugger"] webrender_debugger = ["libservo/webrender_debugger"]

View file

@ -15,7 +15,7 @@
//! //!
//! [glutin]: https://github.com/tomaka/glutin //! [glutin]: https://github.com/tomaka/glutin
#![cfg_attr(feature = "unstable", feature(core_intrinsics))] #![feature(core_intrinsics)]
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
include!("main2.rs"); include!("main2.rs");

View file

@ -6,7 +6,7 @@
extern crate lazy_static; extern crate lazy_static;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[cfg(all(feature = "unstable", any(target_os = "macos", target_os = "linux")))] #[cfg(any(target_os = "macos", target_os = "linux"))]
#[macro_use] #[macro_use]
extern crate sig; extern crate sig;
@ -42,13 +42,10 @@ pub mod platform {
pub fn deinit() {} pub fn deinit() {}
} }
#[cfg(any( #[cfg(not(any(target_os = "macos", target_os = "linux")))]
not(feature = "unstable"),
not(any(target_os = "macos", target_os = "linux"))
))]
fn install_crash_handler() {} fn install_crash_handler() {}
#[cfg(all(feature = "unstable", any(target_os = "macos", target_os = "linux")))] #[cfg(any(target_os = "macos", target_os = "linux"))]
fn install_crash_handler() { fn install_crash_handler() {
use backtrace::Backtrace; use backtrace::Backtrace;
use libc::_exit; use libc::_exit;

View file

@ -13,8 +13,8 @@ test = false
bench = false bench = false
[features] [features]
azure_backend = ["simpleservo/azure_backend"] canvas2d-azure = ["simpleservo/canvas2d-azure"]
raqote_backend = ["simpleservo/raqote_backend"] canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
[dependencies] [dependencies]
libservo = { path = "../../components/servo", features = ["no_static_freetype"] } libservo = { path = "../../components/servo", features = ["no_static_freetype"] }

View file

@ -26,9 +26,9 @@ libloading = "0.5"
gl_generator = "0.11" gl_generator = "0.11"
[features] [features]
azure_backend = ["libservo/azure_backend"] canvas2d-azure = ["libservo/canvas2d-azure"]
default = ["unstable", "default-except-unstable"] canvas2d-raqote = ["libservo/canvas2d-raqote"]
default-except-unstable = ["webdriver", "max_log_level"] default = ["webdriver", "max_log_level"]
debugmozjs = ["libservo/debugmozjs"] debugmozjs = ["libservo/debugmozjs"]
energy-profiling = ["libservo/energy-profiling"] energy-profiling = ["libservo/energy-profiling"]
googlevr = ["libservo/googlevr"] googlevr = ["libservo/googlevr"]
@ -38,8 +38,6 @@ native-bluetooth = ["libservo/native-bluetooth"]
no_static_freetype = ["libservo/no_static_freetype"] no_static_freetype = ["libservo/no_static_freetype"]
no_wgl = ["libservo/no_wgl"] no_wgl = ["libservo/no_wgl"]
oculusvr = ["libservo/oculusvr"] oculusvr = ["libservo/oculusvr"]
raqote_backend = ["libservo/raqote_backend"]
webdriver = ["libservo/webdriver"] webdriver = ["libservo/webdriver"]
unstable = ["libservo/unstable"]
uwp = ["libservo/uwp"] uwp = ["libservo/uwp"]
webgl_backtrace = ["libservo/webgl_backtrace"] webgl_backtrace = ["libservo/webgl_backtrace"]

View file

@ -21,10 +21,10 @@ env_logger = "0.6"
cbindgen = "0.8" cbindgen = "0.8"
[features] [features]
azure_backend = ["simpleservo/azure_backend"] canvas2d-azure = ["simpleservo/canvas2d-azure"]
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
debugmozjs = ["simpleservo/debugmozjs"] debugmozjs = ["simpleservo/debugmozjs"]
default = ["unstable", "default-except-unstable"] default = ["webdriver", "max_log_level"]
default-except-unstable = ["webdriver", "max_log_level"]
energy-profiling = ["simpleservo/energy-profiling"] energy-profiling = ["simpleservo/energy-profiling"]
googlevr = ["simpleservo/googlevr"] googlevr = ["simpleservo/googlevr"]
js_backtrace = ["simpleservo/js_backtrace"] js_backtrace = ["simpleservo/js_backtrace"]
@ -32,8 +32,6 @@ max_log_level = ["simpleservo/max_log_level"]
native-bluetooth = ["simpleservo/native-bluetooth"] native-bluetooth = ["simpleservo/native-bluetooth"]
no_wgl = ["simpleservo/no_wgl"] no_wgl = ["simpleservo/no_wgl"]
oculusvr = ["simpleservo/oculusvr"] oculusvr = ["simpleservo/oculusvr"]
raqote_backend = ["simpleservo/raqote_backend"]
unstable = ["simpleservo/unstable"]
uwp = ["simpleservo/uwp"] uwp = ["simpleservo/uwp"]
webdriver = ["simpleservo/webdriver"] webdriver = ["simpleservo/webdriver"]
webgl_backtrace = ["simpleservo/webgl_backtrace"] webgl_backtrace = ["simpleservo/webgl_backtrace"]

View file

@ -26,17 +26,15 @@ simpleservo = { path = "../api" }
cc = "1.0" cc = "1.0"
[features] [features]
azure_backend = ["simpleservo/azure_backend"] canvas2d-azure = ["simpleservo/canvas2d-azure"]
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
debugmozjs = ["simpleservo/debugmozjs"] debugmozjs = ["simpleservo/debugmozjs"]
default = ["unstable", "default-except-unstable"] default = ["webdriver", "max_log_level"]
default-except-unstable = ["webdriver", "max_log_level"]
energy-profiling = ["simpleservo/energy-profiling"] energy-profiling = ["simpleservo/energy-profiling"]
googlevr = ["simpleservo/googlevr"] googlevr = ["simpleservo/googlevr"]
js_backtrace = ["simpleservo/js_backtrace"] js_backtrace = ["simpleservo/js_backtrace"]
max_log_level = ["simpleservo/max_log_level"] max_log_level = ["simpleservo/max_log_level"]
native-bluetooth = ["simpleservo/native-bluetooth"] native-bluetooth = ["simpleservo/native-bluetooth"]
oculusvr = ["simpleservo/oculusvr"] oculusvr = ["simpleservo/oculusvr"]
raqote_backend = ["simpleservo/raqote_backend"]
unstable = ["simpleservo/unstable"]
webdriver = ["simpleservo/webdriver"] webdriver = ["simpleservo/webdriver"]
webgl_backtrace = ["simpleservo/webgl_backtrace"] webgl_backtrace = ["simpleservo/webgl_backtrace"]

View file

@ -34,18 +34,6 @@ from servo.util import delete, download_bytes, download_file, extract, check_has
@CommandProvider @CommandProvider
class MachCommands(CommandBase): class MachCommands(CommandBase):
@Command('env',
description='Print environment setup commands',
category='bootstrap')
def env(self):
env = self.build_env()
print("export RUSTFLAGS=%s" % env.get("RUSTFLAGS", ""))
print("export PATH=%s" % env.get("PATH", ""))
if sys.platform == "darwin":
print("export DYLD_LIBRARY_PATH=%s" % env.get("DYLD_LIBRARY_PATH", ""))
else:
print("export LD_LIBRARY_PATH=%s" % env.get("LD_LIBRARY_PATH", ""))
@Command('bootstrap', @Command('bootstrap',
description='Install required packages for building.', description='Install required packages for building.',
category='bootstrap') category='bootstrap')

View file

@ -146,9 +146,6 @@ class MachCommands(CommandBase):
@Command('build', @Command('build',
description='Build Servo', description='Build Servo',
category='build') category='build')
@CommandArgument('--target', '-t',
default=None,
help='Cross compile for given target platform')
@CommandArgument('--release', '-r', @CommandArgument('--release', '-r',
action='store_true', action='store_true',
help='Build in release mode') help='Build in release mode')
@ -158,25 +155,9 @@ class MachCommands(CommandBase):
@CommandArgument('--jobs', '-j', @CommandArgument('--jobs', '-j',
default=None, default=None,
help='Number of jobs to run in parallel') help='Number of jobs to run in parallel')
@CommandArgument('--features',
default=None,
help='Space-separated list of features to also build',
nargs='+')
@CommandArgument('--android',
default=None,
action='store_true',
help='Build for Android')
@CommandArgument('--magicleap',
default=None,
action='store_true',
help='Build for Magic Leap')
@CommandArgument('--no-package', @CommandArgument('--no-package',
action='store_true', action='store_true',
help='For Android, disable packaging into a .apk after building') help='For Android, disable packaging into a .apk after building')
@CommandArgument('--debug-mozjs',
default=None,
action='store_true',
help='Enable debug assertions in mozjs')
@CommandArgument('--verbose', '-v', @CommandArgument('--verbose', '-v',
action='store_true', action='store_true',
help='Print verbose output') help='Print verbose output')
@ -185,46 +166,14 @@ class MachCommands(CommandBase):
help='Print very verbose output') help='Print very verbose output')
@CommandArgument('params', nargs='...', @CommandArgument('params', nargs='...',
help="Command-line arguments to be passed through to Cargo") help="Command-line arguments to be passed through to Cargo")
@CommandArgument('--with-debug-assertions', @CommandBase.build_like_command_arguments
default=None, def build(self, release=False, dev=False, jobs=None, params=None,
action='store_true', no_package=False, verbose=False, very_verbose=False,
help='Enable debug assertions in release') target=None, android=False, magicleap=False, libsimpleservo=False,
@CommandArgument('--libsimpleservo', features=None, **kwargs):
default=None,
action='store_true',
help='Build the libsimpleservo library instead of the servo executable')
@CommandArgument('--with-frame-pointer',
default=None,
action='store_true',
help='Build with frame pointer enabled, used by the background hang monitor.')
@CommandArgument('--with-raqote', default=None, action='store_true')
@CommandArgument('--without-wgl', default=None, action='store_true')
def build(self, target=None, release=False, dev=False, jobs=None,
features=None, android=None, magicleap=None, no_package=False, verbose=False, very_verbose=False,
debug_mozjs=False, params=None, with_debug_assertions=False,
libsimpleservo=False, with_frame_pointer=False, with_raqote=False, without_wgl=False):
opts = params or [] opts = params or []
features = features or []
if android is None: target, android = self.pick_target_triple(target, android, magicleap)
android = self.config["build"]["android"]
features = features or self.servo_features()
if target and android:
print("Please specify either --target or --android.")
sys.exit(1)
if android:
target = self.config["android"]["target"]
if not magicleap:
features += ["native-bluetooth"]
if magicleap and not target:
target = "aarch64-linux-android"
if target and not android and not magicleap:
android = self.handle_android_target(target)
target_path = base_path = self.get_target_dir() target_path = base_path = self.get_target_dir()
if android: if android:
@ -278,44 +227,13 @@ class MachCommands(CommandBase):
check_call(["rustup" + BIN_SUFFIX, "target", "add", check_call(["rustup" + BIN_SUFFIX, "target", "add",
"--toolchain", self.toolchain(), target]) "--toolchain", self.toolchain(), target])
opts += ["--target", target]
env = self.build_env(target=target, is_build=True) env = self.build_env(target=target, is_build=True)
self.ensure_bootstrapped(target=target) self.ensure_bootstrapped(target=target)
self.ensure_clobbered() self.ensure_clobbered()
self.add_manifest_path(opts, android, libsimpleservo)
if debug_mozjs:
features += ["debugmozjs"]
if with_frame_pointer:
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C force-frame-pointers=yes"
features += ["profilemozjs"]
if with_raqote:
features += ["raqote_backend"]
if without_wgl:
features += ["no_wgl"]
if self.config["build"]["webgl-backtrace"]:
features += ["webgl-backtrace"]
if self.config["build"]["dom-backtrace"]:
features += ["dom-backtrace"]
if "raqote_backend" not in features:
features += ["azure_backend"]
if features:
opts += ["--features", "%s" % ' '.join(features)]
build_start = time() build_start = time()
env["CARGO_TARGET_DIR"] = target_path env["CARGO_TARGET_DIR"] = target_path
if with_debug_assertions:
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C debug_assertions"
host = host_triple() host = host_triple()
if 'apple-darwin' in host and (not target or target == host): if 'apple-darwin' in host and (not target or target == host):
if 'CXXFLAGS' not in env: if 'CXXFLAGS' not in env:
@ -612,7 +530,13 @@ class MachCommands(CommandBase):
env.setdefault("CC", "clang") env.setdefault("CC", "clang")
env.setdefault("CXX", "clang++") env.setdefault("CXX", "clang++")
status = self.call_rustup_run(["cargo", "build"] + opts, env=env, verbose=verbose) status = self.run_cargo_build_like_command(
"build", opts, env=env, verbose=verbose,
target=target, android=android, magicleap=magicleap, libsimpleservo=libsimpleservo,
features=features, **kwargs
)
status = 0
elapsed = time() - build_start elapsed = time() - build_start
# Do some additional things if the build succeeded # Do some additional things if the build succeeded
@ -712,14 +636,11 @@ class MachCommands(CommandBase):
print('Removing virtualenv directory: %s' % virtualenv_path) print('Removing virtualenv directory: %s' % virtualenv_path)
shutil.rmtree(virtualenv_path) shutil.rmtree(virtualenv_path)
opts = [] opts = ["--manifest-path", manifest_path or path.join(self.context.topdir, "Cargo.toml")]
if manifest_path:
opts += ["--manifest-path", manifest_path]
if verbose: if verbose:
opts += ["-v"] opts += ["-v"]
opts += params opts += params
return check_call(["cargo", "clean"] + opts, return check_call(["cargo", "clean"] + opts, env=self.build_env(), verbose=verbose)
env=self.build_env(), cwd=self.ports_glutin_crate(), verbose=verbose)
def package_gstreamer_dlls(servo_exe_dir, target): def package_gstreamer_dlls(servo_exe_dir, target):

View file

@ -28,6 +28,7 @@ from servo.util import download_file
import urllib2 import urllib2
from bootstrap import check_gstreamer_lib from bootstrap import check_gstreamer_lib
from mach.decorators import CommandArgument
from mach.registrar import Registrar from mach.registrar import Registrar
import toml import toml
@ -731,34 +732,130 @@ install them, let us know by filing a bug!")
return env return env
def ports_glutin_crate(self): @staticmethod
return path.join(self.context.topdir, "ports", "glutin") def build_like_command_arguments(decorated_function):
decorators = [
CommandArgument(
'--target', '-t',
default=None,
help='Cross compile for given target platform',
),
CommandArgument(
'--android',
default=None,
action='store_true',
help='Build for Android',
),
CommandArgument(
'--magicleap',
default=None,
action='store_true',
help='Build for Magic Leap',
),
CommandArgument(
'--libsimpleservo',
default=None,
action='store_true',
help='Build the libsimpleservo library instead of the servo executable',
),
CommandArgument(
'--features',
default=None,
help='Space-separated list of features to also build',
nargs='+',
),
CommandArgument(
'--debug-mozjs',
default=None,
action='store_true',
help='Enable debug assertions in mozjs',
),
CommandArgument(
'--with-debug-assertions',
default=None,
action='store_true',
help='Enable debug assertions in release',
),
CommandArgument(
'--with-frame-pointer',
default=None,
action='store_true',
help='Build with frame pointer enabled, used by the background hang monitor.',
),
CommandArgument('--with-raqote', default=None, action='store_true'),
CommandArgument('--without-wgl', default=None, action='store_true'),
]
def add_manifest_path(self, args, android=False, libsimpleservo=False): for decorator in decorators:
decorated_function = decorator(decorated_function)
return decorated_function
def pick_target_triple(self, target, android, magicleap):
if android is None:
android = self.config["build"]["android"]
if target and android:
assert self.handle_android_target(target)
if android and not target:
target = self.config["android"]["target"]
if magicleap and not target:
target = "aarch64-linux-android"
if target and not android and not magicleap:
android = self.handle_android_target(target)
return target, android
def run_cargo_build_like_command(
self, command, cargo_args,
env=None, verbose=False,
target=None, android=False, magicleap=False, libsimpleservo=False,
features=None, debug_mozjs=False, with_debug_assertions=False,
with_frame_pointer=False, with_raqote=False, without_wgl=False,
):
env = env or self.build_env()
target, android = self.pick_target_triple(target, android, magicleap)
args = []
if "--manifest-path" not in args: if "--manifest-path" not in args:
if libsimpleservo or android: if libsimpleservo or android:
manifest = self.ports_libsimpleservo_manifest(android) if android:
api = "jniapi"
else:
api = "capi"
port = path.join("libsimpleservo", api)
else: else:
manifest = self.ports_glutin_manifest() port = "glutin"
args.append("--manifest-path") args += [
args.append(manifest) "--manifest-path",
path.join(self.context.topdir, "ports", port, "Cargo.toml"),
]
if target:
args += ["--target", target]
def ports_glutin_manifest(self): if features is None: # If we're passed a list, mutate it even if it's empty
return path.join(self.context.topdir, "ports", "glutin", "Cargo.toml") features = []
if self.config["build"]["debug-mozjs"] or debug_mozjs:
features.append("debugmozjs")
if not magicleap:
features.append("native-bluetooth")
if with_raqote and "canvas2d-azure" not in features:
features.append("canvas2d-raqote")
elif "canvas2d-raqote" not in features:
features.append("canvas2d-azure")
if with_frame_pointer:
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C force-frame-pointers=yes"
features.append("profilemozjs")
if without_wgl:
features.append("no_wgl")
if self.config["build"]["webgl-backtrace"]:
features.append("webgl-backtrace")
if self.config["build"]["dom-backtrace"]:
features.append("dom-backtrace")
if with_debug_assertions:
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C debug_assertions"
def ports_libsimpleservo_manifest(self, android=False): assert "--features" not in cargo_args
if android: args += ["--features", " ".join(features)]
api = "jniapi"
else:
api = "capi"
return path.join(self.context.topdir, "ports", "libsimpleservo", api, "Cargo.toml")
def servo_features(self): return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
"""Return a list of optional features to enable for the Servo crate"""
features = []
if self.config["build"]["debug-mozjs"]:
features += ["debugmozjs"]
return features
def android_support_dir(self): def android_support_dir(self):
return path.join(self.context.topdir, "support", "android") return path.join(self.context.topdir, "support", "android")

View file

@ -31,7 +31,14 @@ from servo.util import get_static_rust_lang_org_dist, get_urlopen_kwargs
@CommandProvider @CommandProvider
class MachCommands(CommandBase): class MachCommands(CommandBase):
def run_cargo(self, params, check=False): @Command('check',
description='Run "cargo check"',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to cargo check")
@CommandBase.build_like_command_arguments
def check(self, params, **kwargs):
if not params: if not params:
params = [] params = []
@ -39,40 +46,17 @@ class MachCommands(CommandBase):
self.ensure_clobbered() self.ensure_clobbered()
env = self.build_env() env = self.build_env()
if check:
params = ['check'] + params
self.add_manifest_path(params)
build_start = time() build_start = time()
status = self.call_rustup_run(["cargo"] + params, env=env) status = self.run_cargo_build_like_command("check", params, env=env, **kwargs)
elapsed = time() - build_start elapsed = time() - build_start
notify_build_done(self.config, elapsed, status == 0) notify_build_done(self.config, elapsed, status == 0)
if check and status == 0: if status == 0:
print('Finished checking, binary NOT updated. Consider ./mach build before ./mach run') print('Finished checking, binary NOT updated. Consider ./mach build before ./mach run')
return status return status
@Command('cargo',
description='Run Cargo',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to Cargo")
def cargo(self, params):
return self.run_cargo(params)
@Command('check',
description='Run "cargo check"',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to cargo check")
def check(self, params):
return self.run_cargo(params, check=True)
@Command('cargo-update', @Command('cargo-update',
description='Same as update-cargo', description='Same as update-cargo',
category='devenv') category='devenv')

View file

@ -236,7 +236,8 @@ class PostBuildCommands(CommandBase):
@CommandArgument( @CommandArgument(
'params', nargs='...', 'params', nargs='...',
help="Command-line arguments to be passed through to cargo doc") help="Command-line arguments to be passed through to cargo doc")
def doc(self, params): @CommandBase.build_like_command_arguments
def doc(self, params, **kwargs):
env = os.environ.copy() env = os.environ.copy()
env["RUSTUP_TOOLCHAIN"] = self.toolchain() env["RUSTUP_TOOLCHAIN"] = self.toolchain()
rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env) rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env)
@ -264,11 +265,7 @@ class PostBuildCommands(CommandBase):
else: else:
copy2(full_name, destination) copy2(full_name, destination)
params += ["--features", "azure_backend"] returncode = self.run_cargo_build_like_command("doc", params, **kwargs)
returncode = self.call_rustup_run(
["cargo", "doc", "--manifest-path", self.ports_glutin_manifest()] + params,
env=self.build_env())
if returncode: if returncode:
return returncode return returncode

View file

@ -214,7 +214,8 @@ class MachCommands(CommandBase):
help="Run in bench mode") help="Run in bench mode")
@CommandArgument('--nocapture', default=False, action="store_true", @CommandArgument('--nocapture', default=False, action="store_true",
help="Run tests with nocapture ( show test stdout )") help="Run tests with nocapture ( show test stdout )")
def test_unit(self, test_name=None, package=None, bench=False, nocapture=False): @CommandBase.build_like_command_arguments
def test_unit(self, test_name=None, package=None, bench=False, nocapture=False, **kwargs):
if test_name is None: if test_name is None:
test_name = [] test_name = []
@ -277,22 +278,18 @@ class MachCommands(CommandBase):
# in to the servo.exe build dir, so just point PATH to that. # in to the servo.exe build dir, so just point PATH to that.
env["PATH"] = "%s%s%s" % (path.dirname(self.get_binary_path(False, False)), os.pathsep, env["PATH"]) 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 or len(in_crate_packages) > 0: if len(packages) > 0 or len(in_crate_packages) > 0:
args = ["cargo", "bench" if bench else "test", "--manifest-path", self.ports_glutin_manifest()] args = []
for crate in packages: for crate in packages:
args += ["-p", "%s_tests" % crate] args += ["-p", "%s_tests" % crate]
for crate in in_crate_packages: for crate in in_crate_packages:
args += ["-p", crate] args += ["-p", crate]
args += test_patterns args += test_patterns
if features:
args += ["--features", "%s" % ' '.join(features)]
if nocapture: if nocapture:
args += ["--", "--nocapture"] args += ["--", "--nocapture"]
err = self.call_rustup_run(args, env=env) err = self.run_cargo_build_like_command("bench" if bench else "test", args, env=env, **kwargs)
if err is not 0: if err is not 0:
return err return err