Skip to content

Commit

Permalink
Use headless rendering for performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
shinglyu committed Nov 7, 2016
1 parent d941c5b commit 9aaa088
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
1 change: 1 addition & 0 deletions etc/ci/performance/runner.py
Expand Up @@ -43,6 +43,7 @@ def get_servo_command(url):
ua_script_path = "{}/user-agent-js".format(os.getcwd())
return ["../../../target/release/servo", url,
"--userscripts", ua_script_path,
"--headless",
"-x", "-o", "output.png"]


Expand Down
55 changes: 30 additions & 25 deletions python/servo/testing_commands.py
Expand Up @@ -162,6 +162,8 @@ def suite_for_path(self, path_arg):
description='Run the page load performance test',
category='testing')
def test_perf(self):
self.set_software_rendering_env(True)

self.ensure_bootstrapped()
env = self.build_env()
return call(["bash", "test_perf.sh"],
Expand Down Expand Up @@ -422,31 +424,7 @@ def run_test_list_or_dispatch(self, requested_paths, correct_suite, correct_func

# Helper for test_css and test_wpt:
def wptrunner(self, run_file, **kwargs):
# On Linux and mac, find the OSMesa software rendering library and
# add it to the dynamic linker search path.
if sys.platform.startswith('linux'):
try:
args = [self.get_binary_path(kwargs["release"], not kwargs["release"])]
osmesa_path = path.join(find_dep_path_newest('osmesa-src', args[0]), "out", "lib", "gallium")
os.environ["LD_LIBRARY_PATH"] = osmesa_path
os.environ["GALLIUM_DRIVER"] = "softpipe"
except BuildNotFound:
# This can occur when cross compiling (e.g. arm64), in which case
# we won't run the tests anyway so can safely ignore this step.
pass
if sys.platform.startswith('darwin'):
try:
args = [self.get_binary_path(kwargs["release"], not kwargs["release"])]
osmesa_path = path.join(find_dep_path_newest('osmesa-src', args[0]),
"out", "src", "gallium", "targets", "osmesa", ".libs")
glapi_path = path.join(find_dep_path_newest('osmesa-src', args[0]),
"out", "src", "mapi", "shared-glapi", ".libs")
os.environ["DYLD_LIBRARY_PATH"] = osmesa_path + ":" + glapi_path
os.environ["GALLIUM_DRIVER"] = "softpipe"
except BuildNotFound:
# This can occur when cross compiling (e.g. arm64), in which case
# we won't run the tests anyway so can safely ignore this step.
pass
self.set_software_rendering_env(kwargs['release'])

os.environ["RUST_BACKTRACE"] = "1"
kwargs["debug"] = not kwargs["release"]
Expand Down Expand Up @@ -658,6 +636,33 @@ def dromaeo_test_runner(self, tests, release, dev):
return check_call(
[run_file, "|".join(tests), bin_path, base_dir])

def set_software_rendering_env(self, use_release):
# On Linux and mac, find the OSMesa software rendering library and
# add it to the dynamic linker search path.
if sys.platform.startswith('linux'):
try:
args = [self.get_binary_path(use_release, not use_release)]
osmesa_path = path.join(find_dep_path_newest('osmesa-src', args[0]), "out", "lib", "gallium")
os.environ["LD_LIBRARY_PATH"] = osmesa_path
os.environ["GALLIUM_DRIVER"] = "softpipe"
except BuildNotFound:
# This can occur when cross compiling (e.g. arm64), in which case
# we won't run the tests anyway so can safely ignore this step.
pass
elif sys.platform.startswith('darwin'):
try:
args = [self.get_binary_path(use_release, not use_release)]
osmesa_path = path.join(find_dep_path_newest('osmesa-src', args[0]),
"out", "src", "gallium", "targets", "osmesa", ".libs")
glapi_path = path.join(find_dep_path_newest('osmesa-src', args[0]),
"out", "src", "mapi", "shared-glapi", ".libs")
os.environ["DYLD_LIBRARY_PATH"] = osmesa_path + ":" + glapi_path
os.environ["GALLIUM_DRIVER"] = "softpipe"
except BuildNotFound:
# This can occur when cross compiling (e.g. arm64), in which case
# we won't run the tests anyway so can safely ignore this step.
pass


def create_parser_create():
import argparse
Expand Down

0 comments on commit 9aaa088

Please sign in to comment.