1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
# vi: ft=python
import lit.formats
import os
import site
import sys
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(current_dir, '..', '..', '..', '..', 'Tools', 'Scripts'))
from webkitpy.common.host import Host
host = Host()
port = host.port_factory.get()
wgslc = port._build_path('wgslc')
config.name = 'WGSL'
config.suffixes = ['.wgsl']
config.test_format = lit.formats.ShTest(True)
config.test_exec_root = os.environ['LIT_TEST_DIR']
config.environment['DYLD_FRAMEWORK_PATH'] = port._build_path()
# FIXME: fix these so this list is empty
ignored_warnings = [
'-Wno-unused-variable',
'-Wno-unused-function',
'-Wno-missing-braces',
'-Wno-c++17-extensions',
'-Wno-parentheses-equality'
]
config.substitutions.append(('%check', '{}/bin/OutputCheck --comment=".*//" %s'.format(site.getuserbase())))
config.substitutions.append(('%wgslc', '{} %s _ 2>&1'.format(wgslc)))
config.substitutions.append(('%not', 'eval !'))
config.substitutions.append(('%metal-compile', (
"function metal_compile() {"
" set -e -o pipefail;"
f" {wgslc} --dump-generated-code '%s' \"$1\" > '%t.metal' || exit 1;"
f" xcrun -sdk macosx metal -Werror {' '.join(ignored_warnings)} -c '%t.metal' -o /dev/null;"
"};"
"metal_compile ")))
config.substitutions.append(('%metal', '{} --dump-generated-code %s'.format(wgslc)))
|