| # 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-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))) |