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>
diff --git a/webgpu-cts/scripts/tsc_ignore_errors.py b/webgpu-cts/scripts/tsc_ignore_errors.py new file mode 100755 index 0000000..14b8455 --- /dev/null +++ b/webgpu-cts/scripts/tsc_ignore_errors.py
@@ -0,0 +1,51 @@ +#!/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 subprocess +import sys +import os + +from dir_paths import node_dir + +try: + old_sys_path = sys.path + sys.path = [node_dir] + sys.path + + from node import GetBinaryPath as get_node_binary_path +finally: + sys.path = old_sys_path + +tsc = os.path.join(node_dir, 'node_modules', 'typescript', 'lib', 'tsc.js') + + +def run_tsc_ignore_errors(args): + cmd = [get_node_binary_path(), tsc] + args + process = subprocess.Popen(cmd, + cwd=os.getcwd(), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + stdout, stderr = process.communicate() + + # Typecheck errors go in stdout, not stderr. If we see something in stderr, raise an error. + if len(stderr): + raise RuntimeError('tsc \'%s\' failed\n%s' % (' '.join(cmd), stderr)) + + return stdout + + +if __name__ == '__main__': + run_tsc_ignore_errors(sys.argv[1:])