[gnome-photos/sam/tests-isolated-xdg-data-dirs: 2/2] test: Isolate the test from any real user data



commit 48fbe775139d66725c085ae81f95275c6bf14f96
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Sep 28 14:53:28 2019 +0200

    test: Isolate the test from any real user data
    
    This uses the trackertestutils library to set up a temporary directory
    for XDG_DATA_HOME and XDG_CACHE_HOME data, and spawn private Tracker
    daemons which operate from this temporary directory. This means the
    app under test will no longer change behaviour depending on data in
    the HOME directory of the user running the test.

 meson.build       | 3 +++
 tests/meson.build | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index dee932dc..b3a0d8f8 100644
--- a/meson.build
+++ b/meson.build
@@ -181,6 +181,9 @@ dbus_service_dir = dbus_dep.get_pkgconfig_variable(
   define_variable: ['datadir', photos_datadir],
 )
 
+python3 = find_program('python3')
+trackertestutils = dependency('tracker-testutils-2.0')
+
 configure_file(
   output: 'config.h',
   configuration: config_h,
diff --git a/tests/meson.build b/tests/meson.build
index 38931dd1..fc957220 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -21,6 +21,9 @@ if photos_installed_tests_enabled
   )
 endif
 
+
+tracker_sandbox_command = find_program(trackertestutils.get_pkgconfig_variable('command'))
+
 if get_option('dogtail')
   test_env = [
     'LC_ALL=C',
@@ -30,7 +33,8 @@ if get_option('dogtail')
 
   test(
     test_name,
-    files(test_name),
+    tracker_sandbox_command,
+    args: ['--index-tmpdir', files(test_name)],
     env: test_env,
   )
 endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]