Geoffrey Martin-Noble | 435c270 | 2022-01-24 15:56:56 -0800 | [diff] [blame] | 1 | # Copyright 2022 The IREE Authors |
| 2 | # |
| 3 | # Licensed under the Apache License v2.0 with LLVM Exceptions. |
| 4 | # See https://llvm.org/LICENSE.txt for license information. |
| 5 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | """Lit config for IREE.""" |
| 7 | |
| 8 | # Lint for undefined variables is disabled as config is not defined inside this |
| 9 | # file, instead config is injected by way of evaluating runlit.cfg.py from |
| 10 | # runlit.site.cfg.py which in turn is evaluated by lit.py. |
| 11 | # pylint: disable=undefined-variable |
| 12 | |
Geoffrey Martin-Noble | 435c270 | 2022-01-24 15:56:56 -0800 | [diff] [blame] | 13 | import os |
| 14 | import tempfile |
| 15 | |
| 16 | import lit.formats |
| 17 | |
| 18 | config.name = "IREE" |
| 19 | config.suffixes = [".mlir", ".txt"] |
| 20 | config.test_format = lit.formats.ShTest(execute_external=True) |
Scott Todd | e436961 | 2022-11-08 15:37:21 -0800 | [diff] [blame] | 21 | |
| 22 | # Forward all IREE environment variables, as well as some passthroughs. |
| 23 | # Note: env vars are case-insensitive on Windows, so check matches carefully. |
| 24 | # https://stackoverflow.com/q/7797269 |
| 25 | passthrough_env_vars = [ |
| 26 | # The Vulkan loader uses this |
| 27 | "VK_ICD_FILENAMES", |
| 28 | # WindowsLinkerTool uses these from vcvarsall |
| 29 | "VCTOOLSINSTALLDIR", |
| 30 | "UNIVERSALCRTSDKDIR", |
Jakub Kuderski | be24f02 | 2023-06-21 14:44:18 -0400 | [diff] [blame] | 31 | "UCRTVERSION", |
Scott Todd | e436961 | 2022-11-08 15:37:21 -0800 | [diff] [blame] | 32 | ] |
Jakub Kuderski | be24f02 | 2023-06-21 14:44:18 -0400 | [diff] [blame] | 33 | config.environment.update( |
| 34 | { |
| 35 | k: v |
| 36 | for k, v in os.environ.items() |
| 37 | if k.startswith("IREE_") or k in passthrough_env_vars |
| 38 | } |
| 39 | ) |
Geoffrey Martin-Noble | 435c270 | 2022-01-24 15:56:56 -0800 | [diff] [blame] | 40 | |
| 41 | # Use the most preferred temp directory. |
Jakub Kuderski | be24f02 | 2023-06-21 14:44:18 -0400 | [diff] [blame] | 42 | config.test_exec_root = ( |
| 43 | os.environ.get("TEST_UNDECLARED_OUTPUTS_DIR") |
| 44 | or os.environ.get("TEST_TMPDIR") |
| 45 | or os.path.join(tempfile.gettempdir(), "lit") |
| 46 | ) |