Skip to content

Commit

Permalink
feature: publishing mirtest-internal to provide access to all mock/st…
Browse files Browse the repository at this point in the history
…ub files for testing
  • Loading branch information
mattkae committed Apr 25, 2024
1 parent 50e3924 commit 6e9cea3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
31 changes: 31 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ add_library(mir-test-assist STATIC
$<TARGET_OBJECTS:mir-public-test-framework>
)

add_library(mir-test-assist-internal STATIC
$<TARGET_OBJECTS:mir-protected-test-framework>
$<TARGET_OBJECTS:mir-protected-test-doubles>
)

target_link_libraries(mir-test-assist
PUBLIC
miral
Expand All @@ -140,12 +145,29 @@ PRIVATE
${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
)

target_link_libraries(mir-test-assist-internal
PUBLIC
mirserver

Boost::system
${GTEST_BOTH_LIBRARIES}
PRIVATE
${GMOCK_MAIN_LIBRARY}
${GMOCK_LIBRARIES}
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/mirtest.pc.in
${CMAKE_CURRENT_BINARY_DIR}/mirtest.pc
@ONLY
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/mirtest-internal.pc.in
${CMAKE_CURRENT_BINARY_DIR}/mirtest-internal.pc
@ONLY
)

install(TARGETS mir-test-assist
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
Expand All @@ -158,9 +180,18 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/test/mir_test_framework
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/test/miral
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/mirtest"
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/tests/include/mir
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/mirtest-internal"
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/tests/include/mir_test_framework
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/mirtest-internal"
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mirtest.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mirtest-internal.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

mir_add_memcheck_test()
mir_add_detect_fd_leaks_test()
13 changes: 9 additions & 4 deletions tests/mir_test_doubles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ include_directories(
${CMAKE_SOURCE_DIR}
)

set(
TEST_UTILS_SRCS

add_library(mir-protected-test-doubles OBJECT
mock_input_device.cpp
triggered_main_loop.cpp
fake_alarm_factory.cpp
Expand All @@ -31,6 +29,13 @@ set(
${PROJECT_SOURCE_DIR}/tests/include/mir/test/doubles/mock_output_surface.h
)

target_link_libraries(mir-protected-test-doubles
PUBLIC
mirplatform
mircommon
mircore
)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
check_cxx_compiler_flag("-Wno-attributes=clang::" SUPPORTS_SCOPED_W_NO_ATTRIBUTES)
if (SUPPORTS_SCOPED_W_NO_ATTRIBUTE)
Expand Down Expand Up @@ -105,7 +110,7 @@ target_link_libraries(mir-public-test-doubles

add_library(mir-test-doubles-static STATIC
$<TARGET_OBJECTS:mir-public-test-doubles>
${TEST_UTILS_SRCS}
$<TARGET_OBJECTS:mir-protected-test-doubles>
)

target_include_directories(
Expand Down
10 changes: 10 additions & 0 deletions tests/mirtest-internal.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=@PKGCONFIG_LIBDIR@
includedir=@PKGCONFIG_INCLUDEDIR@/mirtest-internal

Name: mirtest-internal
Description: Mir test assist internal library
Version: @MIR_VERSION@
Requires: mirtest mirserver mirserver-internal
Libs: -L${libdir} -lmir-test-assist -lmir-test-assist-internal -ldl -lboost_filesystem -lboost_system
Cflags: -I${includedir}

0 comments on commit 6e9cea3

Please sign in to comment.