Skip to content

Commit

Permalink
Forward vcvarsall env vars through lit.cfg.py. (#11089)
Browse files Browse the repository at this point in the history
Progress on #11009

This fixes these two tests on Windows:
*
`iree/compiler/Dialect/HAL/Target/LLVM/test/smoketest_system.mlir.test`
* `iree/tests/e2e/regression/libm_linking.mlir.test`

Developers should run vcvarsall before ctest, or configure their IDE as
needed. For VSCode, I have this set:
```json
    "cmakeExplorer.extraCtestEnvVars": {
      "VCTOOLSINSTALLDIR": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\MSVC\\14.31.31103\\",
      "UNIVERSALCRTSDKDIR": "C:\\Program Files (x86)\\Windows Kits\\10\\",
      "UCRTVersion": "10.0.19041.0",
    },
```
  • Loading branch information
ScottTodd authored Nov 8, 2022
1 parent 23a7a3e commit e436961
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions compiler/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@
config.name = "IREE"
config.suffixes = [".mlir", ".txt"]
config.test_format = lit.formats.ShTest(execute_external=True)
# Forward all IREE environment variables
passthrough_env_vars = ["VK_ICD_FILENAMES"]

# Forward all IREE environment variables, as well as some passthroughs.
# Note: env vars are case-insensitive on Windows, so check matches carefully.
# https://stackoverflow.com/q/7797269
passthrough_env_vars = [
# The Vulkan loader uses this
"VK_ICD_FILENAMES",
# WindowsLinkerTool uses these from vcvarsall
"VCTOOLSINSTALLDIR",
"UNIVERSALCRTSDKDIR",
"UCRTVERSION"
]
config.environment.update({
k: v
for k, v in os.environ.items()
Expand Down
14 changes: 12 additions & 2 deletions tests/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@
config.name = "IREE"
config.suffixes = [".mlir", ".txt"]
config.test_format = lit.formats.ShTest(execute_external=True)
# Forward all IREE environment variables
passthrough_env_vars = ["VK_ICD_FILENAMES"]

# Forward all IREE environment variables, as well as some passthroughs.
# Note: env vars are case-insensitive on Windows, so check matches carefully.
# https://stackoverflow.com/q/7797269
passthrough_env_vars = [
# The Vulkan loader uses this
"VK_ICD_FILENAMES",
# WindowsLinkerTool uses these from vcvarsall
"VCTOOLSINSTALLDIR",
"UNIVERSALCRTSDKDIR",
"UCRTVERSION"
]
config.environment.update({
k: v
for k, v in os.environ.items()
Expand Down

0 comments on commit e436961

Please sign in to comment.