summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2022-10-31 14:28:02 +0000
committerPhilip Withnall <philip@tecnocode.co.uk>2022-10-31 14:28:02 +0000
commitcbf17c9422115e42e4253403209e77211a3fce89 (patch)
treecaedfaffb53a9a1fdf6e2c592f51bf5f8432d10c
parent4339df05831db572ba39add959b71de74bd31094 (diff)
parent584a4f64c98ef92448ce4626e5ca459076abe8f6 (diff)
downloadglib-cbf17c9422115e42e4253403209e77211a3fce89.tar.gz
Merge branch 'wip/3v1n0/support-can-fail-tests' into 'main'
meson, ci: Support tests that can fail under certain conditions See merge request GNOME/glib!2987
-rw-r--r--.gitlab-ci.yml42
-rwxr-xr-x.gitlab-ci/coverage-docker.sh2
-rwxr-xr-x.gitlab-ci/run-tests.sh9
-rw-r--r--.gitlab-ci/test-msvc.bat13
-rwxr-xr-x.gitlab-ci/test-msys2.sh5
-rw-r--r--docs/reference/meson.build10
-rw-r--r--gio/glocalfileinfo.c5
-rw-r--r--gio/meson.build2
-rw-r--r--gio/tests/gdbus-object-manager-example/meson.build2
-rw-r--r--gio/tests/meson.build47
-rw-r--r--glib/meson.build2
-rw-r--r--glib/tests/meson.build46
-rw-r--r--gmodule/tests/meson.build11
-rw-r--r--gobject/meson.build2
-rw-r--r--gobject/tests/meson.build28
-rw-r--r--gobject/tests/performance/meson.build6
-rw-r--r--meson.build124
17 files changed, 277 insertions, 79 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4dcab274e..a8da418ce 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,7 +15,7 @@ variables:
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v13"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v9"
- MESON_TEST_TIMEOUT_MULTIPLIER: 2
+ MESON_TEST_TIMEOUT_MULTIPLIER: 4
G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
@@ -100,7 +100,9 @@ fedora-x86_64:
- lcov --config-file .lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -141,7 +143,9 @@ debian-stable-x86_64:
- .gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -207,7 +211,9 @@ G_DISABLE_ASSERT:
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -282,7 +288,9 @@ cross-mingw64:
- ninja -C _build
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -310,7 +318,9 @@ msys2-mingw32:
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -355,7 +365,9 @@ vs2017-x64:
--python.purelibdir=C:\Python37\site-packages
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -383,7 +395,9 @@ vs2017-x64-static:
--python.purelibdir=C:\Python37\site-packages
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -425,7 +439,9 @@ freebsd-12-x86_64:
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -452,7 +468,9 @@ freebsd-13-x86_64:
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
@@ -492,7 +510,9 @@ macos:
- .gitlab-ci/run-tests.sh
artifacts:
reports:
- junit: "_build/meson-logs/testlog.junit.xml"
+ junit:
+ - _build/meson-logs/testlog.junit.xml
+ - _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
diff --git a/.gitlab-ci/coverage-docker.sh b/.gitlab-ci/coverage-docker.sh
index 0b9abc017..81d49e4c3 100755
--- a/.gitlab-ci/coverage-docker.sh
+++ b/.gitlab-ci/coverage-docker.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-set -e
+set -ex
# Fixup Windows paths
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh
index d742a34ca..461f31f6e 100755
--- a/.gitlab-ci/run-tests.sh
+++ b/.gitlab-ci/run-tests.sh
@@ -1,11 +1,16 @@
#!/bin/bash
-set -e
+set -ex
./.gitlab-ci/check-missing-install-tag.py _build
meson test \
-C _build \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
- --no-suite flaky \
"$@"
+
+# Run only the flaky tests, so we can log the failures but without hard failing
+meson test \
+ -C _build \
+ --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
+ "$@" --setup=unstable_tests --suite=failing --suite=flaky || true
diff --git a/.gitlab-ci/test-msvc.bat b/.gitlab-ci/test-msvc.bat
index 82e445e00..1ad2e4a57 100644
--- a/.gitlab-ci/test-msvc.bat
+++ b/.gitlab-ci/test-msvc.bat
@@ -17,11 +17,20 @@ meson %args% _build || goto :error
python .gitlab-ci/check-missing-install-tag.py _build || goto :error
ninja -C _build || goto :error
-:: FIXME: dont ignore test errors
-meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --no-suite flaky
+meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% || goto :error
+meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --setup=unstable_tests --suite=failing --suite=flaky
+
+:: Workaround meson issue https://github.com/mesonbuild/meson/issues/9894
+python -c "n = '_build/meson-logs/testlog.junit.xml'; c = open(n, 'rb').read().replace(b'\x1b', b''); open(n, 'wb').write(c)" || goto :error
+python -c "n = '_build/meson-logs/testlog-unstable_tests.junit.xml'; c = open(n, 'rb').read().replace(b'\x1b', b''); open(n, 'wb').write(c)" || goto :error
:: FIXME: can we get code coverage support?
goto :EOF
:error
+
+:: Workaround meson issue https://github.com/mesonbuild/meson/issues/9894
+python -c "n = '_build/meson-logs/testlog.junit.xml'; c = open(n, 'rb').read().replace(b'\x1b', b''); open(n, 'wb').write(c)"
+python -c "n = '_build/meson-logs/testlog-unstable_tests.junit.xml'; c = open(n, 'rb').read().replace(b'\x1b', b''); open(n, 'wb').write(c)"
+
exit /b 1
diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh
index 85394a754..8b24c243d 100755
--- a/.gitlab-ci/test-msys2.sh
+++ b/.gitlab-ci/test-msys2.sh
@@ -54,8 +54,9 @@ if [[ "$CFLAGS" == *"-coverage"* ]]; then
--output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov"
fi
-# FIXME: fix the test suite
-meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" --no-suite flaky || true
+meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}"
+meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
+ --setup=unstable_tests --suite=failing --suite=flaky || true
if [[ "$CFLAGS" == *"-coverage"* ]]; then
lcov \
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index fb4b26bc9..c417ffecb 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -45,12 +45,12 @@ if get_option('gtk_doc')
dependency('gtk-doc', version : '>=1.32.1',
fallback : ['gtk-doc', 'dummy_dep'],
default_options : ['tests=false'])
-endif
-# We cannot built the API reference off of a static library,
-# as symbols might get dropped by the linker
-if get_option('gtk_doc') and get_option('default_library') == 'static'
- error('The API reference can only be built against a shared library')
+ # We cannot built the API reference off of a static library,
+ # as symbols might get dropped by the linker
+ if not glib_build_shared
+ error('The API reference can only be built against a shared library')
+ endif
endif
subdir('gio')
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 628ea236b..cb93d7638 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -1385,7 +1385,10 @@ get_content_type (const char *basename,
{
guchar sniff_buffer[4096];
gsize sniff_length;
- int fd, errsv;
+#ifdef O_NOATIME
+ int errsv;
+#endif
+ int fd;
sniff_length = _g_unix_content_type_get_sniff_len ();
if (sniff_length == 0 || sniff_length > 4096)
diff --git a/gio/meson.build b/gio/meson.build
index d16fc5230..a51926fcf 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -601,7 +601,7 @@ gio_sources = files(
'gliststore.c',
)
-if get_option('default_library') != 'static'
+if glib_build_shared
gio_sources += files ('../glib/gtrace.c')
endif
diff --git a/gio/tests/gdbus-object-manager-example/meson.build b/gio/tests/gdbus-object-manager-example/meson.build
index c26238f5f..ac5e6d4df 100644
--- a/gio/tests/gdbus-object-manager-example/meson.build
+++ b/gio/tests/gdbus-object-manager-example/meson.build
@@ -39,7 +39,7 @@ gdbus_example_objectmanager_rst_gen = custom_target('objectmanager-rst-gen',
)
extra_c_args = []
-if get_option('default_library') == 'static'
+if glib_build_static_only
extra_c_args = '-DGDBUS_OBJECT_MANAGER_EXAMPLE_STATIC_COMPILATION'
endif
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index 5e8b6ad19..22746c97e 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
@@ -46,7 +46,7 @@ giotypefuncs_inc = custom_target(
gio_tests = {
'appmonitor' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
- 'should_fail' : host_system == 'darwin',
+ 'can_fail' : host_system == 'darwin',
},
'async-close-output-stream' : {},
'async-splice-output-stream' : {},
@@ -56,7 +56,7 @@ gio_tests = {
'contexts' : {},
'contenttype' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 / https://gitlab.gnome.org/GNOME/glib/-/issues/1251
- 'should_fail' : host_system == 'darwin',
+ 'can_fail' : host_system == 'darwin',
},
'converter-stream' : {},
'credentials' : {},
@@ -67,9 +67,13 @@ gio_tests = {
'fileattributematcher' : {},
'filter-streams' : {},
'giomodule' : {},
- 'gsubprocess' : {},
+ 'gsubprocess' : {
+ 'suite': host_system == 'windows' ? ['flaky'] : [],
+ },
'g-file' : {},
- 'g-file-info' : {},
+ 'g-file-info' : {
+ 'can_fail' : host_system == 'windows' and cc.get_id() != 'gcc',
+ },
'g-icon' : {},
'gdbus-addresses' : {},
'gdbus-message' : {},
@@ -77,7 +81,7 @@ gio_tests = {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install_rpath' : installed_tests_execdir,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
- 'should_fail' : host_system == 'darwin',
+ 'can_fail' : host_system in ['darwin', 'windows'],
},
'inet-address' : {},
'io-stream' : {},
@@ -101,7 +105,7 @@ gio_tests = {
'sleepy-stream' : {},
'socket' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
- 'should_fail' : host_system == 'darwin',
+ 'can_fail' : host_system == 'darwin',
},
'socket-listener' : {},
'socket-service' : {},
@@ -119,7 +123,7 @@ gio_tests = {
'unix-fd' : {},
'gdbus-address-get-session' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
- 'should_fail' : host_system == 'darwin',
+ 'can_fail' : host_system == 'darwin',
},
'win32-appinfo' : {},
}
@@ -149,11 +153,12 @@ test_extra_programs = {
'gsubprocess-testprog' : {},
}
-python_tests = [
- 'codegen.py',
-]
+python_tests = {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/2764
+ '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', '')
@@ -222,7 +227,7 @@ if host_machine.system() != 'windows'
}
# LD_PRELOAD modules don't work so well with AddressSanitizer
- if have_rtld_next and get_option('default_library') != 'static' and get_option('b_sanitize') == 'none'
+ if have_rtld_next and glib_build_shared and get_option('b_sanitize') == 'none'
gio_tests += {
'gsocketclient-slow' : {
'depends' : [
@@ -651,7 +656,7 @@ if meson.can_run_host_binaries()
compiler_type = '--compiler=@0@'.format(cc.get_id())
- if get_option('default_library') != 'static'
+ if glib_build_shared
plugin_resources_c = custom_target('plugin-resources.c',
input : 'test4.gresource.xml',
output : 'plugin-resources.c',
@@ -907,6 +912,10 @@ foreach test_name, extra_args : gio_tests
local_test_env.append(var, value)
endforeach
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
test(test_name, exe,
env : local_test_env,
timeout : timeout,
@@ -930,13 +939,19 @@ foreach program_name, extra_args : test_extra_programs
)
endforeach
-foreach test_name : python_tests
+foreach test_name, extra_args : python_tests
+ suite = ['gio', 'no-valgrind']
+
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
test(
test_name,
python,
args: ['-B', files(test_name)],
env: test_env,
- suite: ['gio', 'no-valgrind'],
+ suite: suite,
)
if installed_tests_enabled
@@ -972,6 +987,6 @@ endif
subdir('services')
-if get_option('default_library') != 'static'
+if glib_build_shared
subdir('modules')
endif
diff --git a/glib/meson.build b/glib/meson.build
index ad1a61aff..4130b1ba6 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -348,7 +348,7 @@ glib_sources += files(
platform_deps = []
if host_system == 'windows'
- if get_option('default_library') == 'shared'
+ if glib_build_shared
glib_win_rc = configure_file(
input: 'glib.rc.in',
output: 'glib.rc',
diff --git a/glib/tests/meson.build b/glib/tests/meson.build
index a9d8c4951..1f1275d80 100644
--- a/glib/tests/meson.build
+++ b/glib/tests/meson.build
@@ -18,17 +18,21 @@ glib_tests = {
'dataset' : {},
'date' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
- 'should_fail' : host_system == 'darwin',
+ 'can_fail' : host_system == 'darwin',
},
'dir' : {},
'environment' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
- 'should_fail' : host_system == 'darwin',
+ 'can_fail' : host_system == 'darwin',
},
'error' : {},
- 'fileutils' : {},
+ 'fileutils' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/2800
+ 'can_fail' : host_system == 'windows' and cc.get_id() == 'msvc',
+ },
'gdatetime' : {
'suite' : ['slow'],
+ 'can_fail' : host_system == 'windows',
},
'guuid' : {},
'gvariant' : {
@@ -111,12 +115,17 @@ glib_tests = {
'slice-eager-freeing' : {},
'slist' : {},
'sort' : {},
- 'spawn-multithreaded' : {},
+ 'spawn-multithreaded' : {
+ 'can_fail': glib_build_static and host_system == 'windows',
+ 'suite': host_system == 'windows' ? ['flaky'] : [],
+ },
'spawn-path-search' : {},
'spawn-singlethread' : {
'dependencies' : [winsock2],
},
- 'spawn-test' : {},
+ 'spawn-test' : {
+ 'can_fail': host_system == 'windows' and cc.get_id() == 'gcc',
+ },
'strfuncs' : {},
'string' : {},
'strvbuilder' : {},
@@ -205,7 +214,7 @@ else
'include' : {},
'unix' : {},
}
- if have_rtld_next and get_option('default_library') != 'static'
+ if have_rtld_next and glib_build_shared
glib_tests += {
'gutils-user-database' : {
'depends' : [
@@ -259,7 +268,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())
@@ -297,6 +306,11 @@ foreach test_name, extra_args : glib_tests
suite = ['glib'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
+
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
test(test_name, exe,
env : test_env,
timeout : timeout,
@@ -313,9 +327,11 @@ if installed_tests_enabled
)
endif
-python_tests = [
- 'assert-msg-test.py',
-]
+python_tests = {
+ 'assert-msg-test.py' : {
+ 'can_fail' : host_system == 'windows',
+ },
+}
executable('assert-msg-test', ['assert-msg-test.c'],
c_args : test_cargs,
@@ -326,13 +342,19 @@ executable('assert-msg-test', ['assert-msg-test.c'],
win_subsystem : extra_args.get('win_subsystem', 'console'),
)
-foreach test_name : python_tests
+foreach test_name, extra_args : python_tests
+ suite = ['glib', 'no-valgrind']
+
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
test(
test_name,
python,
args: ['-B', files(test_name)],
env: test_env,
- suite: ['glib', 'no-valgrind'],
+ suite: suite,
)
if installed_tests_enabled
diff --git a/gmodule/tests/meson.build b/gmodule/tests/meson.build
index 9e4f5a39d..b9a0ee6f4 100644
--- a/gmodule/tests/meson.build
+++ b/gmodule/tests/meson.build
@@ -4,11 +4,13 @@ gmodule_tests = {
'export_dynamic' : true,
'source': 'module-test.c',
'c_args': ['-DMODULE_TYPE="library"'],
+ 'can_fail': glib_build_static and host_system == 'windows',
},
'module-test-plugin' : {
'export_dynamic' : true,
'source': 'module-test.c',
'c_args': ['-DMODULE_TYPE="plugin"'],
+ 'can_fail': glib_build_static and host_system == 'windows',
},
}
@@ -38,7 +40,7 @@ if ['darwin', 'ios'].contains(host_machine.system())
module_suffix = 'so'
endif
-if get_option('default_library') != 'static'
+if glib_build_shared
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
shared_module(module + '_plugin', 'lib@0@.c'.format(module),
dependencies : [libglib_dep, libgmodule_dep],
@@ -57,7 +59,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())
@@ -96,5 +98,10 @@ foreach test_name, extra_args : gmodule_tests
suite = ['gmodule'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
+
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach
diff --git a/gobject/meson.build b/gobject/meson.build
index 0dd955f66..565f22875 100644
--- a/gobject/meson.build
+++ b/gobject/meson.build
@@ -62,7 +62,7 @@ gobject_sources += files(
'gvaluetypes.c',
)
-if host_system == 'windows' and get_option('default_library') == 'shared'
+if host_system == 'windows' and glib_build_shared
gobject_win_rc = configure_file(
input: 'gobject.rc.in',
output: 'gobject.rc',
diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build
index 8475b3aa2..219989848 100644
--- a/gobject/tests/meson.build
+++ b/gobject/tests/meson.build
@@ -123,13 +123,15 @@ if cc.get_id() != 'msvc'
gobject_tests += {'autoptr' : {}}
endif
-python_tests = [
- 'genmarshal.py',
- 'gobject-query.py',
- 'mkenums.py',
-]
+python_tests = {
+ 'genmarshal.py' : {},
+ 'gobject-query.py' : {
+ 'can_fail' : host_system == 'windows',
+ },
+ '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())
@@ -167,6 +169,10 @@ foreach test_name, extra_args : gobject_tests
suite = ['gobject'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
# FIXME: https://gitlab.gnome.org/GNOME/glib/issues/1316
# aka https://bugs.debian.org/880883
if test_name == 'closure-refcount' and ['arm', 'aarch64'].contains(host_machine.cpu_family())
@@ -176,13 +182,19 @@ foreach test_name, extra_args : gobject_tests
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach
-foreach test_name : python_tests
+foreach test_name, extra_args : python_tests
+ suite = ['gobject', 'no-valgrind']
+
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
test(
test_name,
python,
args: ['-B', files(test_name)],
env: test_env,
- suite: ['gobject', 'no-valgrind'],
+ suite: suite,
)
if installed_tests_enabled
diff --git a/gobject/tests/performance/meson.build b/gobject/tests/performance/meson.build
index 01b6af534..f747e42ae 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())
@@ -40,6 +40,10 @@ foreach test_name, extra_args : gobject_tests
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
args = extra_args.get('args', [])
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
test(test_name, exe,
env : test_env,
timeout : timeout,
diff --git a/meson.build b/meson.build
index 1b2601791..7b543911b 100644
--- a/meson.build
+++ b/meson.build
@@ -129,13 +129,37 @@ 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 = 30
+test_timeout_slow = 90
+
+add_test_setup('default',
+ is_default: true,
+ exclude_suites: ['flaky', 'failing'],
+ env: common_test_env,
+ timeout_multiplier: 2,
+)
+
+add_test_setup('unstable_tests',
+ env: common_test_env,
+ timeout_multiplier: 2,
+ # 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']
+)
+
# Allow the tests to be easily run under valgrind using --setup=valgrind
valgrind = find_program('valgrind', required: false)
if valgrind.found()
suppression_file = files('tools' / 'glib.supp')
add_test_setup('valgrind',
- exclude_suites: [ 'no-valgrind' ],
+ exclude_suites: [ 'no-valgrind', 'flaky' ],
exe_wrapper: [
valgrind,
'--tool=memcheck',
@@ -149,7 +173,8 @@ if valgrind.found()
'--suppressions=@0@'.format(meson.project_source_root() /
'@0@'.format(suppression_file[0])),
],
- timeout_multiplier: 10,
+ env: common_test_env,
+ timeout_multiplier: 20,
)
endif
@@ -210,11 +235,27 @@ if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-
glib_conf.set('_FILE_OFFSET_BITS', 64)
endif
-if get_option('default_library') == 'both' and (host_system == 'windows' or host_system == 'cygwin')
+glib_build_shared = false
+glib_build_static = false
+if get_option('default_library') == 'both'
+ glib_build_static = true
+ glib_build_shared = true
+elif get_option('default_library') == 'static'
+ glib_build_static = true
+elif get_option('default_library') == 'shared'
+ glib_build_shared = true
+endif
+
+glib_build_both = glib_build_static and glib_build_shared
+glib_build_static_only = glib_build_static and not glib_build_shared
+glib_build_shared_only = glib_build_shared and not glib_build_static
+
+if glib_build_shared and glib_build_static and (
+ host_system == 'windows' or host_system == 'cygwin')
error('On Windows default_library must be "shared" or "static" but not "both"')
endif
-if get_option('default_library') == 'static'
+if glib_build_static_only
glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1')
glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1')
glibconfig_conf.set('GIO_STATIC_COMPILATION', '1')
@@ -2306,14 +2347,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')
@@ -2360,3 +2393,70 @@ endif
gnome = import('gnome')
subdir('docs/reference')
+
+summary({
+ 'host cpu' : host_machine.cpu_family(),
+ 'host endian' : host_machine.endian(),
+ 'host system' : host_system,
+ 'C Compiler' : cc.get_id(),
+ 'C++ Compiler' : have_cxx ? cxx.get_id() : 'none',
+ 'shared build' : glib_build_shared,
+ 'static build' : glib_build_static,
+}, section: 'Build environment')
+
+if build_machine.system() != host_system
+ summary({
+ 'build cpu' : build_machine.cpu_family(),
+ 'build endian' : build_machine.endian(),
+ 'build system' : build_machine.system(),
+ }, section: 'Build environment')
+endif
+
+summary({
+ 'prefix' : glib_prefix,
+ 'bindir' : glib_bindir,
+ 'libexecdir' : glib_libexecdir,
+ 'pkgdatadir' : glib_pkgdatadir,
+ 'datadir' : glib_datadir,
+ 'includedir' : glib_includedir,
+ 'giomodulesdir' : glib_giomodulesdir,
+ 'localstatedir' : glib_localstatedir,
+}, section: 'Directories')
+
+if get_option('multiarch')
+ summary({
+ 'multiarch bindir' : glib_bindir,
+ 'multiarch libexecdir' : glib_libexecdir,
+ }, section: 'Directories')
+endif
+
+if enable_systemtap
+ summary('tapset dir', get_option('tapset_install_dir'), section: 'Directories')
+endif
+
+if host_system == 'linux'
+ summary({
+ 'selinux' : selinux_dep.found(),
+ 'libmount' : libmount_dep.found(),
+ }, section: 'Options')
+endif
+
+summary({
+ 'xattr' : xattr_dep.length() > 0,
+ 'man' : get_option('man'),
+ 'dtrace' : get_option('dtrace'),
+ 'systemtap' : enable_systemtap,
+ 'sysprof' : libsysprof_capture_dep.found(),
+ 'gtk_doc' : get_option('gtk_doc'),
+ 'bsymbolic_functions' : get_option('bsymbolic_functions'),
+ 'force_posix_threads' : get_option('force_posix_threads'),
+ 'tests' : get_option('tests'),
+ 'installed_tests' : get_option('installed_tests'),
+ 'nls' : get_option('nls'),
+ 'oss_fuzz' : get_option('oss_fuzz'),
+ 'glib_debug' : get_option('glib_debug'),
+ 'glib_assert' : get_option('glib_assert'),
+ 'glib_checks' : get_option('glib_checks'),
+ 'libelf' : get_option('libelf'),
+ 'multiarch' : get_option('multiarch'),
+}, section: 'Options')