Diff
Modified: trunk/LayoutTests/ChangeLog (274517 => 274518)
--- trunk/LayoutTests/ChangeLog 2021-03-16 21:21:46 UTC (rev 274517)
+++ trunk/LayoutTests/ChangeLog 2021-03-16 21:27:51 UTC (rev 274518)
@@ -1,3 +1,14 @@
+2021-03-16 Kimmo Kinnunen <kkinnu...@apple.com>
+
+ Make WebGL conformance test update script more usable and consistent
+ https://bugs.webkit.org/show_bug.cgi?id=223112
+
+ Reviewed by Kenneth Russell.
+
+ Move the script over the existing but unused Tools/Scripts/update-webgl-conformance-tests.
+
+ * webgl/generate-webgl-tests: Removed.
+
2021-03-16 Amir Mark Jr <amir_m...@apple.com>
[BigSur arm64] compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html is a flakey image failure
Deleted: trunk/LayoutTests/webgl/generate-webgl-tests (274517 => 274518)
--- trunk/LayoutTests/webgl/generate-webgl-tests 2021-03-16 21:21:46 UTC (rev 274517)
+++ trunk/LayoutTests/webgl/generate-webgl-tests 2021-03-16 21:27:51 UTC (rev 274518)
@@ -1,270 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (C) 2013 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""generates webgl layout tests from the Khronos WebGL Conformance Tests"""
-
-# To use this, get a copy of the WebGL conformance tests then run this script
-# eg.
-#
-# cd ~/temp
-# git clone git://github.com/KhronosGroup/WebGL.git
-# cd ~/WebKit/LayoutTests/webgl
-# python generate-webgl-tests.py -w ~/temp/WebGL/sdk/tests -e
-#
-# Now check run the LayoutTests, update TestExpectations and check in the
-# result.
-
-import copy
-import os
-import os.path
-import sys
-import re
-import json
-import shutil
-from optparse import OptionParser
-
-if sys.version < '2.6':
- print 'Wrong Python Version !!!: Need >= 2.6'
- sys.exit(1)
-
-
-GLOBAL_OPTIONS = {
- # version use. Tests at or below this will be included.
- "version": "2.0.0",
-
- # version used for unlabled tests
- "default-version": "2.0",
-
- # If set, the version we require. Tests below this will be ignored.
- "min-version": "1.0.3",
-}
-
-
-def ReadFile(filename):
- """Reads a file as a string"""
- file = open(filename, "r")
- data = ""
- file.close()
- return data
-
-
-def WriteFile(filename, data):
- """Writes a string as a file"""
- print "Writing: ", filename
- dirname = os.path.dirname(filename)
- if not os.path.exists(dirname):
- os.makedirs(dirname)
- file = open(filename, "wb")
- file.write(data)
- file.close()
-
-
-def CopyTree(src, dst, ignore=None):
- """Recursively copy a directory tree"""
- names = os.listdir(src)
- if ignore is not None:
- ignored_names = ignore(src, names)
- else:
- ignored_names = set()
-
- if not os.path.exists(dst):
- os.makedirs(dst)
- errors = []
- for name in names:
- if name in ignored_names:
- continue
- srcname = os.path.join(src, name)
- dstname = os.path.join(dst, name)
- try:
- if os.path.isdir(srcname):
- CopyTree(srcname, dstname, ignore)
- else:
- # Will raise a SpecialFileError for unsupported file types
- shutil.copyfile(srcname, dstname)
- # catch the Error from the recursive copytree so that we can
- # continue with other files
- except Error, err:
- errors.extend(err.args[0])
- except EnvironmentError, why:
- errors.append((srcname, dstname, str(why)))
- if errors:
- raise Error, errors
-
-
-def FileReader(filename):
- """A File generator that returns only non empty, non comment lines"""
- file = open(filename, "r")
- lines = file.readlines()
- file.close()
- for line_number, line in enumerate(lines):
- line = line.strip()
- if (len(line) > 0 and
- not line.startswith("#") and
- not line.startswith(";") and
- not line.startswith("//")):
- yield line_number + 1, line
-
-
-def GreaterThanOrEqualToVersion(have, want):
- """Compares to version strings"""
- have = have.split(" ")[0].split(".")
- want = want.split(" ")[0].split(".")
- for ndx, want_str in enumerate(want):
- want_num = int(want_str)
- have_num = 0
- if ndx < len(have):
- have_num = int(have[ndx])
- if have_num < want_num:
- return False
- if have_num >= want_num:
- return True
- return True
-
-
-def GetTestList(list_filename, dest_dir, hierarchical_options):
- global GLOBAL_OPTIONS
- tests = []
- prefix = os.path.dirname(list_filename)
- for line_number, line in FileReader(list_filename):
- args = line.split()
- test_options = {}
- non_options = []
- use_test = True
- while len(args):
- arg = args.pop(0)
- if arg.startswith("-"):
- if not arg.startswith("--"):
- raise "%s:%d bad option" % (list_filename, line_number)
- option = arg[2:]
- if option == 'slow':
- pass
- elif option == 'min-version' or option == "max-version":
- test_options[option] = args.pop(0)
- else:
- raise Exception("%s:%d unknown option '%s'" % (list_filename, line_number, arg))
- else:
- non_options.append(arg)
- url = "" " ".join(non_options))
-
- if not url.endswith(".txt"):
- if "min-version" in test_options:
- min_version = test_options["min-version"]
- else:
- min_version = hierarchical_options["default-version"]
-
- if "min-version" in GLOBAL_OPTIONS:
- use_test = GreaterThanOrEqualToVersion(min_version, GLOBAL_OPTIONS["min-version"])
- else:
- use_test = GreaterThanOrEqualToVersion(GLOBAL_OPTIONS["version"], min_version)
-
- if not use_test:
- continue
-
- if url.endswith(".txt"):
- if "min-version" in test_options:
- hierarchical_options["default-version"] = test_options["min-version"]
- tests = tests + GetTestList(
- os.path.join(prefix, url), dest_dir, copy.copy(hierarchical_options))
- else:
- tests.append({"url": url})
- return tests
-
-
-def main(argv):
- """This is the main function."""
- global GLOBAL_OPTIONS
-
- parser = OptionParser()
- parser.add_option(
- "-v", "--verbose", action=""
- help="prints more output.")
- parser.add_option(
- "-w", "--webgl-conformance-test", dest="source_dir",
- help="path to webgl conformance tests. REQUIRED")
- parser.add_option(
- "-n", "--no-copy", action=""
- help="do not copy tests")
- parser.add_option(
- "-e", "--generate-expectations", action=""
- help="generatet the test expectations")
- parser.add_option(
- "-o", "--output-dir", dest="output_dir",
- help="base directory for output. defaults to \'.\'",
- default=".")
-
- (options, args) = parser.parse_args(args=argv)
-
- if not options.source_dir:
- parser.print_help()
- return 1
-
- os.chdir(os.path.dirname(__file__) or '.')
-
- source_dir = options.source_dir;
- output_dir = options.output_dir;
- webgl_tests_dir = os.path.join(output_dir, "resources/webgl_test_files")
-
- # copy all the files from the WebGL conformance tests.
- if not options.no_copy:
- CopyTree(
- source_dir, webgl_tests_dir, shutil.ignore_patterns(
- '.git', '*.pyc', 'tmp*'))
-
- test_template = ReadFile("resources/webgl-wrapper-template.html")
- expectation_template = ReadFile("resources/webgl-expectation-template.txt")
-
- # generate wrappers for all the tests
- tests = GetTestList(os.path.join(source_dir, "00_test_list.txt"), ".",
- copy.copy(GLOBAL_OPTIONS))
-
- for test in tests:
- url = "" source_dir)
- dst = os.path.join(output_dir, url)
- dst_dir = os.path.dirname(dst)
- src = "" url), dst_dir).replace("\\", "/")
- base_url = os.path.relpath(output_dir, dst_dir).replace("\\", "/")
- subs = {
- "url": src,
- "url_name": os.path.basename(url),
- "base_url": base_url,
- }
- WriteFile(dst, test_template % subs)
- if options.generate_expectations:
- expectation_filename = os.path.splitext(dst)[0] + "-expected.txt"
- WriteFile(expectation_filename, expectation_template % subs)
-
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
-
-
-
-
-
Deleted: trunk/LayoutTests/webgl/resources/webgl-expectation-template.txt (274517 => 274518)
--- trunk/LayoutTests/webgl/resources/webgl-expectation-template.txt 2021-03-16 21:21:46 UTC (rev 274517)
+++ trunk/LayoutTests/webgl/resources/webgl-expectation-template.txt 2021-03-16 21:27:51 UTC (rev 274518)
@@ -1,5 +0,0 @@
-This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
-
-Test: %(url)s
-[ PASS ] All tests passed
-
Deleted: trunk/LayoutTests/webgl/resources/webgl-wrapper-template.html (274517 => 274518)
--- trunk/LayoutTests/webgl/resources/webgl-wrapper-template.html 2021-03-16 21:21:46 UTC (rev 274517)
+++ trunk/LayoutTests/webgl/resources/webgl-wrapper-template.html 2021-03-16 21:27:51 UTC (rev 274518)
@@ -1,18 +0,0 @@
-<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>WebGL Conformance Test Wrapper for %(url_name)s</title>
-<script type="text/_javascript_" src=""
-<script type="text/_javascript_" src=""
-</head>
-<body>
-<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
-Test: <a href=""
-<div id="iframe">
-<iframe src="" width="800" height="600"></iframe>
-</div>
-<div id="result"></div>
-</body>
-</html>
Modified: trunk/Tools/ChangeLog (274517 => 274518)
--- trunk/Tools/ChangeLog 2021-03-16 21:21:46 UTC (rev 274517)
+++ trunk/Tools/ChangeLog 2021-03-16 21:27:51 UTC (rev 274518)
@@ -1,3 +1,51 @@
+2021-03-16 Kimmo Kinnunen <kkinnu...@apple.com>
+
+ Make WebGL conformance test update script more usable and consistent
+ https://bugs.webkit.org/show_bug.cgi?id=223112
+
+ Reviewed by Kenneth Russell.
+
+ Moves the script LayoutTests/webgl/generate-webgl-tests over
+ unused and stale Tools/Scripts/update-webgl-conformance-tests
+
+ Fixes the script to:
+ - to support generation of the test driver .html files with webglVersion=2
+ - copy the webgl conformance test files once to webgl/resources/webgl_test_files.
+ Previously they were copied twice, 1.0.3/resources/.. and 2.0.0/resources
+ - to support copying all the tests at the same time. Previously each
+ individual suites (1.0.3, 2.0.0) would be copied
+ in different invocations, leading to errors and omissions to run when
+ something changes, such as the templates.
+ - supports generation of the directories from scratch, so that no stale files
+ such as expectations, driver .html files or test suite content is left.
+ - automatically filter files that do not need to be copied (deqp/compiler.jar, ...)
+ - try to adopt a style somewhat consistent with other WebKit python scripts
+ - copy to upcoming 1.0.4 and 2.0.1 instead of old 1.0.3/2.0.0.
+
+ * Scripts/update-webgl-conformance-tests:
+ * Scripts/webkitpy/to_be_moved/__init__.py: Removed.
+ * Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests.py: Removed.
+ * Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests_unittest.py: Removed.
+ * Scripts/webkitpy/update_webgl_conformance_tests_lib/main.py: Added.
+ (_make_ignore_fnmatch_rule_matcher):
+ (_make_ignore_fnmatch_rule_matcher.match_rules):
+ (_copy_tree):
+ (_WebGLTest):
+ (_parse_webgl_tests):
+ (_filter_webgl_test_paths_for_suite_version):
+ (_generate_webkit_webgl_tests):
+ (_find_expectations_for_removed_tests):
+ (main):
+ * Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-expectation-template.txt: Renamed from LayoutTests/webgl/resources/webgl-expectation-template.txt.
+ * Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-test-driver-template.html: Renamed from LayoutTests/webgl/resources/webgl-wrapper-template.html.
+ * Scripts/webkitpy/update_webgl_conformance_tests_lib/webkit-webgl-test-harness-template.js: Added.
+ (window.layoutTestController.window.console.log):
+ (window.layoutTestController.window.console.error):
+ (list):
+ (log):
+ (window.webglTestHarness.reportResults):
+ (window.webglTestHarness.notifyFinished):
+
2021-03-16 John Wilander <wilan...@apple.com>
PCM: Test infrastructure for sending attribution reports to attribution website too
Modified: trunk/Tools/Scripts/update-webgl-conformance-tests (274517 => 274518)
--- trunk/Tools/Scripts/update-webgl-conformance-tests 2021-03-16 21:21:46 UTC (rev 274517)
+++ trunk/Tools/Scripts/update-webgl-conformance-tests 2021-03-16 21:27:51 UTC (rev 274518)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,10 +27,27 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Wrapper around webkitpy/layout_tests/update-webgl-conformance-tests.py"""
+"""Generates WebKit WebGL layout tests from the Khronos WebGL conformance tests"""
-import webkitpy.to_be_moved.update_webgl_conformance_tests
+# To use this, get a copy of the WebGL conformance tests then run this script
+# eg.
+#
+# cd ~/temp
+# git clone git://github.com/KhronosGroup/WebGL.git
+# mkdir backup
+# mv ~/WebKit/LayoutTests/webgl/{1.0.3,2.0.0,sdk} backup/
+# ~/WebKit/Tools/Scripts/update-webgl-conformance-tests ~/temp/WebGL
+# ~/WebKit/Tools/Scripts/run-webkit-tests --debug --webgl --order=random webgl
+# ~/WebKit/Tools/Scripts/run-webkit-tests --release --webgl --order=random webgl
+# ~/WebKit/Tools/Scripts/check-for-duplicated-platform-test-results -n 2>&1 | grep webgl
+# [ Update TestExpectations ]
+# [ Check in the result ]
+#
+# Note: The script is currently not tested to be run on Windows.
+
import sys
+from webkitpy.update_webgl_conformance_tests_lib.main import main
+
if __name__ == '__main__':
- sys.exit(webkitpy.to_be_moved.update_webgl_conformance_tests.main())
+ sys.exit(main())
Added: trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/main.py (0 => 274518)
--- trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/main.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/main.py 2021-03-16 21:27:51 UTC (rev 274518)
@@ -0,0 +1,280 @@
+#!/usr/bin/env python3
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generates WebKit WebGL layout tests from the Khronos WebGL conformance tests
+
+ To use this, get a copy of the WebGL conformance tests then run this script
+ eg.
+ cd ~/temp
+ git clone git://github.com/KhronosGroup/WebGL.git
+ mkdir backup
+ mv ~/WebKit/LayoutTests/webgl/{1.0.4,2.0.1,resources/webgl_test_files} backup
+ generate-webgl-tests ~/temp/WebGL
+ run-webkit-tests --debug --webgl --order=random webgl
+ run-webkit-tests --release --webgl --order=random webgl
+ check-for-duplicated-platform-test-results -n 2>&1 | grep webgl
+ [ Update TestExpectations ]
+ [ Check in the result ]
+"""
+
+# Note: The script is currently not tested to be run on Windows.
+#
+# To add a new WebGL test suite, edit the main().
+#
+# python3 -m mypy main.py && python3 -m black main.py --line-length 200
+
+import argparse
+import os
+import shutil
+import sys
+
+from distutils.version import StrictVersion as Version
+from fnmatch import fnmatch
+from pathlib import Path
+from typing import Callable, Tuple, Iterable, Union, NamedTuple, Optional, Generator
+
+_tool_dir = Path(__file__).parent
+_layout_tests_dir = Path(__file__).parent.parent.parent.parent.parent / "LayoutTests"
+
+_use_verbose_output = False
+
+_IgnoredFilenameMatcher = Callable[[Path], bool]
+
+
+# Creates an ignore file name pattern matcher based on list of match rules.
+# Rule iteration order is the order of least specific to most specific rule.
+# Empty list means do not ignore.
+# If rule is str and it matches, it means ignore if no more specific rule matches.
+# If rule is a tuple and its first element matches, it it means do not ignore if no more specific rule matches.
+def _make_ignore_fnmatch_rule_matcher(rules: Iterable[Union[str, Tuple[str]]]) -> _IgnoredFilenameMatcher:
+ def match_rules(name: Path) -> bool:
+ should_filter = None
+ for rule in rules:
+ pattern: str = rule if isinstance(rule, str) else rule[0]
+ if fnmatch(str(name), pattern):
+ should_filter = isinstance(rule, str)
+ return should_filter is True
+
+ return match_rules
+
+
+_conformance_patterns = _make_ignore_fnmatch_rule_matcher(
+ [
+ ".git",
+ "*.pyc",
+ "tmp*",
+ "*/py/*",
+ "*.py",
+ "*/performance/*",
+ "*/*.md",
+ "*/extra/*",
+ "*/00_test_list.txt",
+ "*/CONFORMANCE_RULES.txt",
+ "*/deqp/build.py",
+ "*/deqp/compiler_additional_extern.js",
+ "*/deqp/compiler.jar",
+ "*/deqp/genHTMLfromTest.py",
+ "*/deqp/run-closure.sh",
+ "*/deqp/temp_externs*",
+ "*/deqp/test-webgl2.js",
+ "*/deqp/test-webgl2.sh",
+ ]
+)
+
+
+def _copy_tree(src: Path, dst: Path, ignore: Optional[_IgnoredFilenameMatcher] = None):
+ """Recursively copy a directory tree"""
+ names = os.listdir(src)
+ for name in names:
+ src_name = src / name
+ dst_name = dst / name
+
+ if src_name.is_dir():
+ _copy_tree(src_name, dst_name, ignore)
+ else:
+ if ignore is not None and ignore(src_name):
+ if _use_verbose_output:
+ print("Ignoring: %s" % (src_name))
+ continue
+ if _use_verbose_output:
+ print("Copying: %s -> %s" % (src_name, dst_name))
+ dst.mkdir(parents=True, exist_ok=True)
+ shutil.copyfile(src_name, dst_name)
+
+
+class _WebGLTest(NamedTuple):
+ path: Path
+ min_version: Version
+ max_version: Version
+
+
+def _parse_webgl_tests(test_list_root: Path, test_list: Path, min_version: Version, max_version: Version) -> Generator[_WebGLTest, None, None]:
+ prefix = test_list.parent
+ with test_list.open("r") as f:
+ lines = f.readlines()
+ for line_number, line in enumerate(lines):
+ line = line.strip()
+ if len(line) <= 0 or line.startswith("#") or line.startswith(";") or line.startswith("//"):
+ continue
+ test_min_version = min_version
+ test_max_version = max_version
+ test_name = ""
+ args = iter(line.split())
+ for arg in args:
+ if arg.startswith("-"):
+ if arg == "--slow":
+ pass
+ elif arg == "--min-version":
+ test_min_version = Version(next(args))
+ elif arg == "--max-version":
+ test_max_version = Version(next(args))
+ else:
+ raise Exception("%s:%d unknown option '%s'" % (test_list, line_number, arg))
+ else:
+ test_name += arg
+
+ if test_name.endswith(".txt"):
+ for r in _parse_webgl_tests(test_list_root, prefix / test_name, test_min_version, test_max_version):
+ yield r
+ else:
+ yield _WebGLTest(
+ (prefix / test_name).relative_to(test_list_root),
+ min_version,
+ max_version,
+ )
+
+
+def _filter_webgl_test_paths_for_suite_version(tests: Iterable[_WebGLTest], suite_version: Version) -> Generator[Path, None, None]:
+ for test in tests:
+ if test.min_version <= suite_version and test.max_version >= suite_version:
+ if _use_verbose_output:
+ print(f"Using test: {test.path} {test.min_version} <= {suite_version} <= {test.max_version}")
+ yield test.path
+ else:
+ if _use_verbose_output:
+ print(f"Ignoring test: {test.path} {test.min_version} <= {suite_version} <= {test.max_version}")
+
+
+def _copy_webgl_test_files(
+ source_tests_dir: Path,
+ source_patterns: _IgnoredFilenameMatcher,
+ target_dir: Path,
+):
+ target_test_files_dir = target_dir / "resources" / "webgl_test_files"
+ _copy_tree(source_tests_dir, target_test_files_dir, source_patterns)
+
+
+def _generate_webkit_webgl_tests(
+ source_tests_dir: Path,
+ suite_version: Version,
+ use_webgl2_context: bool,
+ target_dir: Path,
+):
+ target_test_files_dir = target_dir / "resources" / "webgl_test_files"
+
+ source_js_test_harness = _tool_dir / "webkit-webgl-test-harness-template.js"
+ target_js_test_harness = target_dir / "resources" / "webkit-webgl-test-harness.js"
+ target_js_test_harness.parent.mkdir(parents=True, exist_ok=True)
+ shutil.copyfile(source_js_test_harness, target_js_test_harness)
+
+ test_template = (_tool_dir / "webgl-test-driver-template.html").read_text()
+ expectation_template = (_tool_dir / "webgl-expectation-template.txt").read_text()
+
+ tests = _parse_webgl_tests(source_tests_dir, (source_tests_dir / "00_test_list.txt"), suite_version, suite_version)
+
+ target_tests_dir = target_dir / str(suite_version)
+ for test_path in _filter_webgl_test_paths_for_suite_version(tests, suite_version):
+ target_test = target_tests_dir / test_path
+ target_test_impl = target_test_files_dir / test_path
+ if not target_test_impl.exists():
+ if _use_verbose_output:
+ print(f"Ignoring test: {test_path}, implementation does not exist at {target_test_impl}")
+ continue
+ test_to_impl = os.path.relpath(target_test_impl, target_test.parent)
+ test_file_url = f"{test_to_impl}?webglVersion=2" if use_webgl2_context else test_to_impl
+ subs = {"test_file_url": test_file_url, "test_name": test_path.name, "webgl_top_level_url": os.path.relpath(target_dir, target_test.parent)}
+ target_test.parent.mkdir(parents=True, exist_ok=True)
+ target_test.write_text(test_template % subs)
+ expectation = target_test.parent / f"{target_test.stem}-expected.txt"
+ expectation.write_text(expectation_template % subs)
+
+
+def _find_expectations_for_removed_tests(layout_tests_dir: Path):
+ test_prefixes = set()
+ expectations = set()
+ for root, _, files in os.walk(layout_tests_dir):
+ for file_name in files:
+ relative_path = (Path(root) / file_name).relative_to(layout_tests_dir)
+ if relative_path.stem.endswith("-expected"):
+ expectations.add(relative_path)
+ else:
+ test_prefixes.add(relative_path.parent / relative_path.stem)
+ old_expectations = set([])
+ for expectation in expectations:
+ test_path = expectation.parent
+ while len(test_path.parts) >= 1:
+ test_prefix = test_path / expectation.stem[: -len("-expected")]
+ if test_prefix in test_prefixes:
+ break
+ test_path = Path("/".join(test_path.parts[1:]))
+ if len(test_path.parts) < 1:
+ old_expectations.add(expectation)
+ return old_expectations
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
+ parser.add_argument("-v", "--verbose", action="" help="print verbose output.")
+ parser.add_argument("webgl_repository", help="path to WebGL conformance test repository root.")
+ parser.add_argument(
+ "-l",
+ "--layout-tests-dir",
+ help="base directory for searching for platform specific tests. Defaults to LayoutTests.",
+ default=_layout_tests_dir,
+ )
+
+ options = parser.parse_args()
+ global _use_verbose_output
+ _use_verbose_output = options.verbose or False
+ source_dir = Path(options.webgl_repository)
+ target_dir = Path(options.layout_tests_dir) / "webgl"
+
+ _copy_webgl_test_files(source_tests_dir=source_dir / "sdk" / "tests", source_patterns=_conformance_patterns, target_dir=target_dir)
+ _generate_webkit_webgl_tests(source_tests_dir=source_dir / "sdk" / "tests", suite_version=Version("1.0.4"), use_webgl2_context=False, target_dir=target_dir)
+ _generate_webkit_webgl_tests(source_tests_dir=source_dir / "sdk" / "tests", suite_version=Version("2.0.1"), use_webgl2_context=True, target_dir=target_dir)
+ layout_tests_dir = Path(options.layout_tests_dir)
+
+ old_expectations = _find_expectations_for_removed_tests(layout_tests_dir)
+ old_expectations = [e for e in old_expectations if "webgl" in str(e)]
+ if old_expectations:
+ print("Old expectations maybe found. Maybe do:\n git rm " + " ".join(sorted([str((layout_tests_dir / e).relative_to(layout_tests_dir.parent)) for e in old_expectations])))
+
+
+if __name__ == "__main__":
+ sys.exit(main())
Property changes on: trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/main.py
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Copied: trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-expectation-template.txt (from rev 274517, trunk/LayoutTests/webgl/resources/webgl-expectation-template.txt) (0 => 274518)
--- trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-expectation-template.txt (rev 0)
+++ trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-expectation-template.txt 2021-03-16 21:27:51 UTC (rev 274518)
@@ -0,0 +1,4 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: %(test_file_url)s
+[ PASS ] All tests passed
Added: trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-test-driver-template.html (0 => 274518)
--- trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-test-driver-template.html (rev 0)
+++ trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webgl-test-driver-template.html 2021-03-16 21:27:51 UTC (rev 274518)
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by Tools/Scripts/update-webgl-conformance-tests. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for %(test_name)s</title>
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_" src=""
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href=""
+<div id="iframe">
+<iframe src="" width="800" height="600"></iframe>
+</div>
+<div id="result"></div>
+</body>
+</html>
Added: trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webkit-webgl-test-harness-template.js (0 => 274518)
--- trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webkit-webgl-test-harness-template.js (rev 0)
+++ trunk/Tools/Scripts/webkitpy/update_webgl_conformance_tests_lib/webkit-webgl-test-harness-template.js 2021-03-16 21:27:51 UTC (rev 274518)
@@ -0,0 +1,77 @@
+"use strict";
+(function() {
+ var numFailures = 0;
+ var resultsList = null;
+ var resultNum = 1;
+
+ if (window.testRunner && !window.layoutTestController) {
+ window.layoutTestController = window.testRunner;
+ }
+
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+
+ // Turn off console messages because for the WebGL tests they are
+ // GPU capability dependent.
+ window.console.log = function() { };
+ window.console.error = function() { };
+ }
+
+
+ if (window.internals) {
+ window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+ }
+
+ var list = function(msg, color) {
+ if (!resultsList) {
+ resultsList = document.createElement("ul");
+ document.getElementById("result").appendChild(resultsList);
+ }
+
+ var item = document.createElement("li");
+ item.appendChild(document.createTextNode(msg));
+ if (color) {
+ item.style.color = color;
+ }
+
+ resultsList.appendChild(item);
+ }
+
+ var log = function(msg, color) {
+ var div = document.createElement("div");
+ div.appendChild(document.createTextNode(msg));
+ if (color) {
+ div.style.color = color;
+ }
+ document.getElementById("result").appendChild(div);
+ };
+
+ window.webglTestHarness = {
+ reportResults: function(url, success, msg) {
+ if (success) {
+ list(`[ ${resultNum}: PASS ] ${msg}`, "green");
+ } else {
+ list(`[ ${resultNum}: FAIL ] ${msg}`, "red");
+ ++numFailures;
+ }
+
+ ++resultNum;
+ },
+
+ notifyFinished: function(url) {
+ var iframe = document.getElementById("iframe");
+ if (numFailures > 0) {
+ log(`[ FAIL ] ${numFailures} failures reported`, "red");
+ } else {
+ resultsList.innerHTML = "";
+ iframe.innerHTML = "";
+ log("[ PASS ] All tests passed", "green");
+ }
+
+ if (window.layoutTestController) {
+ layoutTestController.notifyDone();
+ }
+ },
+ }
+}());