Skip to content

Commit ff2f938

Browse files
i#7576 detach_state: Refactor test source (#7743)
Split the test function source out into a separate static library to allow them to be reused in a separate test application to test external detach. The new file detach_state_shared.c has minimal changes compared to the code removed from detach_state.c. None of the test functions themselves are changed. This also required a change to thread.h to avoid link errors when linking the new library: ``` multiple definition of `thread_sleep' multiple definition of `thread_yield' ``` Issue: #7576
1 parent 985af57 commit ff2f938

File tree

5 files changed

+1770
-1640
lines changed

5 files changed

+1770
-1640
lines changed

suite/tests/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3470,13 +3470,21 @@ if (NOT RISCV64) # TODO i#3544: Port tests to RISC-V 64
34703470
endif (NOT RISCV64)
34713471
if (LINUX AND X64 AND NOT RISCV64) # Will take extra work to port to 32-bit.
34723472
# TODO i#3544: Port tests to RISC-V 64
3473+
3474+
set(detach_state_shared_c ${CMAKE_CURRENT_SOURCE_DIR}/api/detach_state_shared.c)
3475+
add_split_asm_target("${detach_state_shared_c}" detach_state_shared_asm
3476+
generate_detach_state_shared_asm "_asm" "${asm_defs}" "${asm_deps}")
3477+
add_library(detach_state_shared STATIC
3478+
${detach_state_shared_c} ${detach_state_shared_asm})
3479+
set_cflags("${detach_state_shared_c}")
3480+
set_sve_flags(detach_state_shared)
3481+
set_avx_flags(detach_state_shared)
3482+
34733483
tobuild_api(api.detach_state api/detach_state.c "" "" OFF ON OFF)
34743484
target_include_directories(api.detach_state PRIVATE
34753485
${CMAKE_CURRENT_SOURCE_DIR}/api)
34763486
link_with_pthread(api.detach_state)
3477-
set_source_files_properties(detach_state.c_asm.asm APPEND_LIST PROPERTIES
3478-
OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/api/detach_state_shared.h")
3479-
set_avx_flags(api.detach_state)
3487+
target_link_libraries(api.detach_state detach_state_shared)
34803488
endif ()
34813489
if (UNIX AND NOT RISCV64)
34823490
if (X64) # TODO i#4664: Fix crash in vsyscall hook under native threads.

0 commit comments

Comments
 (0)