[clang] [cmake] Refactor clang unittest cmake (PR #133545)

LLVM Continuous Integration via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 1 15:43:46 PDT 2025


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-ppc64le-linux-multistage` running on `ppc64le-clang-multistage-test` while building `clang` at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/8375

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:445:12:   required from ‘testing::internal::TestFactoryBase* testing::internal::TestMetaFactory<TestSuite>::CreateTestFactory(testing::internal::TestMetaFactory<TestSuite>::ParamType) [with TestSuite = clang::tidy::test::SizeTest_TokenSize_Test; testing::internal::TestMetaFactory<TestSuite>::ParamType = clang::tidy::test::{anonymous}::SizeParam]’
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:444:20:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:399:7: warning: ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::SizeTest_TokenSize_Test>’ has a field ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::SizeTest_TokenSize_Test>::parameter_’ whose type uses the anonymous namespace [-Wsubobject-linkage]
 class ParameterizedTestFactory : public TestFactoryBase {
       ^~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h: In instantiation of ‘class testing::internal::ParameterizedTestFactory<clang::tidy::test::MatcherTest_MatchResult_Test>’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:445:12:   required from ‘testing::internal::TestFactoryBase* testing::internal::TestMetaFactory<TestSuite>::CreateTestFactory(testing::internal::TestMetaFactory<TestSuite>::ParamType) [with TestSuite = clang::tidy::test::MatcherTest_MatchResult_Test; testing::internal::TestMetaFactory<TestSuite>::ParamType = clang::tidy::test::{anonymous}::MatchParam]’
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:444:20:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:399:7: warning: ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::MatcherTest_MatchResult_Test>’ has a field ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::MatcherTest_MatchResult_Test>::parameter_’ whose type uses the anonymous namespace [-Wsubobject-linkage]
[1116/1221] Linking CXX executable tools/clang/unittests/AST/ByteCode/InterpTests
FAILED: tools/clang/unittests/AST/ByteCode/InterpTests 
: && /usr/lib64/ccache/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -Wl,--gc-sections tools/clang/unittests/AST/ByteCode/CMakeFiles/InterpTests.dir/BitcastBuffer.cpp.o tools/clang/unittests/AST/ByteCode/CMakeFiles/InterpTests.dir/Descriptor.cpp.o tools/clang/unittests/AST/ByteCode/CMakeFiles/InterpTests.dir/toAPValue.cpp.o -o tools/clang/unittests/AST/ByteCode/InterpTests  -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib  -lpthread  lib/libllvm_gtest_main.so.21.0git  -lpthread  lib/libclangTesting.so.21.0git  lib/libclangTooling.so.21.0git  lib/libllvm_gtest.so.21.0git  lib/libclangFrontend.so.21.0git  lib/libclangSerialization.so.21.0git  lib/libclangASTMatchers.so.21.0git  lib/libclangAST.so.21.0git  lib/libclangBasic.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib && :
/usr/bin/ld: tools/clang/unittests/AST/ByteCode/CMakeFiles/InterpTests.dir/Descriptor.cpp.o: undefined reference to symbol '_ZN4llvm3omp27isAllowedClauseForDirectiveENS0_9DirectiveENS0_6ClauseEj'
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib/libLLVMFrontendOpenMP.so.21.0git: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[1126/1221] cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/bindings/python && /home/buildbots/llvm-external-buildbots/cmake-3.31.2/bin/cmake -E env CLANG_NO_DEFAULT_CONFIG=1 CLANG_LIBRARY_PATH=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib /home/buildbots/llvm-external-buildbots/workers/env/bin/python3.8 -m unittest discover
.............................................................................................................................................................
----------------------------------------------------------------------
Ran 157 tests in 3.027s

OK
[1188/1221] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/SymbolCollectorTests.cpp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::SymbolCollectorTest_SpelledReferences_Test::TestBody()’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:1148:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
     if (!SpelledRanges.empty())
        ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:1151:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
     if (!ImplicitRanges.empty())
        ^
[1203/1221] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/TUSchedulerTests.cpp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::TUSchedulerTests_PublishWithStalePreamble_Test::TestBody()::BlockPreambleThread::onPreambleAST(clang::clangd::PathRef, llvm::StringRef, clang::clangd::CapturedASTCtx, std::shared_ptr<const clang::include_cleaner::PragmaIncludes>)’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp:1219:10: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
       if (BuildBefore)
          ^
[1209/1221] Linking CXX executable unittests/ADT/ADTTests
[1211/1221] Linking CXX executable tools/clang/unittests/ASTMatchers/ASTMatchersTests
[1212/1221] Linking CXX executable tools/clang/unittests/Analysis/FlowSensitive/ClangAnalysisFlowSensitiveTests
[1213/1221] Linking CXX executable tools/clang/unittests/Tooling/ToolingTests
ninja: build stopped: subcommand failed.

```

</details>

https://github.com/llvm/llvm-project/pull/133545


More information about the cfe-commits mailing list