Skip to content

Commit 6a6343e

Browse files
JDevliegheregithub-actions[bot]
authored andcommitted
Automerge: [lldb] Enforce that only the LLDB API unit tests can link liblldb (#162384)
Enforce that only specific tests can link liblldb. All the other unit tests statically link the private libraries. Linking both the static libraries and liblldb results in duplicated symbols. Fixes #162378
2 parents 23525f6 + 02572c6 commit 6a6343e

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

lldb/unittests/API/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ add_lldb_unittest(APITests
33
SBLineEntryTest.cpp
44
SBMutexTest.cpp
55

6+
SBAPITEST
7+
68
LINK_LIBS
79
liblldb
810
)

lldb/unittests/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endif()
1212

1313
function(add_lldb_unittest test_name)
1414
cmake_parse_arguments(ARG
15-
""
15+
"SBAPITEST"
1616
""
1717
"LINK_LIBS;LINK_COMPONENTS"
1818
${ARGN})
@@ -21,6 +21,10 @@ function(add_lldb_unittest test_name)
2121
message(FATAL_ERROR "Unit test name must end with 'Tests' for lit to find it.")
2222
endif()
2323

24+
if ("liblldb" IN_LIST ARG_LINK_LIBS AND NOT ARG_SBAPITEST)
25+
message(FATAL_ERROR "The ${test_name} are not allowed to link liblldb.")
26+
endif()
27+
2428
list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
2529

2630
add_unittest(LLDBUnitTests

lldb/unittests/DAP/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ add_lldb_unittest(DAPTests
1212
TestBase.cpp
1313
VariablesTest.cpp
1414

15+
SBAPITEST
16+
1517
LINK_COMPONENTS
1618
Support
1719
LINK_LIBS

0 commit comments

Comments
 (0)