mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Allow ./mach build-tests
to enable Servo's headless mode
This allows mach's build-tests command to use the option --headless instead of checking for the value of SERVO_HEADLESS.
This commit is contained in:
parent
ff853e0d4a
commit
2342b1bc6f
1 changed files with 19 additions and 9 deletions
|
@ -29,6 +29,16 @@ def is_headless_build():
|
||||||
return int(os.getenv('SERVO_HEADLESS', 0)) == 1
|
return int(os.getenv('SERVO_HEADLESS', 0)) == 1
|
||||||
|
|
||||||
|
|
||||||
|
def headless_supported():
|
||||||
|
supported = sys.platform.startswith("linux")
|
||||||
|
|
||||||
|
if not supported:
|
||||||
|
print("Headless mode (OSMesa) is not supported on your platform.")
|
||||||
|
print("Building without headless mode.")
|
||||||
|
|
||||||
|
return supported
|
||||||
|
|
||||||
|
|
||||||
def notify_linux(title, text):
|
def notify_linux(title, text):
|
||||||
try:
|
try:
|
||||||
import dbus
|
import dbus
|
||||||
|
@ -207,13 +217,9 @@ class MachCommands(CommandBase):
|
||||||
if debug_mozjs or self.config["build"]["debug-mozjs"]:
|
if debug_mozjs or self.config["build"]["debug-mozjs"]:
|
||||||
features += ["script/debugmozjs"]
|
features += ["script/debugmozjs"]
|
||||||
|
|
||||||
if headless or is_headless_build():
|
if (headless or is_headless_build()) and headless_supported():
|
||||||
if sys.platform.startswith("linux"):
|
opts += ["--no-default-features"]
|
||||||
opts += ["--no-default-features"]
|
features += ["headless"]
|
||||||
features += ["headless"]
|
|
||||||
else:
|
|
||||||
print("Headless mode (OSMesa) is not supported on your platform.")
|
|
||||||
print("Building without headless mode.")
|
|
||||||
|
|
||||||
if android:
|
if android:
|
||||||
features += ["android_glue"]
|
features += ["android_glue"]
|
||||||
|
@ -332,15 +338,19 @@ class MachCommands(CommandBase):
|
||||||
@Command('build-tests',
|
@Command('build-tests',
|
||||||
description='Build the Servo test suites',
|
description='Build the Servo test suites',
|
||||||
category='build')
|
category='build')
|
||||||
|
@CommandArgument('--headless',
|
||||||
|
default=None,
|
||||||
|
action='store_true',
|
||||||
|
help='Enable headless mode (OSMesa)')
|
||||||
@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('--release', default=False, action="store_true",
|
@CommandArgument('--release', default=False, action="store_true",
|
||||||
help="Build tests with release mode")
|
help="Build tests with release mode")
|
||||||
def build_tests(self, jobs=None, verbose=False, release=False):
|
def build_tests(self, headless=False, jobs=None, verbose=False, release=False):
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
args = ["cargo", "test", "--no-run"]
|
args = ["cargo", "test", "--no-run"]
|
||||||
if is_headless_build():
|
if (headless or is_headless_build()) and headless_supported():
|
||||||
args += ["--no-default-features", "--features", "headless"]
|
args += ["--no-default-features", "--features", "headless"]
|
||||||
if release:
|
if release:
|
||||||
args += ["--release"]
|
args += ["--release"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue