Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run wrench on travis CI with OSMesa #649

Merged
merged 1 commit into from Dec 28, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1,4 +1,6 @@
dist: trusty
language: rust
rust: stable
os:
- linux
- osx
@@ -8,12 +10,21 @@ notifications:
webhooks: http://build.servo.org:54856/travis
addons:
apt:
sources:
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.8 main'
keyurl: 'http://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- libgles2-mesa-dev
- llvm-3.8-dev
- libedit-dev
before_install:
- pip install mako
script:
- (cd webrender_traits && cargo test --verbose --features "ipc")
- (cd webrender_traits && cargo test --verbose)
- (cd webrender && cargo test --verbose)
- (cd sample && cargo test --verbose)
- (cd replay && cargo test --verbose)
- (cd wrench && cargo test --verbose)
- (cd wrench && cargo build --release --verbose --features headless)
- (cd wrench && python run_tests.py res/rect.yaml)

Some generated files are not rendered by default. Learn more.

@@ -20,6 +20,11 @@ serde = "0.8"
serde_json = "0.8"
time = "0.1"
crossbeam = "0.2"
osmesa-sys = { version = "0.1.2", optional = true }
osmesa-src = { git = "https://github.com/servo/osmesa-src", optional = true }

[features]
headless = [ "osmesa-sys", "osmesa-src" ]

[dependencies.webrender]
path = "../webrender"
@@ -0,0 +1,12 @@
---
root:
items:
-
bounds: 0 0 1024 768
items:
-
bounds: 0 0 1024 768
color: green
type: rect
type: stacking_context
z_index: 1
@@ -0,0 +1,65 @@
#!/usr/bin/python

import contextlib
import os
import subprocess
import sys
import hashlib
from os import path
from glob import glob


@contextlib.contextmanager
def cd(new_path):
"""Context manager for changing the current working directory"""
previous_path = os.getcwd()
try:
os.chdir(new_path)
yield
finally:
os.chdir(previous_path)


def find_dep_path_newest(package, bin_path):
deps_path = path.join(path.split(bin_path)[0], "build")
with cd(deps_path):
candidates = glob(package + '-*')
candidates = (path.join(deps_path, c) for c in candidates)
candidate_times = sorted(((path.getmtime(c), c) for c in candidates), reverse=True)
if len(candidate_times) > 0:
return candidate_times[0][1]
return None


def is_windows():
""" Detect windows, mingw, cygwin """
return sys.platform == 'win32' or sys.platform == 'msys' or sys.platform == 'cygwin'


def is_macosx():
return sys.platform == 'darwin'


def is_linux():
return sys.platform.startswith('linux')


def set_osmesa_env(bin_path):
"""Set proper LD_LIBRARY_PATH and DRIVE for software rendering on Linux and OSX"""
if is_linux():
osmesa_path = path.join(find_dep_path_newest('osmesa-src', bin_path), "out", "lib", "gallium")
print(osmesa_path)
os.environ["LD_LIBRARY_PATH"] = osmesa_path
os.environ["GALLIUM_DRIVER"] = "softpipe"
elif is_macosx():
osmesa_path = path.join(find_dep_path_newest('osmesa-src', bin_path),
"out", "src", "gallium", "targets", "osmesa", ".libs")
glapi_path = path.join(find_dep_path_newest('osmesa-src', bin_path),
"out", "src", "mapi", "shared-glapi", ".libs")
os.environ["DYLD_LIBRARY_PATH"] = osmesa_path + ":" + glapi_path
os.environ["GALLIUM_DRIVER"] = "softpipe"


set_osmesa_env('../target/release/')

This comment has been minimized.

@kvark

kvark Dec 15, 2016

Member

is our executable built by cargo test guaranteed to be in release folder?

This comment has been minimized.

@glennw

glennw Dec 22, 2016

Author Member

I explicitly build the release version in the travis script - perhaps there's a better way to do this though.

subprocess.check_call(['../target/release/wrench', '-t', '1', '-h', 'show', sys.argv[1]])
print('md5 = ' + hashlib.md5(open('screenshot.png', 'rb').read()).hexdigest())
@@ -24,6 +24,10 @@ args:
short: a
long: subpixel-aa
help: Enable subpixel aa
- headless:
short: h
long: headless
help: Enable headless rendering
- dp_ratio:
short: p
long: device-pixel-ratio
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.