From 5bccd359062cfd613be469c5ec107000be491382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 24 Feb 2023 04:32:08 +0100 Subject: [PATCH] tests: Add default test setup with common env settings Add common test environment variables to a default test setup so that they don't need to be repeated everywhere. Also ensures that we're always using the gsettings memory backend to never interfere with local environment. Part-of: --- meson.build | 10 ++++++++++ src/st/meson.build | 1 - tests/meson.build | 6 +----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 964a9229f..56a6b5a5a 100644 --- a/meson.build +++ b/meson.build @@ -276,6 +276,16 @@ if get_option('extensions_app') ) endif +if get_option('tests') + common_test_env = environment() + common_test_env.set('GSETTINGS_SCHEMA_DIR', meson.project_build_root() / 'data') + common_test_env.set('GSETTINGS_BACKEND', 'memory') + + add_test_setup('default', + is_default: true, + env: common_test_env, + ) +endif po_dir = join_paths(meson.current_source_dir(), 'po') diff --git a/src/st/meson.build b/src/st/meson.build index 446025734..456860d56 100644 --- a/src/st/meson.build +++ b/src/st/meson.build @@ -206,7 +206,6 @@ if get_option('tests') test('CSS styling support', test_theme, workdir: meson.current_source_dir(), - env: ['GSETTINGS_BACKEND=memory'] ) endif diff --git a/tests/meson.build b/tests/meson.build index 2f96a7325..c0f461f7c 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -18,9 +18,6 @@ dbus_runner = configure_file( configuration: dbusrunnerconf, ) -testenv = environment() -testenv.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.project_build_root(), 'data')) - tests = [ 'highlighter', 'insertSorted', @@ -35,7 +32,6 @@ tests = [ foreach test : tests test(test, run_test, args: 'unit/@0@.js'.format(test), - env: testenv, workdir: meson.current_source_dir()) endforeach @@ -54,7 +50,7 @@ libgvc_path = fs.parent(libgvc.get_variable('libgvc').full_path()) background_file = files(join_paths('data', 'background.png')) -perf_testenv = testenv +perf_testenv = environment() perf_testenv.set('G_DEBUG', 'fatal-warnings') perf_testenv.set('G_MESSAGES_DEBUG', 'GNOME Shell') perf_testenv.set('GNOME_SHELL_DATADIR', data_builddir)