I've been able to run lit tests in the past successfully, however, this time after rebuilding the compiler (macOS) and invoking lit I'm stuck wtih an error.
lit.py: /Users/jan/Downloads/Dev/swift-project/llvm-project/llvm/utils/lit/lit/TestingConfig.py:152: fatal: unable to parse config file '/Users/jan/Downloads/Dev/swift-project/build/Ninja-DebugAssert/swift-macosx-arm64/test-macosx-arm64/lit.site.cfg', traceback: Traceback (most recent call last):
...
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jan/Downloads/Dev/swift-project/build/Ninja-DebugAssert/swift-macosx-arm64/test-macosx-arm64/lit.swift-features.cfg'
It mentions that I'm missing the lit.swift-features.cfg. I tried update-checkout from the build script, removed the build dir and built again, but that did not resolve it.
I simply followed the getting started page like last time:
Update: Still encounter the error unfortunately. I'm going to rm the build dir, update checkout again and try again with the flags mentioned. Will update
Update2: Error strangely persists :/ The output is exactly the same as shown here
Maybe I can try with just --test? Because that was what had worked for the commentor in the PR comment section
I actually faced the same issue recently, while the reconfigure should help I've not actually confirmed that yet.
If you'd like a silly workaround you can always just remove the lit.py: /Users/jan/Downloads/Dev/swift-project/llvm-project/llvm/utils/lit/lit/TestingConfig.py:152 line and it'll work just fine.
But we need to figure out so it perhaps just does configure the right way by default tbh.
i ran into this today as well – filed this issue regarding the problem. running once with --test resolved the issue for me (killed the build script after the tests attempted to run though).
Thanks for the suggestion, I tried removing the line you mentioned but I ended up running into another issue. Here's what I got:
File "/Users/jan/Downloads/Dev/swift-project/llvm-project/llvm/utils/lit/lit/worker.py", line 76, in _execute_test_handle_errors
result = test.config.test_format.execute(test, lit_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'execute'
It seems like something might still be misconfigured since test_format is coming back as None.
Executing lit directly with Python will not make the CMake dependencies system rebuild the necessary parts.
The recommended ways in the the guide are using run-test or CMake. Using lit.py directly is part of the guide, but one needs to have setup the build before using it, or most of the dependencies would not be built.
The line hamishknight provides using ninja is basically what run-test and CMake will do for you. There's a target check-swift-… which depends on swift-…-test-depends. The lit.site.cfg that needed to be generated and the new lit.swift-features.cfg are part of swift-…-test-depends. When one uses CMake to start the tests, they will be rebuild and regenerated. When one uses lit.py directly, you are skipping all the dependencies.
FWIW, I usually use utils/run-test and I've noticed recently that it doesn't always cause lit.swift-features.cfg to be regenerated. When this has happened for me, running utils/build-script ... --test and then killing it once the tests have started is usually enough to fix it.
I haven't pinned down the conditions that have caused the file to be missing, though.