[rhythmbox: 1/2] tests: Allow running tests without installed gsettings schemas




commit 2d36c6b1895c7478bd73bd82c9ba1e896c7bb55d
Author: Jeremy Bicha <jeremy bicha canonical com>
Date:   Wed Jun 22 10:19:56 2022 -0400

    tests: Allow running tests without installed gsettings schemas

 .gitlab-ci.yml    |  2 +-
 tests/meson.build | 21 ++++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c37abc96e..e8d0fbfe0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -71,7 +71,7 @@ test:
     - cd _build
     - meson .. $MESON_ARGS
     - ninja
-    - G_MESSAGES_DEBUG=all GSETTINGS_BACKEND=memory GSETTINGS_SCHEMA_DIR=${CI_PROJECT_DIR}/_build/data/ 
xvfb-run -a -s "-screen 0 1024x768x24" meson test
+    - G_MESSAGES_DEBUG=all xvfb-run -a -s "-screen 0 1024x768x24" meson test
     - ninja install
   artifacts:
     when: always
diff --git a/tests/meson.build b/tests/meson.build
index 808b02b8f..6c7c38cf0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,10 +1,17 @@
+test_env = environment()
+test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
+test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
+test_env.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
+test_env.set('GSETTINGS_BACKEND', 'memory')
+test_env.set('CK_DEFAULT_TIMEOUT', '0')
+
 test('test-rhythmdb',
   executable('test-rhythmdb',
     ['test-rhythmdb.c', 'test-utils.c'],
     dependencies: [rhythmbox_core_dep, check],
     c_args: ['-DTEST_DIR="@0@"'.format(meson.current_source_dir())]),
   depends: gschemas_compiled,
-  env: ['CK_DEFAULT_TIMEOUT=0'],
+  env: test_env,
 )
 
 test('test-rhythmdb-query-model',
@@ -12,7 +19,7 @@ test('test-rhythmdb-query-model',
     ['test-rhythmdb-query-model.c', 'test-utils.c'],
     dependencies: [rhythmbox_core_dep, check]),
   depends: gschemas_compiled,
-  env: ['CK_DEFAULT_TIMEOUT=0'],
+  env: test_env,
 )
 
 test('test-rhythmdb-property-model',
@@ -20,28 +27,28 @@ test('test-rhythmdb-property-model',
     ['test-rhythmdb-property-model.c', 'test-utils.c'],
     dependencies: [rhythmbox_core_dep, check]),
   depends: gschemas_compiled,
-  env: ['CK_DEFAULT_TIMEOUT=0'],
+  env: test_env,
 )
 
 test('test-file-helpers',
   executable('test-file-helpers',
     ['test-file-helpers.c', 'test-utils.c'],
     dependencies: [rhythmbox_core_dep, check]),
-  env: ['CK_DEFAULT_TIMEOUT=0'],
+  env: test_env,
 )
 
 test('test-rb-lib',
   executable('test-rb-lib',
     ['test-rb-lib.c', 'test-utils.c'],
     dependencies: [rhythmbox_core_dep, check]),
-  env: ['CK_DEFAULT_TIMEOUT=0'],
+  env: test_env,
 )
 
 test('test-audioscrobbler',
   executable('test-audioscrobbler',
     ['test-audioscrobbler.c', 'test-utils.c'],
     dependencies: [rhythmbox_core_dep, audioscrobbler_test_dep, check]),
-  env: ['CK_DEFAULT_TIMEOUT=0'],
+  env: test_env,
 )
 
 test_widgets_resources = gnome.compile_resources('test-widgets-resources', 'test-widgets.gresource.xml',
@@ -51,7 +58,7 @@ test('test-widgets',
     ['test-widgets.c', 'test-utils.c', test_widgets_resources],
     dependencies: [rhythmbox_core_dep, check]),
   depends: gschemas_compiled,
-  env: ['CK_DEFAULT_TIMEOUT=0'],
+  env: test_env,
 )
 
 executable('bench-rhythmdb-load',


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