Commit Graph

25541 Commits

Author SHA1 Message Date
Emmanuele Bassi
6cbf7a7461 Port enums tests to the appropriate assert functions
Do not use `g_assert()` inside tests, as the symbol can be disabled.
Instead, use `g_assert_null()` and `g_assert_nonnull()`.
2022-06-30 01:46:54 +01:00
Emmanuele Bassi
28edd84e77 docs: Add the new G_DEFINE macros for enumeration types 2022-06-30 01:46:54 +01:00
Emmanuele Bassi
2a9ef1e0b4 Test the newly added G_DEFINE macros for enumeration types 2022-06-30 01:46:54 +01:00
Emmanuele Bassi
9a4a10fbc8 Add G_DEFINE macros for enum and flags types
While you might want to use automated tools like glib-mkenums to
generate enumeration types for your library, it's often not entirely
necessary to complicate your build system in order to handle a couple of
enumerations with few values.

Just like we have G_DEFINE macros for object, interface, pointer, and
boxed types, we should provide macros for defining enum and flags types.
2022-06-30 01:46:54 +01:00
Emmanuele Bassi
89b34963e7 Merge branch 'wip/pwithnall/macos-yet-again' into 'main'
ci: Ensure git submodules are updated before running macOS CI

See merge request GNOME/glib!2792
2022-06-30 00:45:53 +00:00
Philip Withnall
dc2c769d5c ci: Ensure git submodules are updated before running macOS CI
Since the macOS CI jobs are run on a machine which isn’t using a
pre-made container image, we can’t ship a cached version of the
subproject, so it has to be pulled as a git submodule.

GitLab doesn’t do that by default unless you set
`GIT_SUBMODULE_STRATEGY` to something other than `none`.

See https://docs.gitlab.com/ee/ci/git_submodules.html

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-30 01:31:02 +01:00
Emmanuele Bassi
d2c715d7a8 Merge branch 'why-are-the-tests-always-breaking' into 'main'
tests: Skip assert-msg-test.py if gdb is non-functional

See merge request GNOME/glib!2790
2022-06-29 14:49:08 +00:00
Philip Withnall
466a080c45 Merge branch 'typos' into 'main'
gdate: Fix a typo in a code comment

See merge request GNOME/glib!2789
2022-06-29 14:28:51 +00:00
Philip Withnall
6e44151bf7 tests: Skip assert-msg-test.py if gdb is non-functional
Some of the CI runners disable ptrace, as they’re running inside a
container and ptrace would allow container escape. On those systems, gdb
can’t work, so skip the gdb test.

Add some additional stderr debug output to make it clear that’s the
case.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-29 15:07:20 +01:00
Michael Vetter
162df3a6fa gdate: Fix a typo in a code comment 2022-06-29 16:05:09 +02:00
Marco Trevisan
5e4fa36680 Merge branch 'wip/pwithnall/ci-image-updates' into 'main'
ci: Update CI images to add gdb and pcre2

See merge request GNOME/glib!2782
2022-06-28 18:11:14 +00:00
Yuri Chornoivan
cf3ea1a3f1 Update Ukrainian translation 2022-06-28 16:18:40 +00:00
Philip Withnall
bd56345f23 Merge branch 'move_assert-msg-test' into 'main'
Convert tests/assert-msg-test* to glib/tests/assert-msg-test*

Closes #1434

See merge request GNOME/glib!2767
2022-06-28 10:41:59 +00:00
Philip Withnall
164d3759fb Merge branch 'mcatanzaro/#2597' into 'main'
Avoid crashing when GProxyResolver returns weird results, and related fixes

Closes #2597

See merge request GNOME/glib!2742
2022-06-28 10:33:33 +00:00
Emmanuel Fleury
5699b7b169 Fix some coding style issues in python tests pointed out by black and flake8 2022-06-28 11:19:21 +01:00
Emmanuel Fleury
207b8cb8a5 Convert tests/assert-msg-test* to glib/tests/assert-msg-test*
Closes issue #1434
2022-06-28 11:19:21 +01:00
Marco Trevisan
113d7263c6 Merge branch 'wip/pwithnall/more-macos-test-fixes' into 'main'
tests: Fix incorrect basename comparison in gsubprocess test

See merge request GNOME/glib!2785
2022-06-28 01:26:31 +00:00
Michael Catanzaro
8e29865112 gproxyresolver: add asserts to ensure error is set
This will catch buggy implementations of GProxyResolver before they are
able to return bogus results to higher level code. In particular, if
g_proxy_resolver_lookup() returns NULL, it'd better set an error to
explain why.
2022-06-27 15:10:25 -05:00
Michael Catanzaro
1738fad172 proxyaddressenumerator: set error parameter more thoughtfully
It doesn't make sense for a proxy resolver to return NULL without an
error on the first call. Whereas a DNS resolver would do this to
indicate that a query completed successfully but found no results, a
proxy resolver should return "direct://" instead. Therefore, if we are
going to return NULL, we ought to have an error as well. Let's make sure
this actually happens by adding some fallback errors just in case
GProxyResolver feeds us weird results.

