Commit Graph

24652 Commits

Author SHA1 Message Date
Philip Withnall
13c4b9579b tests: Remove threads from mock-resolver/network-address test
`mock-resolver.c` is a mock implementation of `GResolver` used in the
`network-address` tests. It returns resolver results, and implements
timeouts, as directed by the test calling it.

In particular, it allows the IPv4 and IPv6 resolver results to be
returned using independent delays. This allows code paths which deal
with IPv4 and IPv6 results being returned at different times to be
tested, as the ‘Happy Eyeballs’ spec mandates various hard-coded
timeouts for returning the best results it can in a reasonable
timeframe.

Previously, `mock-resolver.c` implemented the timeouts by handling
`lookup_by_name()` in a `GTask` worker thread, and calling `g_usleep()`
for the timeout. This seemed to cause occasional CI failures, such as
https://gitlab.gnome.org/GNOME/glib/-/jobs/1843454, where a resolver
error would be returned rather than the expected results:
```
ok 52 /network-address/happy-eyeballs/ipv4-error-ipv6-first
\# GLib-GIO-DEBUG: IPv4 DNS error: IPv4 Broken
(/var/tmp/gitlab_runner/builds/Ff4WDDRj/0/GNOME/glib/_build/gio/tests/network-address:18428): GLib-GIO-DEBUG: 09:03:08.587: IPv4 DNS error: IPv4 Broken
Bail out! GLib-GIO:ERROR:../gio/tests/network-address.c:586:got_addr: assertion failed (error == NULL): IPv4 Broken (g-io-error-quark, 24)
stderr:
**
GLib-GIO:ERROR:../gio/tests/network-address.c:586:got_addr: assertion failed (error == NULL): IPv4 Broken (g-io-error-quark, 24)
```

While I’ve been unable to reproduce these failures locally, I suspect
they might be down to thread spawning occasionally taking long enough on
a CI runner to change the ordering of the timeouts, such that the ‘Happy
Eyeballs’ algorithm returns a different set of results from what the
test expects.

So, this commit rewrites part of `mock-resolver.c` to implement timeouts
in the main thread, rather than in a worker thread. That should
eliminate the delays in spawning threads, and should mean that the
timeout sources in `mock-resolver.c` are attached to the same
`GMainContext` as those from the ‘Happy Eyeballs’ algorithm which are
monitoring them, so a total order over the timeouts can be guaranteed.

Of course, I might be completely wrong since this is just a guess and I
can’t properly test it since I can’t reproduce the failure. Worth a try.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-22 11:25:21 +00:00
Philip Withnall
bb2d79e6a8 tests: Use g_assert_*() rather than g_assert() in network-address.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-22 11:25:21 +00:00
Philip Withnall
a57706887e tests: Fix memory leaks in network-address test
The test results weren’t being freed.

This makes the `network-address` test clean under memcheck for me.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-22 11:25:21 +00:00
Philip Withnall
7cef814b7d Merge branch 'wip/smcv/no-nanoseconds-for-you' into 'main'
glocalfileinfo: Always define _g_stat_mtim_nsec, etc.

See merge request GNOME/glib!2516
2022-02-22 09:00:56 +00:00
Philip Withnall
60bbf27c45 Merge branch 'cleanup-warnings-split-4' into 'main'
Cleanup warnings split 4

See merge request GNOME/glib!2493
2022-02-22 08:40:04 +00:00
Simon McVittie
6517bbfbc3 glocalfileinfo: Always define _g_stat_mtim_nsec, etc.
If these struct members aren't available, we can be more like an
abstraction layer by falling back to yielding 0.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-21 16:58:08 +00:00
Nirbheek Chauhan
94f3bb7074 Merge branch 'wip/pwithnall/ci-cleanups' into 'main'
ci: Various cleanups and moving Android API 21 and FreeBSD 12 to scheduled run

See merge request GNOME/glib!2514
2022-02-21 15:31:41 +00:00
Emin Tufan Çetin
60e8b48be9 Update Turkish translation 2022-02-21 13:49:28 +00:00
Simon McVittie
3c12ddce81 Merge branch '1929-dbus-auth-locking' into 'main'
gdbusauthmechanismsha1: Don’t delete a stale lock file if it’s changed

