mirror of
https://github.com/servo/servo.git
synced 2025-07-31 11:10:22 +01:00
Create match command to update WebGL conformance suite from upstream
This commit is contained in:
parent
052971a71a
commit
b5043de011
2 changed files with 41 additions and 15 deletions
|
@ -20,6 +20,7 @@ from time import time
|
||||||
import json
|
import json
|
||||||
import urllib2
|
import urllib2
|
||||||
import base64
|
import base64
|
||||||
|
import shutil
|
||||||
|
|
||||||
from mach.registrar import Registrar
|
from mach.registrar import Registrar
|
||||||
from mach.decorators import (
|
from mach.decorators import (
|
||||||
|
@ -929,3 +930,24 @@ testing/web-platform/mozilla/tests for Servo-only tests""" % reference_path)
|
||||||
run_globals = {"__file__": run_file}
|
run_globals = {"__file__": run_file}
|
||||||
execfile(run_file, run_globals)
|
execfile(run_file, run_globals)
|
||||||
return run_globals["update_test_file"](cache_dir)
|
return run_globals["update_test_file"](cache_dir)
|
||||||
|
|
||||||
|
@Command('update-webgl',
|
||||||
|
description='Update the WebGL conformance suite tests from Khronos repo',
|
||||||
|
category='testing')
|
||||||
|
@CommandArgument('--version', action='store_true', default='1.0.3',
|
||||||
|
help='WebGL conformance suite version')
|
||||||
|
def update_webgl(self, version=None):
|
||||||
|
self.ensure_bootstrapped()
|
||||||
|
|
||||||
|
base_dir = path.abspath(path.join(PROJECT_TOPLEVEL_PATH,
|
||||||
|
"tests", "wpt", "mozilla", "tests", "webgl"))
|
||||||
|
run_file = path.join(base_dir, "tools", "import-conformance-tests.py")
|
||||||
|
dest_folder = path.join(base_dir, "conformance-%s" % version)
|
||||||
|
patches_dir = path.join(base_dir, "tools")
|
||||||
|
# Clean dest folder if exists
|
||||||
|
if os.path.exists(dest_folder):
|
||||||
|
shutil.rmtree(dest_folder)
|
||||||
|
|
||||||
|
run_globals = {"__file__": run_file}
|
||||||
|
execfile(run_file, run_globals)
|
||||||
|
return run_globals["update_conformance"](version, dest_folder, None, patches_dir)
|
||||||
|
|
|
@ -14,6 +14,10 @@ PATCHES = [
|
||||||
("unit.patch", "conformance/more/unit.js")
|
("unit.patch", "conformance/more/unit.js")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Fix for 'UnicodeDecodeError: 'ascii' codec can't decode byte'
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding('utf8')
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print("Usage: {} version destination [existing_webgl_repo]".format(sys.argv[0]))
|
print("Usage: {} version destination [existing_webgl_repo]".format(sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -63,20 +67,11 @@ def process_test(test):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def update_conformance(version, destination, existing_repo, patches_dir):
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument("version", help="WebGL test suite version (e.g.: 1.0.3)")
|
|
||||||
parser.add_argument("destination", help="Test suite destination")
|
|
||||||
parser.add_argument("-e", "--existing-repo", help="Path to an existing clone of the khronos WebGL repository")
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
version = args.version
|
|
||||||
destination = args.destination
|
|
||||||
|
|
||||||
print("Trying to import WebGL conformance test suite {} into {}".format(version, destination))
|
print("Trying to import WebGL conformance test suite {} into {}".format(version, destination))
|
||||||
|
|
||||||
if args.existing_repo:
|
if existing_repo:
|
||||||
directory = args.existing_repo
|
directory = existing_repo
|
||||||
print("Using existing WebGL repository: {}".format(directory))
|
print("Using existing WebGL repository: {}".format(directory))
|
||||||
else:
|
else:
|
||||||
directory = tempfile.mkdtemp()
|
directory = tempfile.mkdtemp()
|
||||||
|
@ -127,15 +122,24 @@ def main():
|
||||||
process_test(test)
|
process_test(test)
|
||||||
|
|
||||||
# Try to apply the patches to the required files
|
# Try to apply the patches to the required files
|
||||||
|
if not patches_dir:
|
||||||
this_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
|
patches_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||||
for patch, file_name in PATCHES:
|
for patch, file_name in PATCHES:
|
||||||
try:
|
try:
|
||||||
patch = os.path.join(this_dir, patch)
|
patch = os.path.join(patches_dir, patch)
|
||||||
subprocess.check_call(["patch", "-d", destination, file_name, patch])
|
subprocess.check_call(["patch", "-d", destination, file_name, patch])
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print("Automatic patch failed for {}".format(file_name))
|
print("Automatic patch failed for {}".format(file_name))
|
||||||
print("Please review the WPT integration and update {} accordingly".format(os.path.basename(patch)))
|
print("Please review the WPT integration and update {} accordingly".format(os.path.basename(patch)))
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("version", help="WebGL test suite version (e.g.: 1.0.3)")
|
||||||
|
parser.add_argument("destination", help="Test suite destination")
|
||||||
|
parser.add_argument("-e", "--existing-repo", help="Path to an existing clone of the khronos WebGL repository")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
update_conformance(args.version, args.destination, args.existing_repo, None)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue