[tracker-miners/sam/writeback-test-fix: 2/5] functional-tests: Prevent spawning daemons from /usr via D-Bus activation
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/writeback-test-fix: 2/5] functional-tests: Prevent spawning daemons from /usr via D-Bus activation
- Date: Sun, 23 Jun 2019 13:27:22 +0000 (UTC)
commit 8a452fa4f0effc850c947a335d6b5a6638919c0a
Author: Sam Thursfield <sam afuera me uk>
Date: Sat Jun 22 19:02:05 2019 +0200
functional-tests: Prevent spawning daemons from /usr via D-Bus activation
This commit adds a D-Bus configuration file and appropriate .service
files that allow running the Tracker daemons from the build tree. This
means that the functional tests can't spawn Tracker daemons installed in
/usr by mistake any more, as long as there's a corresponding .service
file for that daemon in the ./tests/services directory.
This specifically fixes a problem I was seeing with /usr/libexec/tracker-writeback
being spawned during the functional-410-extractor-decorator test.
This commit is based on https://gitlab.gnome.org/GNOME/tracker/merge_requests/74
from tracker core.
meson.build | 1 +
tests/functional-tests/meson.build | 8 ++++++--
.../{test-runner.sh => test-runner.sh.in} | 2 +-
tests/meson.build | 7 +++++++
tests/services/meson.build | 14 ++++++++++++++
...rg.freedesktop.Tracker1.Miner.Extract.service.in | 4 ++++
.../org.freedesktop.Tracker1.Miner.Files.service.in | 4 ++++
.../org.freedesktop.Tracker1.Writeback.service.in | 4 ++++
tests/test-bus.conf.in | 21 +++++++++++++++++++++
9 files changed, 62 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8b4d7dd7c..2b70a4924 100644
--- a/meson.build
+++ b/meson.build
@@ -349,6 +349,7 @@ conf.set('PACKAGE_VERSION', '"@0@"'.format(meson.project_version()))
conf.set('TRACKER_VERSION', '"@0@"'.format(meson.project_version()))
# Config that goes in some other generated files (.desktop, .pc, etc)
+conf.set('abs_top_builddir', meson.current_build_dir())
conf.set('exec_prefix', get_option('prefix'))
conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
conf.set('datadir', datadir)
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index 90ee0e90a..ed0cc8150 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -1,3 +1,9 @@
+test_runner = configure_file(
+ input: 'test-runner.sh.in',
+ output: 'test-runner.sh',
+ configuration: conf)
+test_runner = find_program(test_runner)
+
extractor_tests = [
'audio/audio-test-1',
'audio/empty_albumi_song3',
@@ -39,8 +45,6 @@ functional_tests = [
'601-applications-sync',
]
-test_runner = find_program('test-runner.sh')
-
config_json = configure_file(
input: 'configuration.json.in',
output: 'configuration.json',
diff --git a/tests/functional-tests/test-runner.sh b/tests/functional-tests/test-runner.sh.in
similarity index 83%
rename from tests/functional-tests/test-runner.sh
rename to tests/functional-tests/test-runner.sh.in
index 29cd65f78..a52ee687f 100755
--- a/tests/functional-tests/test-runner.sh
+++ b/tests/functional-tests/test-runner.sh.in
@@ -16,6 +16,6 @@ export REAL_HOME=`echo ~`
# in the filesystem
HOME=$TEMP_DIR
-dbus-run-session $@
+dbus-run-session --config-file=@abs_top_builddir@/tests/test-bus.conf -- "$@"
rm -R $TEMP_DIR
diff --git a/tests/meson.build b/tests/meson.build
index 4651bb713..431c17ff6 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -11,6 +11,13 @@ endif
# subdir('tracker-writeback')
#endif
+subdir('services')
+
+test_bus_conf_file = configure_file(
+ input: 'test-bus.conf.in',
+ output: 'test-bus.conf',
+ configuration: conf)
+
if get_option('functional_tests')
subdir('functional-tests')
endif
diff --git a/tests/services/meson.build b/tests/services/meson.build
new file mode 100644
index 000000000..15308348f
--- /dev/null
+++ b/tests/services/meson.build
@@ -0,0 +1,14 @@
+tracker_extract_test_dbus_service_file = configure_file(
+ input: 'org.freedesktop.Tracker1.Miner.Extract.service.in',
+ output: 'org.freedesktop.Tracker1.Miner.Extract.service',
+ configuration: conf)
+
+tracker_miner_fs_test_dbus_service_file = configure_file(
+ input: 'org.freedesktop.Tracker1.Miner.Files.service.in',
+ output: 'org.freedesktop.Tracker1.Miner.Files.service',
+ configuration: conf)
+
+tracker_writeback_test_dbus_service_file = configure_file(
+ input: 'org.freedesktop.Tracker1.Writeback.service.in',
+ output: 'org.freedesktop.Tracker1.Writeback.service',
+ configuration: conf)
diff --git a/tests/services/org.freedesktop.Tracker1.Miner.Extract.service.in
b/tests/services/org.freedesktop.Tracker1.Miner.Extract.service.in
new file mode 100644
index 000000000..ac5011bb3
--- /dev/null
+++ b/tests/services/org.freedesktop.Tracker1.Miner.Extract.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.Tracker1.Miner.Extract
+Exec=@abs_top_builddir@/src/tracker-extract/tracker-extract
+SystemdService=tracker-extract.service
diff --git a/tests/services/org.freedesktop.Tracker1.Miner.Files.service.in
b/tests/services/org.freedesktop.Tracker1.Miner.Files.service.in
new file mode 100644
index 000000000..482d39518
--- /dev/null
+++ b/tests/services/org.freedesktop.Tracker1.Miner.Files.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.Tracker1.Miner.Files
+Exec=@abs_top_builddir@/src/miners/fs/tracker-miner-fs
+SystemdService=tracker-miner-fs.service
diff --git a/tests/services/org.freedesktop.Tracker1.Writeback.service.in
b/tests/services/org.freedesktop.Tracker1.Writeback.service.in
new file mode 100644
index 000000000..810fd4981
--- /dev/null
+++ b/tests/services/org.freedesktop.Tracker1.Writeback.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.Tracker1.Writeback
+Exec=@abs_top_builddir@/src/tracker-writeback/tracker-writeback
+SystemdService=tracker-writeback.service
diff --git a/tests/test-bus.conf.in b/tests/test-bus.conf.in
new file mode 100644
index 000000000..2f4b2ef1b
--- /dev/null
+++ b/tests/test-bus.conf.in
@@ -0,0 +1,21 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <!-- Our well-known bus type, don't change this -->
+ <type>session</type>
+
+ <listen>unix:tmpdir=./</listen>
+
+ <servicedir>@abs_top_builddir@/tests/services/</servicedir>
+ <standard_session_servicedirs/>
+
+ <policy context="default">
+ <!-- Allow everything to be sent -->
+ <allow send_destination="*"/>
+ <!-- Allow everything to be received -->
+ <allow eavesdrop="true"/>
+ <!-- Allow anyone to own anything -->
+ <allow own="*"/>
+ </policy>
+
+</busconfig>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]