tests: Factor out additional env vars mechanism
Make the mechanism more general, so that other tests can now specify overrides for various defaults, if needed. This replicates what GLib does: https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/tests/meson.build#L475. It introduces no functional changes in how the current set of tests run. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3605>
This commit is contained in:
parent
a3d4198c85
commit
bba85e1fcd
@ -19,29 +19,30 @@ unit_testenv.append('GI_TYPELIB_PATH', gvc_typelib_path, separator: ':')
|
||||
unit_testenv.append('GI_TYPELIB_PATH', shell_typelib_path, separator: ':')
|
||||
unit_testenv.append('GI_TYPELIB_PATH', st_typelib_path, separator: ':')
|
||||
|
||||
unit_tests = [
|
||||
'breakManager',
|
||||
'extensionUtils',
|
||||
'highlighter',
|
||||
'injectionManager',
|
||||
'insertSorted',
|
||||
'jsParse',
|
||||
'markup',
|
||||
'params',
|
||||
'signalTracker',
|
||||
'timeLimitsManager',
|
||||
'url',
|
||||
'versionCompare',
|
||||
]
|
||||
unit_tests = {
|
||||
'breakManager': {},
|
||||
'extensionUtils': {},
|
||||
'highlighter': {},
|
||||
'injectionManager': {},
|
||||
'insertSorted': {},
|
||||
'jsParse': {},
|
||||
'markup': {},
|
||||
'params': {},
|
||||
'signalTracker': {},
|
||||
'timeLimitsManager': {
|
||||
# The time limits tests hard-code UTC to keep the code brief, so must be
|
||||
# run in UTC
|
||||
'env': { 'TZ': 'UTC' },
|
||||
},
|
||||
'url': {},
|
||||
'versionCompare': {},
|
||||
}
|
||||
|
||||
foreach test : unit_tests
|
||||
foreach test, extra_args : unit_tests
|
||||
local_test_env = unit_testenv
|
||||
|
||||
# The time limits tests hard-code UTC to keep the code brief, so must be run
|
||||
# in UTC
|
||||
if test == 'timeLimitsManager'
|
||||
local_test_env.set('TZ', 'UTC')
|
||||
endif
|
||||
foreach var, value : extra_args.get('env', {})
|
||||
local_test_env.append(var, value)
|
||||
endforeach
|
||||
|
||||
test(test, jasmine,
|
||||
args: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user