Commit e1752785 authored by Ralf Habacker's avatar Ralf Habacker

Merge branch '135-session-test-support-windows' into 'master'

name-test: Run most tests in CMake, via dbus-run-session

See merge request !23
parents e64c60cf d6ee9ad0
Pipeline #12775 passed with stage
in 9 minutes and 17 seconds
......@@ -278,19 +278,20 @@ ENABLE_TESTING()
#endif(${generatedFileInSourceDir})
#########################################################################
if (WIN32 OR CYGWIN)
set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
else (WIN32 OR CYGWIN)
set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
endif (WIN32 OR CYGWIN)
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
########### build output path definitions ###############
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(WIN32 OR CYGWIN)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
endif()
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# for including config.h and for includes like <dir/foo.h>
include_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR} ${CMAKE_INCLUDE_PATH} )
# linker search directories
link_directories(${DBUS_LIB_DIR} ${LIBRARY_OUTPUT_PATH} )
link_directories(${DBUS_LIB_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} )
include_directories( ${CMAKE_LIBRARY_PATH} )
set(DBUS_INCLUDES)
......@@ -482,9 +483,13 @@ 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 ${Z_DRIVE_IF_WINE}${EXECUTABLE_OUTPUT_PATH}${IDE_BIN})
set(DBUS_TEST_EXEC ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${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)
set(DBUS_TEST_DAEMON ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-daemon${EXEEXT})
set(DBUS_TEST_DBUS_LAUNCH ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-launch${EXEEXT})
set(DBUS_TEST_HOMEDIR ${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/dbus)
set(DBUS_TEST_RUN_SESSION ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-run-session${EXEEXT})
set(TEST_LAUNCH_HELPER_BINARY ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-daemon-launch-helper-test${EXEEXT})
if (UNIX)
set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR})
set(TEST_LISTEN "unix:tmpdir=${TEST_SOCKET_DIR}")
......
......@@ -59,11 +59,11 @@ macro(add_test_executable _target _source)
set(_env)
list(APPEND _env "DBUS_SESSION_BUS_ADDRESS=")
list(APPEND _env "DBUS_FATAL_WARNINGS=1")
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_DAEMON=${DBUS_TEST_DAEMON}")
list(APPEND _env "DBUS_TEST_DATA=${DBUS_TEST_DATA}")
list(APPEND _env "DBUS_TEST_DBUS_LAUNCH=${DBUS_TEST_DBUS_LAUNCH}")
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_HOMEDIR=${DBUS_TEST_HOMEDIR}")
list(APPEND _env "DBUS_TEST_UNINSTALLED=1")
set_tests_properties(${_target} PROPERTIES ENVIRONMENT "${_env}")
endmacro(add_test_executable)
......@@ -78,6 +78,32 @@ macro(add_helper_executable _target _source)
target_link_libraries(${_target} ${ARGN})
endmacro(add_helper_executable)
macro(add_session_test_executable _target _source)
set(_sources "${_source}")
if(WIN32 AND NOT MSVC)
# avoid triggering UAC
add_uac_manifest(_sources)
endif()
add_executable(${_target} ${_sources})
target_link_libraries(${_target} ${ARGN})
add_test(NAME ${_target}
COMMAND
${TEST_WRAPPER}
${DBUS_TEST_RUN_SESSION}
--config-file=${DBUS_TEST_DATA}/valid-config-files/tmp-session.conf
--dbus-daemon=${DBUS_TEST_DAEMON}
${Z_DRIVE_IF_WINE}$<TARGET_FILE:${_target}>
--tap
)
set(_env)
list(APPEND _env "DBUS_SESSION_BUS_PID=")
list(APPEND _env "DBUS_SESSION_BUS_ADDRESS=")
list(APPEND _env "DBUS_FATAL_WARNINGS=1")
list(APPEND _env "DBUS_TEST_DAEMON=${DBUS_TEST_DAEMON}")
list(APPEND _env "DBUS_TEST_DATA=${DBUS_TEST_DATA}")
list(APPEND _env "DBUS_TEST_HOMEDIR=${DBUS_TEST_HOMEDIR}")
set_tests_properties(${_target} PROPERTIES ENVIRONMENT "${_env}")
endmacro(add_session_test_executable)
#
# generate compiler flags from MSVC warning identifiers (e.g. '4114') or gcc warning keys (e.g. 'pointer-sign')
......
......@@ -4,11 +4,12 @@ set (NAME_TEST_DIR ../../../test/name-test)
add_definitions(${DBUS_INTERNAL_CLIENT_DEFINITIONS})
add_helper_executable(test-pending-call-dispatch ${NAME_TEST_DIR}/test-pending-call-dispatch.c ${DBUS_INTERNAL_LIBRARIES})
add_helper_executable(test-pending-call-timeout ${NAME_TEST_DIR}/test-pending-call-timeout.c ${DBUS_INTERNAL_LIBRARIES})
add_helper_executable(test-thread-init ${NAME_TEST_DIR}/test-threads-init.c ${DBUS_INTERNAL_LIBRARIES})
add_helper_executable(test-ids ${NAME_TEST_DIR}/test-ids.c ${DBUS_INTERNAL_LIBRARIES})
add_helper_executable(test-shutdown ${NAME_TEST_DIR}/test-shutdown.c dbus-testutils)
add_helper_executable(test-privserver-client ${NAME_TEST_DIR}/test-privserver-client.c dbus-testutils)
add_helper_executable(test-autolaunch ${NAME_TEST_DIR}/test-autolaunch.c dbus-testutils)
add_helper_executable(test-privserver-client ${NAME_TEST_DIR}/test-privserver-client.c dbus-testutils)
add_session_test_executable(test-ids ${NAME_TEST_DIR}/test-ids.c ${DBUS_INTERNAL_LIBRARIES})
add_session_test_executable(test-pending-call-dispatch ${NAME_TEST_DIR}/test-pending-call-dispatch.c ${DBUS_INTERNAL_LIBRARIES})
add_session_test_executable(test-pending-call-timeout ${NAME_TEST_DIR}/test-pending-call-timeout.c ${DBUS_INTERNAL_LIBRARIES})
add_session_test_executable(test-shutdown ${NAME_TEST_DIR}/test-shutdown.c dbus-testutils)
add_session_test_executable(test-thread-init ${NAME_TEST_DIR}/test-threads-init.c ${DBUS_INTERNAL_LIBRARIES})
endif (DBUS_ENABLE_EMBEDDED_TESTS)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment