mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 00:37:59 +02:00
Add new cmake configure option DBUS_USE_WINE
If this variable is set, ctest uses wine to run cross compiled test applications. Otherwise, they are assumed to run on a native Windows operating system. The new cmake variables Z_DRIVE_IF_WINE and TEST_WRAPPER have been added to support this function.
This commit is contained in:
parent
533ec58c9a
commit
56171457fb
3 changed files with 21 additions and 12 deletions
|
|
@ -151,6 +151,9 @@ win32 only:
|
|||
// enable win32 debug port for message output
|
||||
DBUS_USE_OUTPUT_DEBUG_STRING:BOOL=OFF
|
||||
|
||||
// use wine to run cross compiled test applications (only for cross compiling for Windows)
|
||||
DBUS_USE_WINE:BOOL=OFF
|
||||
|
||||
gcc only:
|
||||
// compile with coverage profiling instrumentation
|
||||
DBUS_GCOV_ENABLED:BOOL=OFF
|
||||
|
|
|
|||
|
|
@ -482,9 +482,9 @@ add_definitions(${DBUS_BUS_CFLAGS})
|
|||
|
||||
if (DBUS_BUILD_TESTS)
|
||||
# set variables used for the .in files (substituted by configure_file) in test/data:
|
||||
set(DBUS_TEST_EXEC ${EXECUTABLE_OUTPUT_PATH}${IDE_BIN})
|
||||
set(DBUS_TEST_DATA ${CMAKE_BINARY_DIR}/test/data)
|
||||
set(TEST_LAUNCH_HELPER_BINARY ${EXECUTABLE_OUTPUT_PATH}/dbus-daemon-launch-helper-test)
|
||||
set(DBUS_TEST_EXEC ${Z_DRIVE_IF_WINE}${EXECUTABLE_OUTPUT_PATH}${IDE_BIN})
|
||||
set(DBUS_TEST_DATA ${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/test/data)
|
||||
set(TEST_LAUNCH_HELPER_BINARY ${Z_DRIVE_IF_WINE}${EXECUTABLE_OUTPUT_PATH}/dbus-daemon-launch-helper-test)
|
||||
if (UNIX)
|
||||
set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR})
|
||||
set(TEST_LISTEN "unix:tmpdir=${TEST_SOCKET_DIR}")
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
option(DBUS_USE_WINE "set to 1 or ON to support running test cases with Wine" OFF)
|
||||
|
||||
if(DBUS_BUILD_TESTS AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
find_file(WINE_EXECUTABLE
|
||||
|
|
@ -28,6 +30,12 @@ if(DBUS_BUILD_TESTS AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Win
|
|||
else()
|
||||
list(APPEND FOOTNOTES "NOTE: You will not be able to run cross compiled applications on your host system.")
|
||||
endif()
|
||||
|
||||
# setup z drive required by wine
|
||||
set(Z_DRIVE_IF_WINE "z:")
|
||||
if(DBUS_USE_WINE AND WINE_EXECUTABLE)
|
||||
set(TEST_WRAPPER "${WINE_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(add_test_executable _target _source)
|
||||
|
|
@ -40,24 +48,22 @@ macro(add_test_executable _target _source)
|
|||
target_link_libraries(${_target} ${ARGN})
|
||||
if (CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
# run tests with binfmt_misc
|
||||
set(PREFIX "z:")
|
||||
set(_env "DBUS_TEST_DAEMON=${PREFIX}${CMAKE_BINARY_DIR}/bin/dbus-daemon${EXEEXT}")
|
||||
if(HAVE_BINFMT_WINE_SUPPORT)
|
||||
add_test(NAME ${_target} COMMAND $<TARGET_FILE:${_target}> --tap)
|
||||
else()
|
||||
add_test(NAME ${_target} COMMAND ${WINE_EXECUTABLE} ${PREFIX}$<TARGET_FILE:${_target}> --tap)
|
||||
add_test(NAME ${_target} COMMAND ${TEST_WRAPPER} ${Z_DRIVE_IF_WINE}$<TARGET_FILE:${_target}> --tap)
|
||||
endif()
|
||||
else()
|
||||
set(PREFIX)
|
||||
set(_env "DBUS_TEST_DAEMON=${CMAKE_BINARY_DIR}/bin/dbus-daemon${EXEEXT}")
|
||||
add_test(NAME ${_target} COMMAND $<TARGET_FILE:${_target}> --tap)
|
||||
endif()
|
||||
set(_env)
|
||||
list(APPEND _env "DBUS_SESSION_BUS_ADDRESS=")
|
||||
list(APPEND _env "DBUS_FATAL_WARNINGS=1")
|
||||
list(APPEND _env "DBUS_TEST_DATA=${PREFIX}${CMAKE_BINARY_DIR}/test/data")
|
||||
list(APPEND _env "DBUS_TEST_DBUS_LAUNCH=${PREFIX}${CMAKE_BINARY_DIR}/bin/dbus-launch${EXEEXT}")
|
||||
list(APPEND _env "DBUS_TEST_EXEC=${PREFIX}${DBUS_TEST_EXEC}")
|
||||
list(APPEND _env "DBUS_TEST_HOMEDIR=${PREFIX}${CMAKE_BINARY_DIR}/dbus")
|
||||
list(APPEND _env "DBUS_TEST_DAEMON=${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/bin/dbus-daemon${EXEEXT}")
|
||||
list(APPEND _env "DBUS_TEST_DATA=${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/test/data")
|
||||
list(APPEND _env "DBUS_TEST_DBUS_LAUNCH=${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/bin/dbus-launch${EXEEXT}")
|
||||
list(APPEND _env "DBUS_TEST_EXEC=${DBUS_TEST_EXEC}")
|
||||
list(APPEND _env "DBUS_TEST_HOMEDIR=${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/dbus")
|
||||
list(APPEND _env "DBUS_TEST_UNINSTALLED=1")
|
||||
set_tests_properties(${_target} PROPERTIES ENVIRONMENT "${_env}")
|
||||
endmacro(add_test_executable)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue