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
This commit is contained in:
Philip Withnall
2022-10-31 14:28:02 +00:00
17 changed files with 277 additions and 79 deletions

View File

@@ -15,7 +15,7 @@ variables:
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7" COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v13" DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v13"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v9" MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v9"
MESON_TEST_TIMEOUT_MULTIPLIER: 2 MESON_TEST_TIMEOUT_MULTIPLIER: 4
G_MESSAGES_DEBUG: all G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings" 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" - lcov --config-file .lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
artifacts: artifacts:
reports: 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}" name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -141,7 +143,9 @@ debian-stable-x86_64:
- .gitlab-ci/run-tests.sh - .gitlab-ci/run-tests.sh
artifacts: artifacts:
reports: 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}" name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -207,7 +211,9 @@ G_DISABLE_ASSERT:
- bash -x ./.gitlab-ci/run-tests.sh - bash -x ./.gitlab-ci/run-tests.sh
artifacts: artifacts:
reports: 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}" name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -282,7 +288,9 @@ cross-mingw64:
- ninja -C _build - ninja -C _build
artifacts: artifacts:
reports: 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}" name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -310,7 +318,9 @@ msys2-mingw32:
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh" - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
artifacts: artifacts:
reports: 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}" name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -355,7 +365,9 @@ vs2017-x64:
--python.purelibdir=C:\Python37\site-packages --python.purelibdir=C:\Python37\site-packages
artifacts: artifacts:
reports: 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}" name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -383,7 +395,9 @@ vs2017-x64-static:
--python.purelibdir=C:\Python37\site-packages --python.purelibdir=C:\Python37\site-packages
artifacts: artifacts:
reports: 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}" name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -425,7 +439,9 @@ freebsd-12-x86_64:
- bash -x ./.gitlab-ci/run-tests.sh - bash -x ./.gitlab-ci/run-tests.sh
artifacts: artifacts:
reports: 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}" name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -452,7 +468,9 @@ freebsd-13-x86_64:
- bash -x ./.gitlab-ci/run-tests.sh - bash -x ./.gitlab-ci/run-tests.sh
artifacts: artifacts:
reports: 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}" name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week
@@ -492,7 +510,9 @@ macos:
- .gitlab-ci/run-tests.sh - .gitlab-ci/run-tests.sh
artifacts: artifacts:
reports: 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}" name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always when: always
expire_in: 1 week expire_in: 1 week

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
set -e set -ex
# Fixup Windows paths # Fixup Windows paths
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov

View File

@@ -1,11 +1,16 @@
#!/bin/bash #!/bin/bash
set -e set -ex
./.gitlab-ci/check-missing-install-tag.py _build ./.gitlab-ci/check-missing-install-tag.py _build
meson test \ meson test \
-C _build \ -C _build \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \ --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

View File

@@ -17,11 +17,20 @@ meson %args% _build || goto :error
python .gitlab-ci/check-missing-install-tag.py _build || goto :error python .gitlab-ci/check-missing-install-tag.py _build || goto :error
ninja -C _build || goto :error ninja -C _build || goto :error
:: FIXME: dont ignore test errors meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% || goto :error
meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --no-suite flaky 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? :: FIXME: can we get code coverage support?
goto :EOF goto :EOF
:error :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 exit /b 1

View File

@@ -54,8 +54,9 @@ if [[ "$CFLAGS" == *"-coverage"* ]]; then
--output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov" --output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov"
fi fi
# FIXME: fix the test suite meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}"
meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" --no-suite flaky || true meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--setup=unstable_tests --suite=failing --suite=flaky || true
if [[ "$CFLAGS" == *"-coverage"* ]]; then if [[ "$CFLAGS" == *"-coverage"* ]]; then
lcov \ lcov \

View File

@@ -45,12 +45,12 @@ if get_option('gtk_doc')
dependency('gtk-doc', version : '>=1.32.1', dependency('gtk-doc', version : '>=1.32.1',
fallback : ['gtk-doc', 'dummy_dep'], fallback : ['gtk-doc', 'dummy_dep'],
default_options : ['tests=false']) default_options : ['tests=false'])
endif
# We cannot built the API reference off of a static library, # We cannot built the API reference off of a static library,
# as symbols might get dropped by the linker # as symbols might get dropped by the linker
if get_option('gtk_doc') and get_option('default_library') == 'static' if not glib_build_shared
error('The API reference can only be built against a shared library') error('The API reference can only be built against a shared library')
endif
endif endif
subdir('gio') subdir('gio')

View File

