blob: e6d8b7c45e0d794cc0fe3b9c86363dd7b379f343 [file] [log] [blame]
Geoffrey Martin-Noble435c2702022-01-24 15:56:56 -08001# 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-Noble435c2702022-01-24 15:56:56 -080013import os
14import tempfile
15
16import lit.formats
17
18config.name = "IREE"
19config.suffixes = [".mlir", ".txt"]
20config.test_format = lit.formats.ShTest(execute_external=True)
Scott Todde4369612022-11-08 15:37:21 -080021
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
25passthrough_env_vars = [
26 # The Vulkan loader uses this
27 "VK_ICD_FILENAMES",
28 # WindowsLinkerTool uses these from vcvarsall
29 "VCTOOLSINSTALLDIR",
30 "UNIVERSALCRTSDKDIR",
Jakub Kuderskibe24f022023-06-21 14:44:18 -040031 "UCRTVERSION",
Scott Todde4369612022-11-08 15:37:21 -080032]
Jakub Kuderskibe24f022023-06-21 14:44:18 -040033config.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-Noble435c2702022-01-24 15:56:56 -080040
41# Use the most preferred temp directory.
Jakub Kuderskibe24f022023-06-21 14:44:18 -040042config.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)