While testing Bug #41222 I found that several tests in test/name-test/ failed under cmake. However, this wasn't a regression: they'd fail in dbus-1.4 too. The reason is that those tests expect to be run under a dbus-daemon that has test/data/valid-service-files/ in its search path. The Automake build system achieves this by running them via run-test.sh and run-test-systemserver.sh, which in turn use run-with-tmp-session-bus.sh. That's needlessly complicated, but sort of works in an Automake environment, where you can guarantee to have a POSIX shell. For these tests to work without a POSIX shell, I think the best solution is to have them implement an equivalent of tools/run-with-tmp-session-bus.sh internally, using a config file passed in via the environment (TESTS_ENVIRONMENT for the entire Makefile.am in Automake; the ENVIRONMENT property on each test in CMake). The "modular tests" tests that I've been adding recently use GLib to do that; we could either extend the optional GLib dependency so it's required for *all* tests, or use dbus-spawn to get similar functionality. On Unix, this would be an ideal place to combine Bug #35230 with a "dbus-daemon --inetd" sort of thing, but I don't think having a child process inherit a socket from its parent is portable to Windows, sadly...
(In reply to comment #0) > For these tests to work without a POSIX shell, I think the best solution is to > have them implement an equivalent of tools/run-with-tmp-session-bus.sh > internally, using a config file The config generating from the already processed template looks very complicated. Why not adding an additional build system var named @DBUS_SESSION_SERVICE_DIRS@ into session.conf.in and set the value in the build system part genering the session bus config files. The test related config file generating could be placed into tests/Makefile.am and cmake/tests/CMakeLists.
Created attachment 52955 [details] [review] cmake part for more customizable session.conf.in
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/dbus/dbus/issues/57.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.