Additionally, we should not return any errors except
G_IO_ERROR_CANCELLED after the very first iteration. This is an API
contract of GSocketAddressEnumerator. Let's add some checks to ensure
this.

Note that we have inadequate test coverage for GProxyAddressEnumerator.
It's tested here only via GSocketClient. We could do a bit better by
testing it directly as well. For example, I've added tests to see what
happens when GProxyResolver returns both a valid and an invalid URI, but
it's not so interesting here because GSocketClient always uses the valid
result and ignores the error from GProxyAddressEnumerator.

Fixes #2597
2022-06-27 15:10:05 -05:00
Michael Catanzaro
6f83f45db4 gsimpleproxyresolver: ensure default proxy is valid
It should be either a valid URI, or NULL. Passing empty strings or other
invalid URIs is no bueno.
2022-06-27 14:23:51 -05:00
Michael Catanzaro
8a1f087a31 gsimpleproxyresolver: default_proxy should be consistently nullable
Currently it's nullable in g_simple_proxy_resolver_new(), but not in
g_simple_proxy_resolver_set_default_proxy() nor the property. Fix these.
2022-06-27 14:23:51 -05:00
Michael Catanzaro
4667f5980a proxy-test: fix check for simple:// URI scheme
This has no practical impact, since it's only a test, and none of the
test code would have hit this bug, but the GTestProxyResolver's check to
see if the URI scheme is simple:// currently only compares the first
four bytes of the string, so it's actually only checking for the "simp"
and would match anything else after that, e.g. "simpleton://". This is
surely not intended.
2022-06-27 14:23:51 -05:00
Philip Withnall
03ea524188 ci: Add libpcre2 dependencies and subproject
This is in preparation for porting `GRegex` to libpcre2, which is
happening in !2529. It’s a big port, though, and specially rebuilding
the CI images to add libpcre2 for it is a pain.

Add libpcre2, and then !2529 can drop the old libpcre dependencies when
the port lands.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1085
2022-06-27 15:53:55 +01:00
Philip Withnall
5e00b30a29 ci: Add gdb to some CI images
This will be useful in general, for manually debugging failures if we
need (without having to rebuild the CI images to do so).

It will also be useful for the `assert-msg-test` test, which is being
reworked in !2767.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1434
2022-06-27 15:53:55 +01:00
Philip Withnall
087272777b tests: Fix incorrect basename comparison in gsubprocess test
This was causing intermittent failures on macOS, depending on whether
the tmpdir ended with a `/` or `/some-dir`. `g_strrstr()` is not the
right function to use to extract a basename from a path, for this
reason.

When it failed, the macOS test was failing with:
```
ok 16 /gsubprocess/env
Bail out! GLib-GIO:ERROR:../gio/tests/gsubprocess.c:1507:test_cwd: assertion failed (basename == tmp_lineend_basename): ("/T\n" == "/\n")
```

The test now passes reliably, which means that it can be removed from
the list of expected failures on macOS.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1392
2022-06-27 15:02:55 +01:00
Philip Withnall
6d381c9668 Merge branch 'getfsent_lock' into 'main'
Add lock in _g_get_unix_mount_points() around *fsent() functions

See merge request GNOME/glib!1717
2022-06-27 11:20:49 +00:00
Philip Withnall
3c47fa6e20 Merge branch 'getfsent_lock2' into 'main'
_g_get_unix_mount_points(): reduce syscalls inside loop

See merge request GNOME/glib!2783
2022-06-27 11:14:01 +00:00
Philip Withnall
eec8171dab Merge branch 'wip/smcv/more-figure-spaces' into 'main'
gdatetime test: Consistently expect %k to generate a figure space

See merge request GNOME/glib!2773
2022-06-27 11:09:26 +00:00
Simon McVittie
6a599e0349 gdatetime test: Consistently expect %k to generate a figure space
This part of test_non_utf8_printf() was missed while converting other
test expectations to look for a figure space, probably because it is
only run if a legacy ja_JP.eucjp locale exists. Debian generates a fairly
comprehensive set of locales (including some that are non-UTF-8) while
running GLib's installed-tests, so this was caught by CI.

Fixes: 7074122 "gdatetime: Pad numbers with numeric space"
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-06-27 09:29:35 +01:00
Michael Catanzaro
6e81c21a8b Merge branch 'wip/smcv/revert-fa8c7c0d' into 'main'
Revert "gobject: Use g_datalist_id_remove_multiple"

