Merge branch 'wip/3v1n0/ci-really-use-fedora-39' into 'main'

ci: Ignore lcov errors on source missing, handle atomic writes and actually use Fedora 39 image

Closes #3381

See merge request GNOME/glib!4096
This commit is contained in:
Philip Withnall 2024-08-14 14:58:36 +00:00
commit ab616db01e
8 changed files with 60 additions and 18 deletions

View File

@ -11,11 +11,11 @@ cache:
- _ccache/
variables:
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v27"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v39.1"
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v19"
ALPINE_IMAGE: "registry.gitlab.gnome.org/gnome/glib/alpine:v3"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v16"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v39.1"
MESON_TEST_TIMEOUT_MULTIPLIER: 4
G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
@ -174,7 +174,8 @@ fedora-x86_64:
stage: build
needs: []
variables:
CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
CFLAGS: "--coverage -ftest-coverage -fprofile-arcs -fprofile-update=atomic"
CXXFLAGS: "--coverage -ftest-coverage -fprofile-arcs -fprofile-update=atomic"
before_script:
- !reference [".build-linux", "before_script"]
- !reference [".with-git", "before_script"]
@ -194,9 +195,11 @@ fedora-x86_64:
_build
- meson compile -C _build
- mkdir -p _coverage
- lcov --config-file .lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- lcov --config-file .lcovrc --directory _build --capture --initial
--output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- .gitlab-ci/run-tests.sh
- 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"
# Copy the built documentation to an artifact directory. The build for docs.gtk.org
# can then pull it from there — see https://gitlab.gnome.org/GNOME/gtk/-/blob/docs-gtk-org/README.md
- mkdir -p _reference/

View File

@ -13,7 +13,7 @@ for path in _coverage/*.lcov; do
# Remove coverage from the fuzz tests, since they are run on a separate CI system
lcov --config-file .lcovrc -r "${path}" "*/fuzzing/*" -o "$(pwd)/${path}"
# Remove coverage from copylibs and subprojects
for lib in xdgmime libcharset gnulib; do
for lib in xdgmime libcharset gnulib subprojects; do
lcov --config-file .lcovrc -r "${path}" "*/${lib}/*" -o "$(pwd)/${path}"
done
@ -27,7 +27,7 @@ for path in _coverage/*.lcov; do
done
genhtml \
--ignore-errors=source \
--prefix "$PWD" \
--config-file .lcovrc \
_coverage/*.lcov \
-o _coverage/coverage
@ -46,4 +46,4 @@ cat >index.html <<EOL
EOL
# Print a handy link to the coverage report
echo "Coverage report at: https://${CI_PROJECT_NAMESPACE}.pages.gitlab.gnome.org/-/${CI_PROJECT_NAME}/-/jobs/${CI_BUILD_ID}/artifacts/_coverage/coverage/index.html"
echo "Coverage report at: https://${CI_PROJECT_NAMESPACE}.pages.gitlab.gnome.org/-/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts/_coverage/coverage/index.html"

View File

@ -13,6 +13,7 @@ def main(argv):
print("cov-fixup:", path)
text = io.open(path, "r", encoding="utf-8").read()
text = text.replace("\\\\", "/")
text = text.replace("\\", "/")
old_root = re.search(":(.*?)/glib/.*?$", text, re.MULTILINE).group(1)
new_root = os.path.dirname(os.getcwd())
if old_root != new_root:

View File

@ -1,4 +1,4 @@
FROM registry.gitlab.gnome.org/gnome/glib/fedora:v27
FROM registry.gitlab.gnome.org/gnome/glib/fedora:v39.1
USER root
@ -14,4 +14,4 @@ WORKDIR /opt
COPY cross_file_mingw64.txt /opt
USER user
WORKDIR /home/user
WORKDIR /home/user

18
.lcovrc
View File

@ -4,6 +4,10 @@
# Always enable branch coverage
lcov_branch_coverage = 1
# Disable exception branch for C++:
# https://github.com/linux-test-project/lcov/issues/209
no_exception_branch = 1
# Exclude precondition assertions, as we can never reasonably get full branch
# coverage of them, as they should never normally fail.
# Similarly exclude g_clear_*() functions (such as g_clear_object(),
@ -13,4 +17,16 @@ lcov_branch_coverage = 1
lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_|g_clear_
# Similarly for unreachable assertions.
lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached
lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached
# When using dtrace some temporary files may be leaked as source files
ignore_errors = source
# Sometimes we may have negative counting despite using atomic profile update
ignore_errors = negative
# gnulib paths may not be used
ignore_errors = unused
# baseline lcov files may be empty
ignore_errors = empty

View File

@ -664,7 +664,7 @@ cancellable_source_cancelled (GCancellable *cancellable,
{
GSource *source = user_data;
GCancellableSource *cancellable_source = (GCancellableSource *) source;
gboolean callback_was_not_called;
gboolean callback_was_not_called G_GNUC_UNUSED;
g_source_ref (source);
g_source_set_ready_time (source, 0);

View File

@ -103,14 +103,18 @@ test_closefrom (void)
if (flags == -1)
{
int exit_code = 100 + fds[i];
async_signal_safe_message ("fd should not have been closed");
_exit (100 + fds[i]);
g_free (fds);
_exit (exit_code);
}
if (flags & FD_CLOEXEC)
{
int exit_code = 100 + fds[i];
async_signal_safe_message ("fd should not have been close-on-exec yet");
_exit (100 + fds[i]);
g_free (fds);
_exit (exit_code);
}
}
@ -122,14 +126,18 @@ test_closefrom (void)
if (flags == -1)
{
int exit_code = 100 + fds[i];
async_signal_safe_message ("fd should not have been closed");
_exit (100 + fds[i]);
g_free (fds);
_exit (exit_code);
}
if (!(flags & FD_CLOEXEC))
{
int exit_code = 100 + fds[i];
async_signal_safe_message ("fd should have been close-on-exec");
_exit (100 + fds[i]);
g_free (fds);
_exit (exit_code);
}
}
@ -142,12 +150,14 @@ test_closefrom (void)
if (flags == -1)
{
async_signal_safe_message ("fd should not have been closed");
g_free (fds);
_exit (100 + fd);
}
if (flags & FD_CLOEXEC)
{
async_signal_safe_message ("fd should not have been close-on-exec");
g_free (fds);
_exit (100 + fd);
}
}
@ -157,10 +167,12 @@ test_closefrom (void)
if (fcntl (fds[i], F_GETFD) != -1 || errno != EBADF)
{
async_signal_safe_message ("fd should have been closed");
g_free (fds);
_exit (100 + fds[i]);
}
}
g_free (fds);
_exit (0);
}

View File

@ -821,7 +821,7 @@
{
g_set_user_dirs_str
Memcheck:Leak
match-leak-kinds:definite,reachable
match-leak-kinds:definite,reachable,possible
fun:malloc
...
fun:set_str_if_different
@ -833,7 +833,7 @@
{
g_set_user_dirs_strv
Memcheck:Leak
match-leak-kinds:definite,reachable
match-leak-kinds:definite,reachable,possible
fun:malloc
...
fun:set_strv_if_different
@ -1322,3 +1322,13 @@
fun:g_rw_lock_writer_lock
fun:g_log_writer_default_set_debug_domains
}
# This can be removed when versions of valgrind including the fix are widely used.
# See https://gitlab.gnome.org/GNOME/glib/-/issues/3292
{
g_utf8_collate_key wcsxfrm false-positive
Memcheck:Addr32
...
fun:wcsxfrm*
fun:g_utf8_collate_key
}