meson: Use test setup environment instead of repeating it everywhere

This commit is contained in:
Marco Trevisan (Treviño) 2022-10-20 02:24:04 +02:00
parent 3e227fb528
commit 3c56d661d8
6 changed files with 17 additions and 14 deletions

View File

@ -156,7 +156,7 @@ python_tests = {
'codegen.py' : { 'can_fail' : host_system == 'freebsd' },
}
test_env = environment(common_test_env)
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('GIO_MODULE_DIR', '')

View File

@ -264,7 +264,7 @@ if installed_tests_enabled
)
endif
test_env = environment(common_test_env)
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())

View File

@ -59,7 +59,7 @@ if glib_build_shared
endforeach
endif
test_env = environment(common_test_env)
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())

View File

@ -131,7 +131,7 @@ python_tests = {
'mkenums.py' : {},
}
test_env = environment(common_test_env)
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())

View File

@ -3,7 +3,7 @@ gobject_tests = {
'performance-threaded' : { 'args' : [ '--seconds', '0' ] },
}
test_env = environment(common_test_env)
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())

View File

@ -129,12 +129,23 @@ installed_tests_template_tap = files('tests/template-tap.test.in')
# Dont build the tests unless we can run them (either natively, in an exe wrapper, or by installing them for later use)
build_tests = get_option('tests') and (meson.can_run_host_binaries() or installed_tests_enabled)
common_test_env = [
'G_DEBUG=gc-friendly',
'G_ENABLE_DIAGNOSTIC=1',
'MALLOC_CHECK_=2',
]
test_timeout = 60
test_timeout_slow = 180
add_test_setup('default',
is_default: true,
exclude_suites: ['flaky', 'failing'],
env: common_test_env,
)
add_test_setup('unstable_tests',
env: common_test_env,
# Empty test setup, used for having different results set for flaky tests
# Sadly we can't use (https://github.com/mesonbuild/meson/issues/10934):
#suites: ['flaky', 'unstable']
@ -160,6 +171,7 @@ if valgrind.found()
'--suppressions=@0@'.format(meson.project_source_root() /
'@0@'.format(suppression_file[0])),
],
env: common_test_env,
timeout_multiplier: 10,
)
endif
@ -2332,15 +2344,6 @@ if want_systemtap and enable_dtrace
enable_systemtap = true
endif
common_test_env = [
'G_DEBUG=gc-friendly',
'G_ENABLE_DIAGNOSTIC=1',
'MALLOC_CHECK_=2',
]
test_timeout = 60
test_timeout_slow = 180
pkg = import('pkgconfig')
windows = import('windows')
subdir('tools')