[all-commits] [llvm/llvm-project] 05d613: [lit][clang] Avoid realpath on Windows due to MAX_...
Saleem Abdulrasool via All-commits
all-commits at lists.llvm.org
Tue Aug 1 11:00:59 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 05d613ea931b6de1b46dfe04b8e55285359047f4
https://github.com/llvm/llvm-project/commit/05d613ea931b6de1b46dfe04b8e55285359047f4
Author: Saleem Abdulrasool <compnerd at compnerd.org>
Date: 2023-08-01 (Tue, 01 Aug 2023)
Changed paths:
M clang/include/clang/Basic/FileManager.h
M clang/lib/Basic/FileManager.cpp
M clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
M clang/test/Lexer/case-insensitive-include-win.c
M llvm/cmake/modules/AddLLVM.cmake
M llvm/docs/CommandGuide/lit.rst
M llvm/docs/TestingGuide.rst
M llvm/utils/lit/lit/TestRunner.py
M llvm/utils/lit/lit/builtin_commands/diff.py
M llvm/utils/lit/lit/discovery.py
M llvm/utils/lit/lit/util.py
M llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py
M llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg
M llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg
M llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg
M llvm/utils/llvm-lit/llvm-lit.in
Log Message:
-----------
[lit][clang] Avoid realpath on Windows due to MAX_PATH limitations
Running lit tests on Windows can fail because its use of
`os.path.realpath` expands substitute drives, which are used to keep
paths short and avoid hitting MAX_PATH limitations.
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.
Also updates clang's `FileManager::getCanonicalName` and `ExtractAPI`
code to avoid resolving substitute drives (i.e. resolving to a path
under a different root).
How tested: built with `-DLLVM_ENABLE_PROJECTS=clang` and built `check-all` on both Windows
Differential Revision: https://reviews.llvm.org/D154130
Reviewed By: @benlangmuir
Patch by Tristan Labelle <tristan at thebrowser.company>!
More information about the All-commits
mailing list