See merge request GNOME/glib!2784
2022-06-26 17:16:51 +00:00
Simon McVittie
d4043eced5 Revert "gobject: Use g_datalist_id_remove_multiple"
This reverts commit fa8c7c0 "gobject: Use g_datalist_id_remove_multiple"
(or more specifically the parts of it that were not already reverted
in 01ac1d9 "gobject: Fix crash when disposing a GtkAccelGroup".

Workaround for https://gitlab.gnome.org/GNOME/glib/-/issues/2676

Bug: https://gitlab.gnome.org/GNOME/glib/-/issues/2676
2022-06-26 18:00:52 +01:00
Aleksandr Melman
f3838e517b Update Russian translation 2022-06-25 18:40:19 +00:00
Rozhuk Ivan
f43cf34151 [PATCH] Add lock in _g_get_unix_mount_points() around *fsent() functions 2022-06-25 19:22:06 +03:00
Rozhuk Ivan
02d0d6497b [PATCH] _g_get_unix_mount_points(): reduce syscalls inside loop 2022-06-25 19:01:30 +03:00
Simon McVittie
99a7c6351c Merge branch 'wip/pwithnall/more-macos-fixes' into 'main'
tests: Fix macOS failures in the file tests

See merge request GNOME/glib!2779
2022-06-25 10:23:49 +00:00
Philip Withnall
059a5fd4da tests: Skip various default handler tests on macOS
They are not currently supported by `gosxappinfo.m`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-24 12:43:18 +01:00
Philip Withnall
dbdc9ca995 gosxappinfo: Correctly return an error from create_from_commandline()
Creating a `GAppInfo` from a commandline isn’t currently supported on
macOS, but the implementation was incorrectly returning `NULL` without
setting the `GError`.

This was being caught by the new tests in `gio/tests/file.c`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-24 12:27:45 +01:00
Philip Withnall
a98bd895d5 tests: Fix a path comparison in the file tests
On macOS the comparison was failing as one of the paths had a trailing
slash while the other didn’t.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-24 12:27:45 +01:00
Yuri Chornoivan
468e096983 Update Ukrainian translation 2022-06-24 06:36:19 +00:00
Hugo Carvalho
44bb5c26fc Update Portuguese translation 2022-06-23 21:39:02 +00:00
Philip Withnall
ac898b8e67 Merge branch 'fix-macos-again' into 'main'
tests: Fix type mismatches in new atomic tests when compiling with clang

See merge request GNOME/glib!2774
2022-06-23 18:44:13 +00:00
Philip Withnall
b5231ed003 Merge branch 'gthread-initial-cleanups' into 'main'
gthread: Some code cleanups and fixes

See merge request GNOME/glib!2775
2022-06-23 17:07:09 +00:00
Philip Withnall
191923ce61 Merge branch 'wip/smcv/none-flags' into 'main'
Add a NONE or DEFAULT member to most flags-sets

See merge request GNOME/glib!2576
2022-06-23 16:09:38 +00:00
Marco Trevisan (Treviño)
8d98617297 gthread-posix: Use named states to manage the mutex states
We used to use raw numbers to control the mutex state, we can use a
nicer enum to avoid dealing with pure numbers.
2022-06-23 17:50:12 +02:00
Marco Trevisan (Treviño)
15d2053122 glib/tests/autoptr: Also ensure that GRecMutexLocker can re-lock a mutex
It's native in the actual GRecMutex, but better to check that again.
2022-06-23 17:48:44 +02:00
Marco Trevisan (Treviño)
e2d2db6433 glib/tests/autoptr: Release the acquired locks on GRecMutex 2022-06-23 17:48:44 +02:00
Marco Trevisan (Treviño)
9dffecf5f5 gthread: Fix Since tag typo in documentation for some methods 2022-06-23 17:45:04 +02:00
Philip Withnall
35c4b640bb tests: Fix type mismatches in new atomic tests when compiling with clang
Clang seems to apply more rigorous type checks across the different
arguments to the atomic builtins. Fix various
`-Wincompatible-pointer-types`, `-Wpointer-sign` and `-Wint-conversion`
warnings.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-23 15:56:07 +01:00
Philip Withnall
d198edf9cd Merge branch 'leaks' into 'main'
gobject/tests/performance: fix leaks

See merge request GNOME/glib!2772
2022-06-23 13:47:33 +00:00
Philip Withnall
e5ccbe09da Merge branch 'atomic-exchange-pre-value' into 'main'
gatomic: Add Compare and Exchange functions that returns the previous value

See merge request GNOME/glib!2766
2022-06-23 13:19:05 +00:00