[all-commits] [llvm/llvm-project] c1cf45: [lit] Avoid os.path.realpath in lit.py due to MAX_...

Saleem Abdulrasool via All-commits all-commits at lists.llvm.org
Wed Jun 14 11:36:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c1cf459cbd79cc7d6ca834390649fb9185a4b237
      https://github.com/llvm/llvm-project/commit/c1cf459cbd79cc7d6ca834390649fb9185a4b237
  Author: Saleem Abdulrasool <compnerd at compnerd.org>
  Date:   2023-06-14 (Wed, 14 Jun 2023)

  Changed paths:
    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/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

  Log Message:
  -----------
  [lit] Avoid os.path.realpath in lit.py due to MAX_PATH limitations on Windows

lit.py uses os.path.realpath on file paths. Somewhere between Python 3.7
and 3.9, os.path.realpath was updated to resolve substitute drives on
Windows (subst S: C:\Long\Path\To\My\Code). This is a problem because it
prevents using substitute drives to work around MAX_PATH path length
limitations on Windows.

We run into this while building & testing, the Swift compiler on
Windows, which uses a substitute drive in CI to shorten the workspace
directory. cmake builds without resolving the substitute drive and can
apply its logic to avoid output files exceeding MAX_PATH. However, when
running tests, lit.py's use of os.path.realpath will resolve the
substitute drive (with newer Python versions), resulting in some paths
being longer than MAX_PATH, which cause all kinds of failures (for
example rd in tests fails, or link.exe fails, etc).

How tested: Ran check-all, and lit tests, saw no failures
```
> ninja -C build check-all
Testing Time: 262.63s
  Skipped          :    24
  Unsupported      :  2074
  Passed           : 51812
  Expectedly Failed:   167

> python utils\lit\lit.py --path ..\build\bin utils\lit\tests
Testing Time: 12.17s
  Unsupported:  6
  Passed     : 47
```

Patch by Tristan Labelle!

Differential Revision: https://reviews.llvm.org/D152709
Reviewed By: rnk, compnerd




More information about the All-commits mailing list