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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2661>
This commit is contained in:
Marco Trevisan (Treviño) 2023-02-24 04:32:08 +01:00 committed by Marge Bot
parent 43401b9d44
commit 5bccd35906
3 changed files with 11 additions and 6 deletions

View File

@ -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')

View File

@ -206,7 +206,6 @@ if get_option('tests')
test('CSS styling support', test_theme,
workdir: meson.current_source_dir(),
env: ['GSETTINGS_BACKEND=memory']
)
endif

View File

@ -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)