build: Only define DBUS_TEST_SOCKET_DIR on Unix platforms

This makes it more obvious that it is currently only used on Unix,
and therefore it's OK for it to have a default that wouldn't work
on Windows.

The non-default CMake build system already didn't set the variable when
building for Windows.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2025-04-28 13:26:56 +01:00
parent d18c7f6889
commit 8a9fddb26d
2 changed files with 22 additions and 8 deletions

View file

@ -227,8 +227,6 @@
#cmakedefine DBUS_USER "@DBUS_USER@"
#cmakedefine DBUS_TEST_USER "@DBUS_TEST_USER@"
#cmakedefine DBUS_TEST_EXEC "@DBUS_TEST_EXEC@"
/* Where to put test sockets */
#define DBUS_TEST_SOCKET_DIR "@TEST_SOCKET_DIR@"
// system type defines
#if defined(_WIN32) || defined(_WIN64) || defined (_WIN32_WCE)
@ -244,6 +242,11 @@
# define DBUS_UNIX
#endif
#ifdef DBUS_UNIX
/* Where to put test sockets */
#define DBUS_TEST_SOCKET_DIR "@TEST_SOCKET_DIR@"
#endif
#if defined(_WIN32) || defined(_WIN64)
// mingw mode_t
# ifdef HAVE_STDIO_H

View file

@ -1078,13 +1078,19 @@ values = run_command(python, '-c',
values += '/tmp'
default_socket_dir = values.strip().split('\n')[0]
test_socket_dir = get_option('test_socket_dir')
if test_socket_dir == ''
test_socket_dir = default_socket_dir
if platform_unix
test_socket_dir = get_option('test_socket_dir')
if test_socket_dir == ''
test_socket_dir = default_socket_dir
endif
config.set_quoted('DBUS_TEST_SOCKET_DIR', test_socket_dir)
test_listen = 'unix:tmpdir=' + test_socket_dir
else
test_listen = 'tcp:host=localhost'
endif
test_listen = platform_unix ? 'unix:tmpdir=' + test_socket_dir : 'tcp:host=localhost'
config.set_quoted('TEST_LISTEN', test_listen)
config.set_quoted('DBUS_TEST_SOCKET_DIR', test_socket_dir)
data_config.set('TEST_LISTEN', test_listen)
session_socket_dir = get_option('session_socket_dir')
@ -1395,9 +1401,14 @@ summary_dict += {
'System bus user': dbus_user,
'Session bus services dir':
get_option('prefix') / get_option('datadir') / 'dbus-1' / 'services',
'Tests socket dir': test_socket_dir,
}
if platform_unix
summary_dict += {
'Tests socket dir': test_socket_dir,
}
endif
if host_os.contains('solaris')
summary_dict += {
'Console owner file': console_owner_file,