Skip to content

Commit 80bda29

Browse files
rshoumikhin
authored andcommitted
Document the re2 guard and the shared-build registry ordering
The re2-guarded suite links neither re2 nor etdump_filter.cpp, so it cannot link where re2::re2 does exist. That predates this change, which only narrows when it is attempted; say so rather than implying the branch is merely rare. Also record why the two new tests do not call executorch_target_link_shared_runtime: the root CMakeLists adds devtools before it defines executorch_shared, so the target does not exist at that point. They run under Buck and the default static CMake build, which have a single registry.
1 parent 7f7c703 commit 80bda29

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

‎devtools/etdump/tests/CMakeLists.txt‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,18 @@ include(${EXECUTORCH_ROOT}/tools/cmake/Test.cmake)
1919

2020
set(_test_srcs etdump_test.cpp)
2121

22-
# etdump_test.cpp includes etdump_filter.h, which needs re2, and the devtools
23-
# build does not pull re2 in.
22+
# etdump_test.cpp includes etdump_filter.h, which includes <re2/re2.h>. re2 only
23+
# reaches CMake through the tokenizers submodule, which a default checkout does
24+
# not populate, so re2::re2 usually does not exist and this suite is skipped
25+
# here. Buck builds it unconditionally, which is where it runs today.
26+
#
27+
# The guard is not sufficient on its own: this target links neither re2 nor
28+
# etdump_filter.cpp (the etdump library does not compile that file), so where
29+
# re2::re2 does exist the suite fails to link. That predates this file's change,
30+
# which only narrows when it is attempted. Fixing it properly means adding
31+
# etdump_filter.cpp to the etdump library and re2 to EXTRA_LIBS.
32+
#
33+
# The two tests below avoid etdump_filter.h so they always build.
2434
if(TARGET re2::re2)
2535
et_cxx_test(
2636
sdk_etdump_tests
@@ -45,3 +55,15 @@ et_cxx_test(
4555
etdump_device_no_allocator_test SOURCES etdump_device_no_allocator_test.cpp
4656
EXTRA_LIBS etdump flatccrt
4757
)
58+
59+
# These two register a device allocator and then call into etdump, which reads
60+
# it back out of the registry. et_cxx_test links the static executorch_core, so
61+
# in a shared build, where etdump resolves the runtime from libexecutorch.so,
62+
# the archive would win the runtime symbols and the test would hold a private
63+
# registry (Utils.cmake documents that ordering). The usual remedy,
64+
# executorch_target_link_shared_runtime, cannot be called from here: the root
65+
# CMakeLists adds devtools well before it defines executorch_shared, so the
66+
# target does not exist yet at this point. These tests are run by the Buck
67+
# targets and by the default static CMake build, both of which have one
68+
# registry; a shared-build CMake run of them needs that ordering addressed
69+
# first.

0 commit comments

Comments
 (0)