Skip to content

Commit

Permalink
i#2154 Android64: Get tests building (#7201)
Browse files Browse the repository at this point in the history
Made some tweaks to the CMake scripts to get the test suite building for
Android:

- Drmemtrace is not currently built for Android so we need to disable
some tests which depend on it when building for Android (rseq).

- Build linux.infloop test binary because it compiles fine for Android
and other CMake code expects the target to exist.

- Removed --dynamic-list-data because it is not needed with the latest
NDK toolchains.

- Copy `run_in_bg` tool to the Android test device because it is needed
by some tests.

It should now be possible to build for Android64 with -DBUILD_TESTS=ON
using the latest Android ndk (tested with r27c).

Issues: #2154, #1874
  • Loading branch information
jackgallagher-arm authored Jan 22, 2025
1 parent 2fba06e commit 3521f0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
7 changes: 0 additions & 7 deletions make/DynamoRIOConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,6 @@ function (configure_DynamoRIO_static target)
endif ()
_DR_append_property_list(TARGET ${target} COMPILE_DEFINITIONS "${extra_defs}")

if (ANDROID)
# The Android linker is not exporting the weak symbol _USES_DR_VERSION_.
# We use --dynamic-list-data to do so.
# Actually the Linux linker is exporting the entire DR API symbol set:
# should we pass -Wl,--export-dynamic here to match it?
_DR_append_property_string(TARGET ${target} LINK_FLAGS "-Wl,--dynamic-list-data")
endif ()
# We need libc before the ntdll_imports pulled in for DR.
_DR_get_static_libc_list(static_libc)
target_link_libraries(${target} ${static_libc})
Expand Down
14 changes: 7 additions & 7 deletions suite/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,7 @@ if (BUILD_CLIENTS)
endif ()
endif ()

if (AARCH64 AND UNIX AND ZLIB_FOUND)
if (AARCH64 AND UNIX AND ZLIB_FOUND AND NOT ANDROID) # TODO i#1874: Add drcachesim support on Android
# Test TLB simulator with a virtual to physical v2p.textproto mapping.
set(srcdir
${PROJECT_SOURCE_DIR}/clients/drcachesim/tests/drmemtrace.threadsig.aarch64.raw)
Expand Down Expand Up @@ -5689,10 +5689,8 @@ if (UNIX)
# this app is used in nudge tests
# XXX: should all these infloop tests be made cross-platform?
# or rely on runall tests that run calc covering this on Windows?
if (NOT ANDROID) # XXX i#1874: add support for running this on Android
add_exe(linux.infloop linux/infloop.c)
torunonly(linux.reset linux/infloop linux/reset.runall "-enable_reset" "-v")
endif ()
add_exe(linux.infloop linux/infloop.c)
torunonly(linux.reset linux/infloop linux/reset.runall "-enable_reset" "-v")
if (NOT X64 AND NOT ARM) # FIXME i#1551: add coarse-grain ARM support
# XXX: 64-bit support not quite there yet
torunonly(linux.freeze_FLAKY linux/infloop linux/freeze.runall
Expand All @@ -5712,10 +5710,11 @@ if (UNIX)
# when running tests in parallel: have to generate pcaches first
set(linux.persist-use_FLAKY_depends linux.persist_FLAKY)

if (LINUX AND X64 AND HAVE_RSEQ AND NOT RISCV64)
if (LINUX AND X64 AND HAVE_RSEQ AND NOT RISCV64 AND NOT ANDROID)
# The rseq kernel feature is Linux-only.
# TODO i#2350: Port the assembly in the test to 32-bit x86 and to ARM.
# TODO i#3544: Port tests to RISC-V 64
# TODO i#1874: Build drmemtrace on Android (RSEQ_TEST_ATTACH depends on drmemtrace).
set(linux.rseq_no_reg_compat)
tobuild(linux.rseq linux/rseq.cpp)
# Test the other sections. Unfortunately we need a separate binary for each.
Expand Down Expand Up @@ -6426,7 +6425,8 @@ if (BUILD_CLIENTS AND NOT ANDROID)
code_api|tool.drcacheoff.simple
PROPERTIES LABELS UBUNTU_22)
endif ()
if (LINUX AND X64 AND HAVE_RSEQ AND NOT RISCV64) # TODO i#3544: Port tests to RISC-V 64
if (LINUX AND X64 AND HAVE_RSEQ AND NOT RISCV64 AND NOT ANDROID) # TODO i#3544: Port tests to RISC-V 64
# TODO i#1874: Build drmemtrace on Android (rseq tests depend on drmemtrace).
set_tests_properties(
code_api|api.rseq
code_api|linux.rseq_disable
Expand Down
1 change: 1 addition & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
include(../make/policies.cmake NO_POLICY_SCOPE)

add_executable(run_in_bg run_in_bg.c)
copy_target_to_device(run_in_bg "${location_suffix}")

if (UNIX)
add_executable(runstats runstats.c)
Expand Down

0 comments on commit 3521f0e

Please sign in to comment.