From f456e311cd137156a6a1895d28dbd2871d022a03 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 16 Jul 2018 11:52:53 -0400 Subject: [PATCH] Meson: Use environment() for test_env --- gio/tests/meson.build | 11 +++++------ glib/tests/meson.build | 14 ++++++-------- gobject/tests/meson.build | 14 ++++++-------- tests/meson.build | 11 +++++------ 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/gio/tests/meson.build b/gio/tests/meson.build index 41770e47c..85d31d622 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -79,12 +79,11 @@ test_extra_programs = [ ['gdbus-testserver'], ] -test_env = [ - 'G_TEST_SRCDIR=' + meson.current_source_dir(), - 'G_TEST_BUILDDIR=' + meson.current_build_dir(), - 'GIO_MODULE_DIR=', - 'GIO_LAUNCH_DESKTOP=' + meson.build_root() + '/gio/gio-launch-desktop', -] +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', '') +test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop') test_c_args = [ '-DG_LOG_DOMAIN="GLib-GIO"', diff --git a/glib/tests/meson.build b/glib/tests/meson.build index a2c6973a0..b1c4a42bd 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -90,17 +90,15 @@ if cc.get_id() != 'msvc' glib_tests += [ 'autoptr' ] endif -# FIXME: use new environment() object # Not entirely random of course, but at least it changes over time random_number = minor_version + meson.version().split('.').get(1).to_int() -test_env = [ - 'G_TEST_SRCDIR=' + meson.current_source_dir(), - 'G_TEST_BUILDDIR=' + meson.current_build_dir(), - 'G_DEBUG=gc-friendly', - 'MALLOC_CHECK_=2', - 'MALLOC_PERTURB_=@0@'.format(random_number % 256), -] +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('G_DEBUG', 'gc-friendly') +test_env.set('MALLOC_CHECK_', '2') +test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) test_cargs = ['-DG_LOG_DOMAIN="GLib"'] diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build index 252b5ecf8..53b76d3eb 100644 --- a/gobject/tests/meson.build +++ b/gobject/tests/meson.build @@ -20,18 +20,16 @@ gobject_tests = [ 'ifaceproperties', ] -# FIXME: use new environment() object # FIXME: put common bits of test environment() in one location # Not entirely random of course, but at least it changes over time random_number = minor_version + meson.version().split('.').get(1).to_int() -test_env = [ - 'G_TEST_SRCDIR=' + meson.current_source_dir(), - 'G_TEST_BUILDDIR=' + meson.current_build_dir(), - 'G_DEBUG=gc-friendly', - 'MALLOC_CHECK_=2', - 'MALLOC_PERTURB_=@0@'.format(random_number % 256), -] +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('G_DEBUG', 'gc-friendly') +test_env.set('MALLOC_CHECK_', '2') +test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256)) foreach test_name : gobject_tests deps = [libm, thread_dep, libglib_dep, libgobject_dep] diff --git a/tests/meson.build b/tests/meson.build index 03997a634..3beb4c68a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,11 +1,10 @@ # tests -test_env = [ - 'G_TEST_SRCDIR=' + meson.current_source_dir(), - 'G_TEST_BUILDDIR=' + meson.current_build_dir(), - 'G_DEBUG=gc-friendly', - 'MALLOC_CHECK_=2', -] +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('G_DEBUG', 'gc-friendly') +test_env.set('MALLOC_CHECK_', '2') test_cargs = ['-DG_LOG_DOMAIN="GLib"'] -- 2.11.4.GIT