mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Add CTS telemetry harness support
Migrates harness support files added in https://chromium-review.googlesource.com/c/chromium/src/+/3541414 into Dawn's repo. Tested in https://chromium-review.googlesource.com/c/chromium/src/+/3537743 Bug: chromium:1306640 Change-Id: I3000b1223219a1da293af910bf442570b70b7c92 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84043 Reviewed-by: Loko Kung <lokokung@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
70
webgpu-cts/scripts/list.py
Executable file
70
webgpu-cts/scripts/list.py
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2022 The Dawn Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from dir_paths import node_dir
|
||||
|
||||
from compile_src import compile_src_for_node
|
||||
|
||||
|
||||
def list_testcases(query, js_out_dir=None):
|
||||
if js_out_dir is None:
|
||||
js_out_dir = tempfile.mkdtemp()
|
||||
delete_js_out_dir = True
|
||||
else:
|
||||
delete_js_out_dir = False
|
||||
|
||||
try:
|
||||
logging.info('WebGPU CTS: Transpiling tools...')
|
||||
compile_src_for_node(js_out_dir, [
|
||||
'--incremental', '--tsBuildInfoFile',
|
||||
os.path.join(js_out_dir, 'build.tsbuildinfo')
|
||||
],
|
||||
clean=False)
|
||||
|
||||
old_sys_path = sys.path
|
||||
try:
|
||||
sys.path = old_sys_path + [node_dir]
|
||||
from node import RunNode
|
||||
finally:
|
||||
sys.path = old_sys_path
|
||||
|
||||
return RunNode([
|
||||
os.path.join(js_out_dir, 'common', 'runtime', 'cmdline.js'), query,
|
||||
'--list'
|
||||
])
|
||||
finally:
|
||||
if delete_js_out_dir:
|
||||
shutil.rmtree(js_out_dir)
|
||||
|
||||
|
||||
# List all testcases matching a test query.
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--query', default='webgpu:*', help='WebGPU CTS Query')
|
||||
parser.add_argument(
|
||||
'--js-out-dir',
|
||||
default=None,
|
||||
help='Output directory for intermediate compiled JS sources')
|
||||
args = parser.parse_args()
|
||||
|
||||
print(list_testcases(args.query, args.js_out_dir))
|
||||
Reference in New Issue
Block a user