[PATCH] D154130: [lit] Avoid os.path.realpath on Windows due to MAX_PATH limitations

Tristan Labelle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 29 11:30:00 PDT 2023


MrTrillian created this revision.
MrTrillian added reviewers: rnk, compnerd, nlopes, Jake-Egan.
Herald added a subscriber: delcypher.
Herald added a reviewer: ributzka.
Herald added a project: All.
MrTrillian requested review of this revision.
Herald added a reviewer: dang.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Changes lit logic to:

- Use `os.path.abspath` on Windows, where MAX_PATH is a concern that we can work around using substitute drives, which `os.path.realpath` would resolve.
- Use `os.path.realpath` on Unix, where the current directory always has symlinks resolved, so it is impossible to preserve symlinks in the presence of relative paths, and so we must make sure that all code paths use real paths.

Unfortunately, clang has `ModuleMap::canonicalizeModuleMapPath` which resolves the real path, so several tests had to be made aware that modulemap paths are special and need resolved paths. This required adding `%>/t` to `lit` to expand paths and normalize directory separators.

This is an updated version of https://reviews.llvm.org/D152709

How tested: built with `-DLLVM_ENABLE_PROJECTS=clang` and built `check-all` on both Windows and Linux (WSL-Ubuntu)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154130

Files:
  clang/test/ClangScanDeps/diagnostics.c
  clang/test/ClangScanDeps/header-search-pruning-transitive.c
  clang/test/ClangScanDeps/modules-context-hash.c
  clang/test/ClangScanDeps/modules-dep-args.c
  clang/test/ClangScanDeps/modules-excluded-header.m
  clang/test/ClangScanDeps/modules-extern-submodule.c
  clang/test/ClangScanDeps/modules-extern-unrelated.m
  clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
  clang/test/ClangScanDeps/modules-full.cpp
  clang/test/ClangScanDeps/modules-implementation-private.m
  clang/test/ClangScanDeps/modules-implementation-vfs.m
  clang/test/ClangScanDeps/modules-implicit-dot-private.m
  clang/test/ClangScanDeps/modules-incomplete-umbrella.c
  clang/test/ClangScanDeps/modules-inferred.m
  clang/test/ClangScanDeps/modules-no-undeclared-includes.c
  clang/test/ClangScanDeps/modules-pch-common-submodule.c
  clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
  clang/test/ClangScanDeps/modules-pch-imports.c
  clang/test/ClangScanDeps/modules-pch.c
  clang/test/ClangScanDeps/modules-redefinition.m
  clang/test/ClangScanDeps/modules-symlink-dir-from-module.c
  clang/test/ClangScanDeps/modules-symlink-dir.c
  clang/test/ClangScanDeps/modules-transitive.c
  clang/test/ClangScanDeps/multiple-commands.c
  clang/test/ClangScanDeps/removed-args.c
  clang/test/ExtractAPI/relative_include.m
  clang/test/Lexer/case-insensitive-include-win.c
  clang/test/VFS/module-header-mismatches.m
  llvm/cmake/modules/AddLLVM.cmake
  llvm/utils/lit/lit/LitConfig.py
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/lit/builtin_commands/diff.py
  llvm/utils/lit/lit/cl_arguments.py
  llvm/utils/lit/lit/discovery.py
  llvm/utils/lit/lit/util.py
  llvm/utils/lit/setup.py
  llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py
  llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg
  llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg
  llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg
  llvm/utils/lit/tests/lit.cfg
  llvm/utils/llvm-lit/llvm-lit.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154130.535928.patch
Type: text/x-patch
Size: 67340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230629/18517b6a/attachment-0001.bin>


More information about the cfe-commits mailing list