diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a3ed4434..352ebce70 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: registry.gitlab.gnome.org/gnome/glib/master:v7 +image: registry.gitlab.gnome.org/gnome/glib/master:v8 stages: - build @@ -12,6 +12,7 @@ cache: variables: MESON_TEST_TIMEOUT_MULTIPLIER: 2 G_MESSAGES_DEBUG: all + MESON_COMMON_OPTIONS: "--buildtype debug --fatal-meson-warnings" fedora-x86_64: stage: build @@ -20,7 +21,7 @@ fedora-x86_64: variables: CFLAGS: "-coverage -ftest-coverage -fprofile-arcs" script: - - meson --buildtype debug --werror -Dsystemtap=true -Ddtrace=true -Dfam=true _build . + - meson ${MESON_COMMON_OPTIONS} --werror -Dsystemtap=true -Ddtrace=true -Dfam=true _build - ninja -C _build - mkdir -p _coverage - lcov --rc lcov_branch_coverage=1 --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov" @@ -76,21 +77,21 @@ cross-android_api21_arm64: <<: *cross-template script: # FIXME: add --werror - - meson --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=gnu -Dinternal_pcre=true --buildtype debug _build + - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=gnu -Dinternal_pcre=true _build - ninja -C _build cross-android_api28_arm64: <<: *cross-template script: # FIXME: add --werror - - meson --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true --buildtype debug _build + - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true _build - ninja -C _build cross-mingw64: <<: *cross-template script: # FIXME: Add --werror - - meson --cross-file=/opt/cross_file_mingw64.txt --buildtype debug _build + - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build - ninja -C _build msys2-mingw32: @@ -150,7 +151,7 @@ freebsd-11-x86_64: # FreeBSD iconv doesn't handle transliteration, so we use GNU libiconv here. # FreeBSD supports xattr, but its API is different from Linux xattr. # FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404 - - meson -Db_lundef=false -Diconv=gnu -Dxattr=false --buildtype debug _build + - meson ${MESON_COMMON_OPTIONS} -Db_lundef=false -Diconv=gnu -Dxattr=false _build - ninja -C _build - meson test -C _build --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" # FIXME: Remove this when we have a stable FreeBSD runner @@ -191,7 +192,7 @@ dist-job: only: - tags script: - - meson --buildtype release -Dgtk_doc=true -Dman=true _build + - meson --buildtype release --fatal-meson-warnings -Dgtk_doc=true -Dman=true _build - cd _build - ninja dist - ninja glib-doc gobject-doc gio-doc diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile index 4d7efa3d9..1a0dd11aa 100644 --- a/.gitlab-ci/Dockerfile +++ b/.gitlab-ci/Dockerfile @@ -52,7 +52,7 @@ RUN rm -rf $ANDROID_NDK_PATH COPY cross_file_mingw64.txt /opt -RUN pip3 install meson==0.47.0 +RUN pip3 install meson==0.48.0 ARG HOST_USER_ID=5555 ENV HOST_USER_ID ${HOST_USER_ID} diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh index dc36d43eb..33df42453 100755 --- a/.gitlab-ci/run-docker.sh +++ b/.gitlab-ci/run-docker.sh @@ -2,7 +2,7 @@ set -e -TAG="registry.gitlab.gnome.org/gnome/glib/master:v7" +TAG="registry.gitlab.gnome.org/gnome/glib/master:v8" docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \ --file "Dockerfile" . diff --git a/.gitlab-ci/test-msvc.bat b/.gitlab-ci/test-msvc.bat index 9b674f76e..c3b19cd34 100644 --- a/.gitlab-ci/test-msvc.bat +++ b/.gitlab-ci/test-msvc.bat @@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary @echo on :: FIXME: make warnings fatal -pip3 install --upgrade --user meson==0.47.0 || goto :error +pip3 install --upgrade --user meson==0.48.0 || goto :error meson _build || goto :error ninja -C _build || goto :error diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh index 48e18e92c..0c375bbb7 100755 --- a/.gitlab-ci/test-msys2.sh +++ b/.gitlab-ci/test-msys2.sh @@ -33,7 +33,7 @@ mkdir -p _coverage mkdir -p _ccache export CCACHE_BASEDIR="$(pwd)" export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" -pip3 install --upgrade --user meson==0.47.0 +pip3 install --upgrade --user meson==0.48.0 export PATH="$HOME/.local/bin:$PATH" export CFLAGS="-coverage -ftest-coverage -fprofile-arcs" DIR="$(pwd)" diff --git a/gio/tests/meson.build b/gio/tests/meson.build index fb788a529..334fd00e9 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -19,9 +19,7 @@ giotypefuncs_inc = custom_target( command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@']) # Test programs buildable on all platforms -# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0 -# that supports '+=' operator on dictionnaries. -gio_tests = [{ +gio_tests = { 'appmonitor' : {}, 'async-close-output-stream' : {}, 'async-splice-output-stream' : {}, @@ -73,15 +71,13 @@ gio_tests = [{ 'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']}, 'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']}, 'tls-database' : {'extra_sources' : ['gtesttlsbackend.c']}, -}] +} -# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0 -# that supports '+=' operator on dictionnaries. -test_extra_programs = [{ +test_extra_programs = { 'gdbus-connection-flush-helper' : {}, 'gdbus-testserver' : {}, 'gsubprocess-testprog' : {}, -}] +} test_env = environment() test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) @@ -114,17 +110,17 @@ endif if dbus1_dep.found() glib_conf.set('HAVE_DBUS1', 1) - gio_tests += [{ + gio_tests += { 'gdbus-serialization' : { 'extra_sources' : ['gdbus-tests.c'], 'dependencies' : [dbus1_dep], } - }] + } endif # Test programs buildable on UNIX only if host_machine.system() != 'windows' - gio_tests += [{ + gio_tests += { 'file' : {}, 'gdbus-peer' : {'dependencies' : [libgdbus_example_objectmanager_dep]}, 'gdbus-peer-object-manager' : {}, @@ -137,12 +133,12 @@ if host_machine.system() != 'windows' 'g-file-info-filesystem-readonly' : {}, 'gschema-compile' : {'install' : false}, 'trash' : {}, - }] + } # Uninstalled because of the check-for-executable logic in DesktopAppInfo # unable to find the installed executable if not glib_have_cocoa - gio_tests += [{ + gio_tests += { 'appinfo' : { 'install' : false, 'is_parallel' : false, @@ -151,22 +147,22 @@ if host_machine.system() != 'windows' 'install' : false, 'is_parallel' : false, }, - }] + } endif - test_extra_programs += [{ + test_extra_programs += { 'basic-application' : {}, 'dbus-launch' : {}, 'appinfo-test' : {}, - }] + } if not glib_have_cocoa - test_extra_programs += [{ + test_extra_programs += { 'apps' : {}, - }] - gio_tests += [{ + } + gio_tests += { 'mimeapps' : {}, - }] + } endif # Test programs that need to bring up a session bus (requires dbus-daemon) @@ -197,7 +193,7 @@ if host_machine.system() != 'windows' extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c'] - gio_tests += [{ + gio_tests += { 'actions' : { 'extra_sources' : extra_sources, 'suite' : ['slow'], @@ -244,14 +240,14 @@ if host_machine.system() != 'windows' }, 'gapplication' : {'extra_sources' : extra_sources}, 'gdbus-unix-addresses' : {}, - }] + } if not glib_have_cocoa - gio_tests += [{ + gio_tests += { 'dbus-appinfo' : { 'extra_sources' : extra_sources, }, - }] + } endif endif # have_dbus_daemon @@ -262,44 +258,44 @@ if host_machine.system() != 'windows' install_dir : installed_tests_execdir, install : installed_tests_enabled) - gio_tests += [{ + gio_tests += { 'gdbus-connection-flush' : { 'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'], }, 'gdbus-non-socket' : { 'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'], }, - }] + } # Generate test.mo from de.po using msgfmt msgfmt = find_program('msgfmt', required : false) if msgfmt.found() subdir('de/LC_MESSAGES') - gio_tests += [{ + gio_tests += { 'gsettings' : { 'extra_sources' : [test_mo], 'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()), '-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)], 'install' : false, }, - }] + } endif endif # unix # Test programs buildable on Windows only if host_machine.system() == 'windows' - gio_tests += [{'win32-streams' : {}}] + gio_tests += {'win32-streams' : {}} endif if cc.get_id() != 'msvc' - gio_tests += [{ + gio_tests += { 'autoptr-gio' : { 'source' : 'autoptr.c', }, - }] + } endif -test_extra_programs += [{ +test_extra_programs += { 'gio-du' : {'install' : false}, 'echo-server' : {'install' : false}, 'filter-cat' : {'install' : false}, @@ -331,10 +327,10 @@ test_extra_programs += [{ 'extra_sources' : ['gtlsconsoleinteraction.c'], 'install' : false, }, -}] +} if cc.get_id() != 'msvc' - test_extra_programs += [{ + test_extra_programs += { # These three are manual-run tests because they need a session bus but don't bring one up themselves # FIXME: these build but don't seem to work! 'gdbus-example-objectmanager-client' : { @@ -349,15 +345,15 @@ if cc.get_id() != 'msvc' 'dependencies' : [libgdbus_example_objectmanager_dep], 'install' : false, }, - }] + } endif if host_machine.system() != 'windows' - test_extra_programs += [{ + test_extra_programs += { 'gdbus-example-unix-fd-client' : { 'install' : false, }, - }] + } endif if installed_tests_enabled @@ -447,63 +443,59 @@ if not meson.is_cross_build() or meson.has_exe_wrapper() copy : true, install : false) - gio_tests += [{ + gio_tests += { 'resources' : { 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c, test_resources2_h], }, - }] + } endif -foreach test_dict : gio_tests - foreach test_name, extra_args : test_dict - source = extra_args.get('source', test_name + '.c') - extra_sources = extra_args.get('extra_sources', []) - install = installed_tests_enabled and extra_args.get('install', true) +foreach test_name, extra_args : gio_tests + source = extra_args.get('source', test_name + '.c') + extra_sources = extra_args.get('extra_sources', []) + install = installed_tests_enabled and extra_args.get('install', true) - if install - test_conf = configuration_data() - test_conf.set('installed_tests_dir', installed_tests_execdir) - test_conf.set('program', test_name) - configure_file( - input: installed_tests_template_tap, - output: test_name + '.test', - install_dir: installed_tests_metadir, - configuration: test_conf - ) - endif - - exe = executable(test_name, [source, extra_sources], - c_args : test_c_args + extra_args.get('c_args', []), - dependencies : common_gio_tests_deps + extra_args.get('dependencies', []), - install_dir: installed_tests_execdir, - install: install, + if install + test_conf = configuration_data() + test_conf.set('installed_tests_dir', installed_tests_execdir) + test_conf.set('program', test_name) + configure_file( + input: installed_tests_template_tap, + output: test_name + '.test', + install_dir: installed_tests_metadir, + configuration: test_conf ) + endif - suite = ['gio'] + extra_args.get('suite', []) - timeout = suite.contains('slow') ? 120 : 30 - test(test_name, exe, - env : test_env, - timeout : timeout, - suite : suite, - args : ['--tap'], - is_parallel : extra_args.get('is_parallel', true), - ) - endforeach + exe = executable(test_name, [source, extra_sources], + c_args : test_c_args + extra_args.get('c_args', []), + dependencies : common_gio_tests_deps + extra_args.get('dependencies', []), + install_dir: installed_tests_execdir, + install: install, + ) + + suite = ['gio'] + extra_args.get('suite', []) + timeout = suite.contains('slow') ? 120 : 30 + test(test_name, exe, + env : test_env, + timeout : timeout, + suite : suite, + args : ['--tap'], + is_parallel : extra_args.get('is_parallel', true), + ) endforeach -foreach program_dict : test_extra_programs - foreach program_name, extra_args : program_dict - source = extra_args.get('source', program_name + '.c') - extra_sources = extra_args.get('extra_sources', []) - install = installed_tests_enabled and extra_args.get('install', true) - executable(program_name, [source, extra_sources], - c_args : test_c_args, - dependencies : common_gio_tests_deps + extra_args.get('dependencies', []), - install_dir : installed_tests_execdir, - install : install, - ) - endforeach +foreach program_name, extra_args : test_extra_programs + source = extra_args.get('source', program_name + '.c') + extra_sources = extra_args.get('extra_sources', []) + install = installed_tests_enabled and extra_args.get('install', true) + executable(program_name, [source, extra_sources], + c_args : test_c_args, + dependencies : common_gio_tests_deps + extra_args.get('dependencies', []), + install_dir : installed_tests_execdir, + install : install, + ) endforeach # FIXME: subdir('services') diff --git a/meson.build b/meson.build index 3fb5267f4..adb07638e 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('glib', 'c', 'cpp', version : '2.59.0', - meson_version : '>= 0.47.0', + meson_version : '>= 0.48.0', default_options : [ 'buildtype=debugoptimized', 'warning_level=1', diff --git a/tests/gobject/meson.build b/tests/gobject/meson.build index 2a58766df..a79a9f79e 100644 --- a/tests/gobject/meson.build +++ b/tests/gobject/meson.build @@ -26,9 +26,7 @@ testmarshal_c = custom_target('testmarshal_c', ], ) -# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0 -# that supports '+=' operator on dictionnaries. -gobject_tests = [{ +gobject_tests = { 'gvalue-test' : {'tap' : true}, 'paramspec-test' : {'tap' : true}, 'deftype' : {}, @@ -46,51 +44,49 @@ gobject_tests = [{ 'accumulator' : { 'extra_sources' : [testmarshal_c, testmarshal_h], }, -}] +} if host_system != 'windows' - gobject_tests += [{ + gobject_tests += { 'timeloop-closure' : {}, - }] + } endif common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'] common_deps = [libm, thread_dep, libglib_dep, libgobject_dep] -foreach test_dict : gobject_tests - foreach test_name, extra_args : test_dict - source = extra_args.get('source', test_name + '.c') - extra_sources = extra_args.get('extra_sources', []) - install = installed_tests_enabled and extra_args.get('install', true) - template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template - test_command_args = extra_args.get('tap', false) ? ['--tap'] : [] +foreach test_name, extra_args : gobject_tests + source = extra_args.get('source', test_name + '.c') + extra_sources = extra_args.get('extra_sources', []) + install = installed_tests_enabled and extra_args.get('install', true) + template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template + test_command_args = extra_args.get('tap', false) ? ['--tap'] : [] - if install - test_conf = configuration_data() - test_conf.set('installed_tests_dir', installed_tests_execdir) - test_conf.set('program', test_name) - configure_file( - input: template, - output: test_name + '.test', - install_dir: installed_tests_metadir, - configuration: test_conf - ) - endif - - # FIXME? $(GLIB_DEBUG_FLAGS) - exe = executable(test_name, [source, extra_sources], - c_args : common_c_args + extra_args.get('c_args', []), - dependencies : common_deps + extra_args.get('dependencies', []), - install_dir: installed_tests_execdir, - install: install, + if install + test_conf = configuration_data() + test_conf.set('installed_tests_dir', installed_tests_execdir) + test_conf.set('program', test_name) + configure_file( + input: template, + output: test_name + '.test', + install_dir: installed_tests_metadir, + configuration: test_conf ) + endif - suite = ['gobject'] + extra_args.get('suite', []) - timeout = suite.contains('slow') ? 120 : 30 - # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset - test(test_name, exe, env : test_env, timeout : timeout, suite : suite, - args : test_command_args) - endforeach + # FIXME? $(GLIB_DEBUG_FLAGS) + exe = executable(test_name, [source, extra_sources], + c_args : common_c_args + extra_args.get('c_args', []), + dependencies : common_deps + extra_args.get('dependencies', []), + install_dir: installed_tests_execdir, + install: install, + ) + + suite = ['gobject'] + extra_args.get('suite', []) + timeout = suite.contains('slow') ? 120 : 30 + # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset + test(test_name, exe, env : test_env, timeout : timeout, suite : suite, + args : test_command_args) endforeach # Don't install these ones, and keep them out of 'make check' because they take too long... diff --git a/tests/meson.build b/tests/meson.build index 778d20ce3..68e0431e9 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -15,9 +15,7 @@ test_cargs = ['-DG_LOG_DOMAIN="GLib"'] subdir('gobject') subdir('refcount') -# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0 -# that supports '+=' operator on dictionnaries. -tests = [{ +tests = { 'testglib' : {'tap' : true}, 'testgdate' : {}, 'datetime' : {}, @@ -54,7 +52,7 @@ tests = [{ 'include_directories' : gmoduleinc, 'dependencies' : [libgio_dep], }, -}] +} test_extra_programs = { 'slice-test' : { @@ -68,11 +66,11 @@ test_extra_programs = { } if host_machine.system() != 'windows' - tests += [{ + tests += { 'timeloop' : {}, 'spawn-test' : {}, 'iochannel-test' : {}, - }] + } endif if installed_tests_enabled @@ -96,42 +94,40 @@ endforeach common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'] common_deps = [libm, thread_dep, libglib_dep] -foreach test_dict : tests - foreach test_name, extra_args : test_dict - source = extra_args.get('source', test_name + '.c') - extra_sources = extra_args.get('extra_sources', []) - install = installed_tests_enabled and extra_args.get('install', true) - template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template - test_command_args = extra_args.get('tap', false) ? ['--tap'] : [] +foreach test_name, extra_args : tests + source = extra_args.get('source', test_name + '.c') + extra_sources = extra_args.get('extra_sources', []) + install = installed_tests_enabled and extra_args.get('install', true) + template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template + test_command_args = extra_args.get('tap', false) ? ['--tap'] : [] - if install - test_conf = configuration_data() - test_conf.set('installed_tests_dir', installed_tests_execdir) - test_conf.set('program', test_name) - configure_file( - input: template, - output: test_name + '.test', - install_dir: installed_tests_metadir, - configuration: test_conf - ) - endif - - # FIXME? $(GLIB_DEBUG_FLAGS) - exe = executable(test_name, [source, extra_sources], - c_args : common_c_args + extra_args.get('c_args', []), - dependencies : common_deps + extra_args.get('dependencies', []), - export_dynamic : extra_args.get('export_dynamic', false), - include_directories : extra_args.get('include_directories', []), - install_dir: installed_tests_execdir, - install: install, + if install + test_conf = configuration_data() + test_conf.set('installed_tests_dir', installed_tests_execdir) + test_conf.set('program', test_name) + configure_file( + input: template, + output: test_name + '.test', + install_dir: installed_tests_metadir, + configuration: test_conf ) + endif - suite = ['glib'] + extra_args.get('suite', []) - timeout = suite.contains('slow') ? 120 : 30 - # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset - test(test_name, exe, env : test_env, timeout : timeout, suite : suite, - args : test_command_args) - endforeach + # FIXME? $(GLIB_DEBUG_FLAGS) + exe = executable(test_name, [source, extra_sources], + c_args : common_c_args + extra_args.get('c_args', []), + dependencies : common_deps + extra_args.get('dependencies', []), + export_dynamic : extra_args.get('export_dynamic', false), + include_directories : extra_args.get('include_directories', []), + install_dir: installed_tests_execdir, + install: install, + ) + + suite = ['glib'] + extra_args.get('suite', []) + timeout = suite.contains('slow') ? 120 : 30 + # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset + test(test_name, exe, env : test_env, timeout : timeout, suite : suite, + args : test_command_args) endforeach foreach program_name, extra_args : test_extra_programs