Skip to content

[bazel] Fix LLVM plugin tests under Analysis. #142999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged

[bazel] Fix LLVM plugin tests under Analysis. #142999

merged 1 commit into from
Jun 5, 2025

Conversation

wecing
Copy link
Contributor

@wecing wecing commented Jun 5, 2025

Those tests were broken on bazel as a side effect of 8830e38.

This commit is tested with this command on Linux:

bazelisk test \
    @llvm-project//llvm/unittests:analysis_tests \
    @llvm-project//llvm/unittests:plugin_inline_advisor_analysis_test \
    @llvm-project//llvm/unittests:plugin_inline_order_analysis_test

Those tests were broken on bazel as a side effect of 8830e38.

This commit is tested with this command on Linux:

    bazelisk test \
        @llvm-project//llvm/unittests:analysis_tests \
        @llvm-project//llvm/unittests:plugin_inline_advisor_analysis_test \
        @llvm-project//llvm/unittests:plugin_inline_order_analysis_test
@llvmbot llvmbot added the bazel "Peripheral" support tier build system: utils/bazel label Jun 5, 2025
Copy link
Collaborator

@rupprecht rupprecht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar w/ LLVM_ENABLE_PLUGINS, but if the tests pass, then sure?

FYI @chapuni who might know more about the failures

@wecing
Copy link
Contributor Author

wecing commented Jun 5, 2025

I'm not familiar w/ LLVM_ENABLE_PLUGINS, but if the tests pass, then sure?

FYI @chapuni who might know more about the failures

Thanks for the review. Since this only affects bazel and the tests were broken before, I feel this commit should be safe to submit.

It is currently 2AM in Japan so I don't think @chapuni will be able to respond soon. Let me submit this commit now to avoid other issues being hidden under it.

@wecing wecing merged commit 9eb90c2 into llvm:main Jun 5, 2025
10 of 11 checks passed
Copy link
Contributor

@chapuni chapuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wecing Thanks and sorry for that. I was not aware of bazel cc_test.

Comment on lines +122 to +127
# These tests dynamically load Plugins which both pull in
# llvm/lib/Analysis/ProfileSummaryInfo.cpp, which registers flags;
# if built into the same cc_test target, those flags will be
# registered twice and cause runtime failures.
"Analysis/PluginInlineAdvisorAnalysisTest.cpp",
"Analysis/PluginInlineOrderAnalysisTest.cpp",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me investigate further later,

Comment on lines +39 to +44
deps = [
"//llvm:Analysis",
"//llvm:Core",
"//llvm:Passes",
"//llvm:Support",
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be handled as "interface libs". Plugins shouldn't link them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugins shouldn't link them.

Actually, I just realized this is why I had to use separate targets for the plugin tests; if they are not linked into the plugins, there would be no duplicate flag registrations.

The right way to do this, is probably to introduce header-only versions of these four dependencies, and use them to build the plugin. But since these are just tests, I guess we are somewhat fine here...?

rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
Those tests were broken on bazel as a side effect of 8830e38.

This commit is tested with this command on Linux:

    bazelisk test \
        @llvm-project//llvm/unittests:analysis_tests \
@llvm-project//llvm/unittests:plugin_inline_advisor_analysis_test \
        @llvm-project//llvm/unittests:plugin_inline_order_analysis_test
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
Those tests were broken on bazel as a side effect of 8830e38.

This commit is tested with this command on Linux:

    bazelisk test \
        @llvm-project//llvm/unittests:analysis_tests \
@llvm-project//llvm/unittests:plugin_inline_advisor_analysis_test \
        @llvm-project//llvm/unittests:plugin_inline_order_analysis_test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants