Skip to content

Commit

Permalink
fix(test/libsinsp_e2e): correctly manage cmake deps
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Feb 20, 2024
1 parent b23361c commit 82a1f3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 47 deletions.
40 changes: 3 additions & 37 deletions test/libsinsp_e2e/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ target_include_directories(libsinsp_e2e_tests
)

add_executable(test_helper test_helper.cpp)

target_link_libraries(test_helper pthread)
add_dependencies(libsinsp_e2e_tests test_helper)

add_executable(vtidcollision vtidcollision.c)
add_dependencies(libsinsp_e2e_tests vtidcollision)

execute_process(
COMMAND "uname" "-m"
Expand All @@ -70,46 +71,11 @@ if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
add_executable(test_helper_32 test_helper.cpp)
set_target_properties(test_helper_32 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
install(
TARGETS test_helper_32
DESTINATION ${CMAKE_INSTALL_PREFIX}/test
COMPONENT libsinsp_e2e_tests
)
target_link_libraries(test_helper_32 pthread)
add_dependencies(libsinsp_e2e_tests test_helper_32)
endif()
endif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")

install(
DIRECTORY
DESTINATION ${CMAKE_INSTALL_PREFIX}/test/captures
COMPONENT libsinsp_e2e_tests
)

install(
DIRECTORY
DESTINATION ${CMAKE_INSTALL_PREFIX}/test/resources/run
COMPONENT libsinsp_e2e_tests
)

install(
TARGETS test_helper vtidcollision
DESTINATION ${CMAKE_INSTALL_PREFIX}/test/
COMPONENT libsinsp_e2e_tests
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/test_helper.sh ${CMAKE_CURRENT_BINARY_DIR}/test_helper.sh COPYONLY
)

install(
FILES test_helper.sh
DESTINATION ${CMAKE_INSTALL_PREFIX}/test/
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
COMPONENT libsinsp_e2e_tests
)

install(
TARGETS libsinsp_e2e_tests
DESTINATION ${CMAKE_INSTALL_PREFIX}/test/
COMPONENT libsinsp_e2e_tests
)
12 changes: 2 additions & 10 deletions test/libsinsp_e2e/resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,12 @@ execute_process(

if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
add_executable(execve execve.c)
install(
TARGETS execve
DESTINATION ${CMAKE_INSTALL_PREFIX}/test/resources
COMPONENT tests
)
add_dependencies(libsinsp_e2e_tests execve)

# Build 32-bit tests only for architectures where that is supported
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
add_executable(execve32 execve.c)
set_target_properties(execve32 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
install(
TARGETS execve32
DESTINATION ${CMAKE_INSTALL_PREFIX}/test/resources
COMPONENT tests
)
add_dependencies(libsinsp_e2e_tests execve32)
endif()
endif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")

0 comments on commit 82a1f3c

Please sign in to comment.