[glib/wip/3v1n0/support-can-fail-tests: 6/6] meson: Use test setup environment instead of repeating it everywhere




commit 8c3d963e2b7497653d3cef2111116a6b89b22457
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Thu Oct 20 02:24:04 2022 +0200

    meson: Use test setup environment instead of repeating it everywhere

 gio/tests/meson.build                 |  2 +-
 glib/tests/meson.build                |  2 +-
 gmodule/tests/meson.build             |  2 +-
 gobject/tests/meson.build             |  2 +-
 gobject/tests/performance/meson.build |  2 +-
 meson.build                           | 21 ++++++++++++---------
 6 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index 752e414e0c..b98858c993 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
@@ -159,7 +159,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', '')
diff --git a/glib/tests/meson.build b/glib/tests/meson.build
index b54e8e178f..367e434c79 100644
--- a/glib/tests/meson.build
+++ b/glib/tests/meson.build
@@ -263,7 +263,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())
 
diff --git a/gmodule/tests/meson.build b/gmodule/tests/meson.build
index 67e108902e..72cddc7e85 100644
--- a/gmodule/tests/meson.build
+++ b/gmodule/tests/meson.build
@@ -58,7 +58,7 @@ if get_option('default_library') != 'static'
   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())
 
diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build
index da8e35ebea..99f4530bcf 100644
--- a/gobject/tests/meson.build
+++ b/gobject/tests/meson.build
@@ -130,7 +130,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())
 
diff --git a/gobject/tests/performance/meson.build b/gobject/tests/performance/meson.build
index 1e98a2728c..d15bbfbb93 100644
--- a/gobject/tests/performance/meson.build
+++ b/gobject/tests/performance/meson.build
@@ -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())
 
diff --git a/meson.build b/meson.build
index ce1ad7c008..d6207c642b 100644
--- a/meson.build
+++ b/meson.build
@@ -129,12 +129,23 @@ installed_tests_template_tap = files('tests/template-tap.test.in')
 # Don’t 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'],
+  env: common_test_env,
 )
 
 add_test_setup('flaky_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']
@@ -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
@@ -2342,15 +2354,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')


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