This is an archive of the discontinued LLVM Phabricator instance.

[lit] Fix testing of standalone clang and lld builds
ClosedPublic

Authored by jhenderson on May 26 2021, 4:53 AM.

Details

Summary

In such cases, the executables are not in the llvm_tools_dir directory, so we need to look in the other search locations. Previously, they were found via the PATH, but this was disabled by default in commit rGa1e6565.

Depends on D103154.

Diff Detail

Event Timeline

jhenderson created this revision.May 26 2021, 4:53 AM
jhenderson requested review of this revision.May 26 2021, 4:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2021, 4:53 AM

Depends on D101354.

Typo?

jhenderson edited the summary of this revision. (Show Details)May 26 2021, 5:32 AM

Depends on D101354.

Typo?

Thanks. Fixed.

D103154 seems to be making a lot of the same changes as this patch.

D103154 seems to be making a lot of the same changes as this patch.

Sorry, I stuffed up the diff in that patch - it shouldn't include the config.py changes. Will fix.

Remove unrelated parts of diff.

Upload correct patch.

thopre accepted this revision.May 27 2021, 1:42 AM

LGTM

This revision is now accepted and ready to land.May 27 2021, 1:42 AM

Rebase. I'll try landing this once the pre-merge checks complete, if there are no objections.

FYI: I'm off next week, so if this doesn't fix things, and the issue is an issue that needs resolving faster, I'd recommend reverting the original change.

kwk added a subscriber: kwk.May 28 2021, 3:55 AM
This comment was removed by kwk.
kwk added a comment.May 28 2021, 4:00 AM

I've applied this patch but for me clang still fails to build. I've build python-lit and clang in revision 1546c52d971292ed4145b6d41aaca0d02229ebff. And applied this patch on top.

[340/341] cd /builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu && /usr/bin/python3.9 /usr/bin/lit -sv --param USE_Z3_SOLVER=0 /builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/tools/extra/test /builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/tools/extra/clangd/test/../unittests /builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/tools/extra/clangd/test /builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/test
lit: /usr/lib/python3.9/site-packages/lit/llvm/config.py:431: fatal: couldn't find 'clang' program, try setting CLANG in your environment
FAILED: CMakeFiles/check-all

These are the clang files in my mock environment:

$ find / -name "clang"
/builddir/build/BUILDROOT/clang-13.0.0~pre20210527.g1546c52d971292-2.fc35.x86_64/usr/lib64/cmake/clang
/builddir/build/BUILDROOT/clang-13.0.0~pre20210527.g1546c52d971292-2.fc35.x86_64/usr/lib64/clang
/builddir/build/BUILDROOT/clang-13.0.0~pre20210527.g1546c52d971292-2.fc35.x86_64/usr/lib/python3.9/site-packages/clang
/builddir/build/BUILDROOT/clang-13.0.0~pre20210527.g1546c52d971292-2.fc35.x86_64/usr/bin/clang
/builddir/build/BUILDROOT/clang-13.0.0~pre20210527.g1546c52d971292-2.fc35.x86_64/usr/include/clang
/builddir/build/BUILDROOT/clang-13.0.0~pre20210527.g1546c52d971292-2.fc35.x86_64/usr/share/doc/clang
/builddir/build/BUILDROOT/clang-13.0.0~pre20210527.g1546c52d971292-2.fc35.x86_64/usr/share/clang
/builddir/build/BUILD/clang-13.0.0.src/test/Tooling/Inputs/mock-libcxx/bin/clang
/builddir/build/BUILD/clang-13.0.0.src/test/Driver/Inputs/mips_mti_linux/lib/clang
/builddir/build/BUILD/clang-13.0.0.src/include/clang
/builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/lib64/cmake/clang
/builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/lib64/clang
/builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/cmake/modules/CMakeFiles/Export/lib64/cmake/clang
/builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/bin/clang
/builddir/build/BUILD/clang-13.0.0.src/x86_64-redhat-linux-gnu/include/clang
/builddir/build/BUILD/clang-13.0.0.src/bindings/python/clang
/builddir/build/BUILD/clang-tools-extra-13.0.0.src/test/clang-tidy/checkers/Inputs/Headers/clang
/builddir/build/BUILD/clang-tools-extra-13.0.0.src/test/clang-tidy/infrastructure/Inputs/mock-libcxx/bin/clang

Ah, I see I missed that paths is reused in use_clang, before the call to use_llvm_tool. I'll fix that now.

Use the right set of paths in use_clang. This should fix the issue. If it doesn't I'll need someone who can reproduce to dig more into why it doesn't.

@kwk, could you try again please with the latest version of the patch? The code now looks at the same paths as are added to the PATH environment variable, so it should work.

thopre accepted this revision.May 28 2021, 4:35 AM

New change LGTM, provided @kwk confirms it works for him.

kwk added a comment.May 28 2021, 2:59 PM

@jhenderson @thopre it works for me now! Thank you!

@jhenderson @thopre it works for me now! Thank you!

Great, thanks for letting me know. I'm not going to be at a computer to be able to land this for the next week, so someone else can on my behalf if they wish. Otherwise it will be in a bit over a week's time before I do.

This revision was automatically updated to reflect the committed changes.
llvm/utils/lit/tests/use-llvm-tool.py