Commit 0ed7d779 authored by Ralf Habacker's avatar Ralf Habacker

Cmake support for cross plattform usable test files.

Recent test configuration files contains 'unix:...'
bus adresses which do not work on windows.
For cross plattform usable test files the whole
listen tag entry has to be set by the build system,
which is available with a new build system variable
named TEST_LISTEN.
To have the client client side definition in sync,
TEST_CONNECTION has been moved from c file into cmake
build system.
parent 2279457c
......@@ -41,11 +41,17 @@
#include <unistd.h>
#endif
#ifndef TEST_CONNECTION
/*
TODO autotools:
move to build system as already done for cmake
*/
#ifdef DBUS_UNIX
#define TEST_CONNECTION "debug-pipe:name=test-server"
#else
#define TEST_CONNECTION "tcp:host=localhost,port=1234"
#endif
#endif
static dbus_bool_t
send_one_message (DBusConnection *connection,
......
......@@ -475,10 +475,6 @@ if (MINGW)
set (HAVE_GNUC_VARARGS 1)
endif(MINGW)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)
# compiler definitions
add_definitions(-DHAVE_CONFIG_H=1)
add_definitions(${DBUS_BUS_CFLAGS} -DDBUS_API_SUBJECT_TO_CHANGE)
......@@ -490,6 +486,14 @@ if (DBUS_BUILD_TESTS)
set(TEST_VALID_SERVICE_SYSTEM_DIR ${CMAKE_BINARY_DIR}/test/data/valid-service-files-system)
set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR} )
set(TEST_LAUNCH_HELPER_BINARY ${EXECUTABLE_OUTPUT_PATH}/dbus-daemon-launch-helper-test)
if (UNIX)
set (TEST_LISTEN "debug-pipe:name=test-server")
set (TEST_CONNECTION "${TEST_LISTEN}")
endif (UNIX)
if (WIN32)
set (TEST_LISTEN "tcp:host=localhost,port=12436")
set (TEST_CONNECTION "${TEST_LISTEN}")
endif (WIN32)
endif (DBUS_BUILD_TESTS)
set(DBUS_LIBRARIES dbus-1)
......@@ -501,6 +505,11 @@ set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC)
set (DBUS_INTERNAL_LIBRARY_DEFINITIONS "-DDBUS_STATIC_BUILD")
set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)
########### subdirs ###############
add_subdirectory( dbus )
......@@ -576,6 +585,7 @@ message(" Console auth dir: ${DBUS_CONSOLE_AUTH_DIR} "
message(" System bus user: ${DBUS_USER} ")
message(" 'make check' socket dir: ${TEST_SOCKET_DIR} ")
endif (WIN32)
message(" Test listen address: ${TEST_LISTEN} ")
if (MSVC)
message(" build timestamp: ${DBUS_BUILD_TIMESTAMP} ")
endif (MSVC)
......
......@@ -26,6 +26,9 @@
#define VERSION DBUS_VERSION_STRING
#define TEST_LISTEN "@TEST_LISTEN@"
#define TEST_CONNECTION "@TEST_CONNECTION@"
// test binaries
/* Full path to test file test/test-exit in builddir */
#define TEST_BUS_BINARY "@TEST_BUS_BINARY@"
......
......@@ -122,13 +122,6 @@ FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.se
ENDFOREACH(DIR)
ENDFOREACH(FILE_TYPE)
if (UNIX)
set (TEST_LISTEN "debug-pipe:name=test-server")
endif (UNIX)
if (WIN32)
set (TEST_LISTEN "tcp:host=localhost,port=1234")
endif (WIN32)
### generate test files
MESSAGE(STATUS "Generating test files from templates into test directory")
......
<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<listen>@TEST_LISTEN@</listen>
<type>system</type>
<servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
<servicedir>@TEST_INVALID_SERVICE_SYSTEM_DIR@</servicedir>
<policy context="default">
<allow send_interface="*"/>
<allow receive_interface="*"/>
<allow own="*"/>
<allow user="*"/>
</policy>
</busconfig>
<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<listen>@TEST_LISTEN@</listen>
<type>system</type>
<servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
<servicedir>@TEST_VALID_SERVICE_SYSTEM_DIR@</servicedir>
<policy context="default">
<allow send_interface="*"/>
<allow receive_interface="*"/>
<allow own="*"/>
<allow user="*"/>
</policy>
</busconfig>
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