Closes #1929

See merge request GNOME/glib!2511
2022-02-21 13:48:54 +00:00
Loic Le Page
d15e6f7c9c Fix global variable name hidden by local variables in glib/tests/dataset.c 2022-02-21 12:42:23 +01:00
Loic Le Page
becce7742c Fix global variable name hidden by local variables in glib/tests/hash.c 2022-02-21 12:42:23 +01:00
Loic Le Page
479fcb40c0 Fix redefinition of local variable in glib/tests/logging.c 2022-02-21 12:42:23 +01:00
Loic Le Page
c53f24ba53 Fix global variable name hidden by local variables in glib/tests/mainloop.c 2022-02-21 12:42:22 +01:00
Loic Le Page
64760f1028 Refactor glib/tests/node.c
Replace C2P and P2C macros with standard GINT_TO_POINTER and
GPOINTER_TO_INT macros.
2022-02-21 12:42:22 +01:00
Loic Le Page
2885cbd737 Fix global variable name hidden by local variables in glib/tests/option-context.c 2022-02-21 12:42:22 +01:00
Loic Le Page
fb939a0029 Fix redefinition of local variable in glib/tests/sequence.c 2022-02-21 12:42:22 +01:00
Loic Le Page
5804fa1680 Fix global variable name hidden by local variables in glib/tests/spawn-multithreaded.c 2022-02-21 12:42:22 +01:00
Loic Le Page
22b7182d2a Fix redefinition of local variable in glib/tests/strfuncs.c 2022-02-21 12:42:15 +01:00
Loïc Le Page
cbc3d65f6d Fix global variable name hidden by local variables in glib/tests/utf8-validate.c 2022-02-21 12:38:11 +01:00
Philip Withnall
5d40604fa7 ci: Drop Android API 21 build jobs
API version 21 was used for Android 5.0
(https://developer.android.com/studio/releases/platforms#5.0), which is
no longer supported
(https://en.wikipedia.org/wiki/Android_version_history).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 14:16:11 +00:00
Aurimas Černius
8f241c46b9 Updated Lithuanian translation 2022-02-20 15:07:02 +02:00
Philip Withnall
916e7f3cf9 ci: Run the Android API 21 and FreeBSD 12 jobs on a schedule
Rather than running them on each commit on `main`. This saves resources.

Given that Android API 28 and FreeBSD 13 jobs continue to be run on each
commit on `main`, this seems like an acceptable tradeoff. It’s very
unlikely that a regression will happen which affects the older systems
and *not* the newer systems. If it does, it will be caught within a week
by the scheduled job.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 12:50:34 +00:00
Philip Withnall
a9fef02be4 ci: Factor out a template for jobs which run only on the origin repo
This clarifies the intent of the `branches@GNOME/glib` selector. It
introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 12:50:34 +00:00
Philip Withnall
0a14b091e0 ci: Split .only-default out of .build-linux
As with a previous commit, `.only-default` does things which are
orthogonal to what `.build-linux` does, so it’s clearer and more
extensible for CI jobs to specify both in their top-level `extends`
statements, rather than relying on `.build-linux` to pull
`.only-default` in.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 12:50:34 +00:00
Philip Withnall
02da6e8171 ci: Rename .cross-template to .cross-build-linux
This makes the name a bit more descriptive, and makes it match the rest
of the naming scheme.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 12:50:34 +00:00
Philip Withnall
0366f100ca ci: Rename .build template to .build-linux
This name is more specific to what the template actually does.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 12:50:34 +00:00
Philip Withnall
c44abdc7a2 ci: Replace .build-only-schedules template with multiple extension
`.build` and `.only-schedules` are orthogonal, and I want to use
`.only-schedules` together with `.cross-template` in future, which would
require creating more cross-product templates.

Avoid that by splitting `extends: .build-only-schedules` into
```
extends:
  - .build
  - .only-schedules
```

Multiple extends are supported by GitLab: https://docs.gitlab.com/ee/ci/yaml/#extends

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 12:50:34 +00:00
Philip Withnall
32aa9b7349 ci: Port from YAML anchors to GitLab extends
See https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#use-extends-to-reuse-configuration-sections

Since we’re already using `extends` in other places in the configuration
file, it seems simpler to use it everywhere.

This should introduce no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 12:50:34 +00:00
Philip Withnall
ae903744ee Merge branch 'environment-test-fixes' into 'main'
tests: Fix various small memory leaks

See merge request GNOME/glib!2509
2022-02-20 12:09:00 +00:00
Sebastian Dröge
53dc7e2d53 Merge branch 'document-main-priorities' into 'main'
gmain: Expand documentation about GSource priorities a little

See merge request GNOME/glib!2513
2022-02-20 12:06:24 +00:00
Philip Withnall
9ee583a387 gmain: Expand documentation about GSource priorities a little
Prompted by https://stackoverflow.com/q/71173668/2931197

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 11:44:09 +00:00
Philip Withnall
2bc1036f80 tests: Fix a memory leak in the mainloop test
The source needs to be removed from the `GMainContext` before being
unreffed, otherwise the main context and main loop will be kept around.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
ba556e6d34 tests: Fix a memory leak in the keyfile test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
a389227fb9 tests: Fix a memory leak in the fileutils test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
c60a0a45de tests: Fix a memory leak in the tls-certificate test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
a4ce8399cd tests: Fix memory leaks in the g-file-info-filesystem-readonly test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
d007fdb079 tests: Fix a memory leak in the resources test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
9434e4a40c tests: Use g_assert_*() rather than g_assert() in resources.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
12a4fcdbed tests: Fix a leak in environment.c with undefined behaviour tests on
`g_environ_setenv()` and `g_environ_unsetenv()` were correctly returning
`NULL` when their preconditions failed (as the test is supposed to be
exercising). That overwrote the value of `env` without freeing it,
resulting in a leak.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
cb18e6b969 Merge branch 'empty-argv' into 'main'
Various minor fixes for empty argv handling

See merge request GNOME/glib!2466
2022-02-20 09:36:41 +00:00
Jordi Mas
f61187428e Update Catalan translation 2022-02-20 08:58:58 +01:00
Emmanuele Bassi
056d0dc7f3 Merge branch 'doc-declare' into 'main'
doc: Extend a bit G_DECLARE_* documentation example

See merge request GNOME/glib!2512
2022-02-19 20:52:21 +00:00
Xavier Claessens
893ff61176 doc: Extend a bit G_DECLARE_* documentation example 2022-02-19 14:23:37 -05:00
Christian Kirbach
bccc99b5ac Update German translation
(cherry picked from commit 6fb1aaccbd)
2022-02-19 13:48:26 +00:00
Daniel Șerbănescu
ed51073305 Update Romanian translation
(cherry picked from commit 9df5e573a2)
2022-02-19 13:42:36 +00:00
Aleksandr Melman
99ac2634a6 Update Russian translation 2022-02-18 19:30:44 +00:00
Philip Withnall
01a432d6ff glocalfileinfo: Add missing _g_stat_*() methods for win32
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 13:50:19 +00:00
Philip Withnall
a57c33fc1d Merge branch 'cleanup-warnings-split-3' into 'main'
Cleanup warnings split 3

See merge request GNOME/glib!2492
2022-02-18 13:45:42 +00:00
Philip Withnall
5ac86e21b3 Merge branch 'cleanup-warnings-split-2' into 'main'
Cleanup warnings split 2

See merge request GNOME/glib!2491
2022-02-18 13:39:25 +00:00
Philip Withnall
648f9efce0 tests: Remove extra debugging from gdbus-connection-flush
Having compared the debug output, it doesn’t show anything unusual
happening that can’t already be seen from other output, for this test.

This is a partial revert of 8fd71dccc5. The debugging output it added to
other tests may still be useful.

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

Helps: #1929
2022-02-18 13:24:13 +00:00