[nautilus/meson-test-env: 7/7] build: Set a couple env vars when running tests



commit 61177f3ad87518e08fc25b4be18fbe9839fe29be
Author: Ernestas Kulik <ernestask gnome org>
Date:   Thu May 17 13:28:13 2018 +0300

    build: Set a couple env vars when running tests
    
    This will save some time/thinking when running tests manually.
    G_TEST_BUILDDIR and G_TEST_SRCDIR will be useful if
    g_test_build_filename() is ever used, since our primary build mode is
    outside the source directory, which would break the function.

 test/automated/display/meson.build     | 6 +++++-
 test/automated/displayless/meson.build | 6 +++++-
 test/meson.build                       | 7 +++++++
 3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/test/automated/display/meson.build b/test/automated/display/meson.build
index 1edd7b60d..28a89e1cd 100644
--- a/test/automated/display/meson.build
+++ b/test/automated/display/meson.build
@@ -8,5 +8,9 @@ tests = [
 ]
 
 foreach t: tests
-  test(t[0], executable(t[0], t[1], dependencies: libnautilus_dep))
+  test(
+    t[0],
+    executable(t[0], t[1], dependencies: libnautilus_dep),
+    env: test_env
+  )
 endforeach
diff --git a/test/automated/displayless/meson.build b/test/automated/displayless/meson.build
index cd7573417..003ebdcec 100644
--- a/test/automated/displayless/meson.build
+++ b/test/automated/displayless/meson.build
@@ -11,5 +11,9 @@ tests = [
 ]
 
 foreach t: tests
-  test(t[0], executable(t[0], t[1], dependencies: libnautilus_dep))
+  test(
+    t[0],
+    executable(t[0], t[1], dependencies: libnautilus_dep),
+    env: test_env
+  )
 endforeach
diff --git a/test/meson.build b/test/meson.build
index 6fd5e6005..544a0fc3e 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,2 +1,9 @@
+# Pass this in the env argument to all tests.
+test_env = [
+  'GSETTINGS_SCHEMA_DIR=@0@'.format(join_paths(meson.build_root(), 'data')),
+  'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
+  'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir())
+]
+
 subdir('automated')
 subdir('interactive')


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