From 41b3bb5bb8dc395bfce821c8ae3bf640f90e598d Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Thu, 25 Apr 2024 14:29:21 -0400 Subject: [PATCH 1/2] feature: publishing mirtest-internal to provide access to all mock/stub files for testing --- tests/CMakeLists.txt | 31 +++++++++++++++++++++++++++ tests/mir_test_doubles/CMakeLists.txt | 13 +++++++---- tests/mirtest-internal.pc.in | 10 +++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 tests/mirtest-internal.pc.in diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bdd26b76846..5f81513a27e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -127,6 +127,11 @@ add_library(mir-test-assist STATIC $ ) +add_library(mir-test-assist-internal STATIC + $ + $ +) + target_link_libraries(mir-test-assist PUBLIC miral @@ -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} ) @@ -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() diff --git a/tests/mir_test_doubles/CMakeLists.txt b/tests/mir_test_doubles/CMakeLists.txt index e24a66c5941..e32f2040347 100644 --- a/tests/mir_test_doubles/CMakeLists.txt +++ b/tests/mir_test_doubles/CMakeLists.txt @@ -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 @@ -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) @@ -105,7 +110,7 @@ target_link_libraries(mir-public-test-doubles add_library(mir-test-doubles-static STATIC $ - ${TEST_UTILS_SRCS} + $ ) target_include_directories( diff --git a/tests/mirtest-internal.pc.in b/tests/mirtest-internal.pc.in new file mode 100644 index 00000000000..e9a52d33262 --- /dev/null +++ b/tests/mirtest-internal.pc.in @@ -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} From 3c3e77da9777a97975f042e9813631f7827c96eb Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Fri, 26 Apr 2024 15:43:13 -0400 Subject: [PATCH 2/2] Publish mirtest-internal-dev --- debian/control | 17 +++++++++++++++++ debian/mirtest-internal-dev.install | 3 +++ tests/CMakeLists.txt | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 debian/mirtest-internal-dev.install diff --git a/debian/control b/debian/control index 6c39393a742..b4d8a6b8f46 100644 --- a/debian/control +++ b/debian/control @@ -208,6 +208,23 @@ Description: Display server for Ubuntu - test development headers and library Contains header files and static library for testing of server and/or client development. +Package: mirtest-internal-dev +Section: libdevel +Architecture: linux-any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: mirtest-dev + libmirserver-dev (= ${binary:Version}), + libboost-filesystem-dev, + libboost-system-dev, + ${misc:Depends}, +Description: Display server for Ubuntu - test development headers and library + Mir is a display server running on linux systems, with a focus on efficiency, + robust operation and a well-defined driver model. + . + Contains header files and static library for testing of server and/or client + development. + Package: mir-demos Architecture: linux-any Breaks: miral-examples diff --git a/debian/mirtest-internal-dev.install b/debian/mirtest-internal-dev.install new file mode 100644 index 00000000000..ba534445301 --- /dev/null +++ b/debian/mirtest-internal-dev.install @@ -0,0 +1,3 @@ +usr/include/mirtest-internal +usr/lib/*/pkgconfig/mirtest-internal.pc +usr/lib/*/libmir-test-assist-internal.a diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5f81513a27e..40bb6957aab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -171,6 +171,9 @@ configure_file( install(TARGETS mir-test-assist ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +install(TARGETS mir-test-assist-internal + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/test/mir DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/mirtest" )