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
I see this uses realpath and that must be intentional.