Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: publishing mirtest-internal to provide access to all mock/stub files for testing #3333

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions debian/mirtest-internal-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
usr/include/mirtest-internal
usr/lib/*/pkgconfig/mirtest-internal.pc
usr/lib/*/libmir-test-assist-internal.a
34 changes: 34 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,15 +145,35 @@ 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}
)
install(TARGETS mir-test-assist-internal
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/test/mir
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/mirtest"
)
Expand All @@ -158,9 +183,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}
Loading