Stella Laurenzo | 9bde61b | 2022-04-21 15:37:14 -0700 | [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 | |
| 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) |
| 21 | # Forward all IREE environment variables |
| 22 | passthrough_env_vars = ["VK_ICD_FILENAMES"] |
Jakub Kuderski | be24f02 | 2023-06-21 14:44:18 -0400 | [diff] [blame] | 23 | config.environment.update( |
| 24 | { |
| 25 | k: v |
| 26 | for k, v in os.environ.items() |
| 27 | if k.startswith("IREE_") or k in passthrough_env_vars |
| 28 | } |
| 29 | ) |
Stella Laurenzo | 9bde61b | 2022-04-21 15:37:14 -0700 | [diff] [blame] | 30 | |
| 31 | # Use the most preferred temp directory. |
Jakub Kuderski | be24f02 | 2023-06-21 14:44:18 -0400 | [diff] [blame] | 32 | config.test_exec_root = ( |
| 33 | os.environ.get("TEST_UNDECLARED_OUTPUTS_DIR") |
| 34 | or os.environ.get("TEST_TMPDIR") |
| 35 | or os.path.join(tempfile.gettempdir(), "lit") |
| 36 | ) |