@@ -1385,7 +1385,10 @@ get_content_type (const char *basename,
{ {
guchar sniff_buffer[4096]; guchar sniff_buffer[4096];
gsize sniff_length; gsize sniff_length;
int fd, errsv; #ifdef O_NOATIME
int errsv;
#endif
int fd;
sniff_length = _g_unix_content_type_get_sniff_len (); sniff_length = _g_unix_content_type_get_sniff_len ();
if (sniff_length == 0 || sniff_length > 4096) if (sniff_length == 0 || sniff_length > 4096)

View File

@@ -601,7 +601,7 @@ gio_sources = files(
'gliststore.c', 'gliststore.c',
) )
if get_option('default_library') != 'static' if glib_build_shared
gio_sources += files ('../glib/gtrace.c') gio_sources += files ('../glib/gtrace.c')
endif endif

View File

@@ -39,7 +39,7 @@ gdbus_example_objectmanager_rst_gen = custom_target('objectmanager-rst-gen',
) )
extra_c_args = [] extra_c_args = []
if get_option('default_library') == 'static' if glib_build_static_only
extra_c_args = '-DGDBUS_OBJECT_MANAGER_EXAMPLE_STATIC_COMPILATION' extra_c_args = '-DGDBUS_OBJECT_MANAGER_EXAMPLE_STATIC_COMPILATION'
endif endif

View File

@@ -46,7 +46,7 @@ giotypefuncs_inc = custom_target(
gio_tests = { gio_tests = {
'appmonitor' : { 'appmonitor' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin', 'can_fail' : host_system == 'darwin',
}, },
'async-close-output-stream' : {}, 'async-close-output-stream' : {},
'async-splice-output-stream' : {}, 'async-splice-output-stream' : {},
@@ -56,7 +56,7 @@ gio_tests = {
'contexts' : {}, 'contexts' : {},
'contenttype' : { 'contenttype' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 / https://gitlab.gnome.org/GNOME/glib/-/issues/1251 # 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' : {}, 'converter-stream' : {},
'credentials' : {}, 'credentials' : {},
@@ -67,9 +67,13 @@ gio_tests = {
'fileattributematcher' : {}, 'fileattributematcher' : {},
'filter-streams' : {}, 'filter-streams' : {},
'giomodule' : {}, 'giomodule' : {},
'gsubprocess' : {}, 'gsubprocess' : {
'suite': host_system == 'windows' ? ['flaky'] : [],
},
'g-file' : {}, 'g-file' : {},
'g-file-info' : {}, 'g-file-info' : {
'can_fail' : host_system == 'windows' and cc.get_id() != 'gcc',
},
'g-icon' : {}, 'g-icon' : {},
'gdbus-addresses' : {}, 'gdbus-addresses' : {},
'gdbus-message' : {}, 'gdbus-message' : {},
@@ -77,7 +81,7 @@ gio_tests = {
'dependencies' : [libgdbus_example_objectmanager_dep], 'dependencies' : [libgdbus_example_objectmanager_dep],
'install_rpath' : installed_tests_execdir, 'install_rpath' : installed_tests_execdir,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin', 'can_fail' : host_system in ['darwin', 'windows'],
}, },
'inet-address' : {}, 'inet-address' : {},
'io-stream' : {}, 'io-stream' : {},
@@ -101,7 +105,7 @@ gio_tests = {
'sleepy-stream' : {}, 'sleepy-stream' : {},
'socket' : { 'socket' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin', 'can_fail' : host_system == 'darwin',
}, },
'socket-listener' : {}, 'socket-listener' : {},
'socket-service' : {}, 'socket-service' : {},
@@ -119,7 +123,7 @@ gio_tests = {
'unix-fd' : {}, 'unix-fd' : {},
'gdbus-address-get-session' : { 'gdbus-address-get-session' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin', 'can_fail' : host_system == 'darwin',
}, },
'win32-appinfo' : {}, 'win32-appinfo' : {},
} }
@@ -149,11 +153,12 @@ test_extra_programs = {
'gsubprocess-testprog' : {}, 'gsubprocess-testprog' : {},
} }
python_tests = [ python_tests = {
'codegen.py', # 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_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('GIO_MODULE_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 # 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 += { gio_tests += {
'gsocketclient-slow' : { 'gsocketclient-slow' : {
'depends' : [ 'depends' : [
@@ -651,7 +656,7 @@ if meson.can_run_host_binaries()
compiler_type = '--compiler=@0@'.format(cc.get_id()) 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', plugin_resources_c = custom_target('plugin-resources.c',
input : 'test4.gresource.xml', input : 'test4.gresource.xml',
output : 'plugin-resources.c', output : 'plugin-resources.c',
@@ -907,6 +912,10 @@ foreach test_name, extra_args : gio_tests
local_test_env.append(var, value) local_test_env.append(var, value)
endforeach endforeach
if extra_args.get('can_fail', false)
suite += 'failing'
endif
test(test_name, exe, test(test_name, exe,
env : local_test_env, env : local_test_env,
timeout : timeout, timeout : timeout,
@@ -930,13 +939,19 @@ foreach program_name, extra_args : test_extra_programs
) )
endforeach 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(
test_name, test_name,
python, python,
args: ['-B', files(test_name)], args: ['-B', files(test_name)],
env: test_env, env: test_env,
suite: ['gio', 'no-valgrind'], suite: suite,
) )
if installed_tests_enabled if installed_tests_enabled
@@ -972,6 +987,6 @@ endif
subdir('services') subdir('services')
if get_option('default_library') != 'static' if glib_build_shared
subdir('modules') subdir('modules')
endif endif

View File

@@ -348,7 +348,7 @@ glib_sources += files(
platform_deps = [] platform_deps = []
if host_system == 'windows' if host_system == 'windows'
if get_option('default_library') == 'shared' if glib_build_shared
glib_win_rc = configure_file( glib_win_rc = configure_file(
input: 'glib.rc.in', input: 'glib.rc.in',
output: 'glib.rc', output: 'glib.rc',

View File

@@ -18,17 +18,21 @@ glib_tests = {
'dataset' : {}, 'dataset' : {},
'date' : { 'date' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin', 'can_fail' : host_system == 'darwin',
}, },
'dir' : {}, 'dir' : {},
'environment' : { 'environment' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin', 'can_fail' : host_system == 'darwin',
}, },
'error' : {}, 'error' : {},
'fileutils' : {}, 'fileutils' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/2800
'can_fail' : host_system == 'windows' and cc.get_id() == 'msvc',
},
'gdatetime' : { 'gdatetime' : {
'suite' : ['slow'], 'suite' : ['slow'],
'can_fail' : host_system == 'windows',
}, },
'guuid' : {}, 'guuid' : {},
'gvariant' : { 'gvariant' : {
@@ -111,12 +115,17 @@ glib_tests = {
'slice-eager-freeing' : {}, 'slice-eager-freeing' : {},
'slist' : {}, 'slist' : {},
'sort' : {}, 'sort' : {},
'spawn-multithreaded' : {}, 'spawn-multithreaded' : {
'can_fail': glib_build_static and host_system == 'windows',
'suite': host_system == 'windows' ? ['flaky'] : [],
},
'spawn-path-search' : {}, 'spawn-path-search' : {},
'spawn-singlethread' : { 'spawn-singlethread' : {
'dependencies' : [winsock2], 'dependencies' : [winsock2],
}, },
'spawn-test' : {}, 'spawn-test' : {
'can_fail': host_system == 'windows' and cc.get_id() == 'gcc',
},
'strfuncs' : {}, 'strfuncs' : {},
'string' : {}, 'string' : {},
'strvbuilder' : {}, 'strvbuilder' : {},
@@ -205,7 +214,7 @@ else
'include' : {}, 'include' : {},
'unix' : {}, 'unix' : {},
} }
if have_rtld_next and get_option('default_library') != 'static' if have_rtld_next and glib_build_shared
glib_tests += { glib_tests += {
'gutils-user-database' : { 'gutils-user-database' : {
'depends' : [ 'depends' : [
@@ -259,7 +268,7 @@ if installed_tests_enabled
) )
endif 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_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_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', []) suite = ['glib'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
if extra_args.get('can_fail', false)
suite += 'failing'
endif
test(test_name, exe, test(test_name, exe,
env : test_env, env : test_env,
timeout : timeout, timeout : timeout,
@@ -313,9 +327,11 @@ if installed_tests_enabled
) )
endif endif
python_tests = [ python_tests = {
'assert-msg-test.py', 'assert-msg-test.py' : {
] 'can_fail' : host_system == 'windows',
},
}
executable('assert-msg-test', ['assert-msg-test.c'], executable('assert-msg-test', ['assert-msg-test.c'],
c_args : test_cargs, c_args : test_cargs,
@@ -326,13 +342,19 @@ executable('assert-msg-test', ['assert-msg-test.c'],
win_subsystem : extra_args.get('win_subsystem', 'console'), 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(
test_name, test_name,
python, python,
args: ['-B', files(test_name)], args: ['-B', files(test_name)],
env: test_env, env: test_env,
suite: ['glib', 'no-valgrind'], suite: suite,
) )
if installed_tests_enabled if installed_tests_enabled

View File

@@ -4,11 +4,13 @@ gmodule_tests = {
'export_dynamic' : true, 'export_dynamic' : true,
'source': 'module-test.c', 'source': 'module-test.c',
'c_args': ['-DMODULE_TYPE="library"'], 'c_args': ['-DMODULE_TYPE="library"'],
'can_fail': glib_build_static and host_system == 'windows',
}, },
'module-test-plugin' : { 'module-test-plugin' : {
'export_dynamic' : true, 'export_dynamic' : true,
'source': 'module-test.c', 'source': 'module-test.c',
'c_args': ['-DMODULE_TYPE="plugin"'], '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' module_suffix = 'so'
endif endif
if get_option('default_library') != 'static' if glib_build_shared
foreach module : ['moduletestplugin_a', 'moduletestplugin_b'] foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
shared_module(module + '_plugin', 'lib@0@.c'.format(module), shared_module(module + '_plugin', 'lib@0@.c'.format(module),
dependencies : [libglib_dep, libgmodule_dep], dependencies : [libglib_dep, libgmodule_dep],
@@ -57,7 +59,7 @@ if get_option('default_library') != 'static'
endforeach endforeach
endif 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_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_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', []) suite = ['gmodule'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout 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) test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach endforeach

View File

@@ -62,7 +62,7 @@ gobject_sources += files(
'gvaluetypes.c', '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( gobject_win_rc = configure_file(
input: 'gobject.rc.in', input: 'gobject.rc.in',
output: 'gobject.rc', output: 'gobject.rc',

View File

@@ -123,13 +123,15 @@ if cc.get_id() != 'msvc'
gobject_tests += {'autoptr' : {}} gobject_tests += {'autoptr' : {}}
endif endif
python_tests = [ python_tests = {
'genmarshal.py', 'genmarshal.py' : {},
'gobject-query.py', 'gobject-query.py' : {
'mkenums.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_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_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', []) suite = ['gobject'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout 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 # FIXME: https://gitlab.gnome.org/GNOME/glib/issues/1316
# aka https://bugs.debian.org/880883 # aka https://bugs.debian.org/880883
if test_name == 'closure-refcount' and ['arm', 'aarch64'].contains(host_machine.cpu_family()) 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) test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach 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(
test_name, test_name,
python, python,
args: ['-B', files(test_name)], args: ['-B', files(test_name)],
env: test_env, env: test_env,
suite: ['gobject', 'no-valgrind'], suite: suite,
) )
if installed_tests_enabled if installed_tests_enabled

View File

@@ -3,7 +3,7 @@ gobject_tests = {
'performance-threaded' : { 'args' : [ '--seconds', '0' ] }, '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_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_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 timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
args = extra_args.get('args', []) args = extra_args.get('args', [])
if extra_args.get('can_fail', false)
suite += 'failing'
endif
test(test_name, exe, test(test_name, exe,
env : test_env, env : test_env,
timeout : timeout, timeout : timeout,

View File

@@ -129,13 +129,37 @@ 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) # 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) 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 # Allow the tests to be easily run under valgrind using --setup=valgrind
valgrind = find_program('valgrind', required: false) valgrind = find_program('valgrind', required: false)
if valgrind.found() if valgrind.found()
suppression_file = files('tools' / 'glib.supp') suppression_file = files('tools' / 'glib.supp')
add_test_setup('valgrind', add_test_setup('valgrind',
exclude_suites: [ 'no-valgrind' ], exclude_suites: [ 'no-valgrind', 'flaky' ],
exe_wrapper: [ exe_wrapper: [
valgrind, valgrind,
'--tool=memcheck', '--tool=memcheck',
@@ -149,7 +173,8 @@ if valgrind.found()
'--suppressions=@0@'.format(meson.project_source_root() / '--suppressions=@0@'.format(meson.project_source_root() /
'@0@'.format(suppression_file[0])), '@0@'.format(suppression_file[0])),
], ],
timeout_multiplier: 10, env: common_test_env,
timeout_multiplier: 20,
) )
endif 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) glib_conf.set('_FILE_OFFSET_BITS', 64)
endif 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"') error('On Windows default_library must be "shared" or "static" but not "both"')
endif endif
if get_option('default_library') == 'static' if glib_build_static_only
glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1') glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1')
glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1') glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1')
glibconfig_conf.set('GIO_STATIC_COMPILATION', '1') glibconfig_conf.set('GIO_STATIC_COMPILATION', '1')
@@ -2306,14 +2347,6 @@ if want_systemtap and enable_dtrace
enable_systemtap = true enable_systemtap = true
endif 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') pkg = import('pkgconfig')
windows = import('windows') windows = import('windows')
subdir('tools') subdir('tools')
@@ -2360,3 +2393,70 @@ endif
gnome = import('gnome') gnome = import('gnome')
subdir('docs/reference') 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')