Commit Graph

25085 Commits

Author SHA1 Message Date
Emmanuel Fleury
b5c162635c Fix spelling mistake in filename when unlinking it after the test. 2022-04-17 08:08:30 +02:00
Emmanuel Fleury
9ed0dc5583 Clean the file "iochannel-test-outfile" after the test test_small_writes() 2022-04-17 08:08:30 +02:00
Emmanuel Fleury
8901898da2 Cleaning file 'filename' after the test in glib/tests/fileutils.c 2022-04-17 08:08:23 +02:00
Enrico Nicoletto
15d6558ea2 Update Brazilian Portuguese translation 2022-04-15 17:07:22 +00:00
Philip Withnall
41fcb33034 tests: Fix a minor leak in the unicode-normalize test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Coverity CID: #1487904
2022-04-14 13:26:25 +01:00
Philip Withnall
d987146fe1 Merge branch 'w32-tests' into 'main'
Fix test suite on Windows

See merge request GNOME/glib!2449
2022-04-14 12:16:19 +00:00
Marc-André Lureau
e9f46d3529 gio/tests: fix socket /socket/credentials/unix_socketpair on win32
When I enabled unix socketpair test on win32, I left the existing
g_close(fds[1]), but _g_win32_socketpair() returns native sockets
descriptors that must be closed with closesocket() on win32.

Let GSocket handle the socket pair cleanup.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-04-14 15:38:47 +04:00
Marc-André Lureau
89539d9ae0 gio/tests: GStatBuf.st_size is 64 bits on win64
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-04-14 15:38:47 +04:00
Marc-André Lureau
ae1cccaa0a glib/gstdio: simplify GStatBuf macro condition for win64
As noted by Charlie Barto: "both mingw64 and msvc define _WIN64 in
64-bit mode, and both are LLP64, and both have struct _stat64 defined
the same way."

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2449#note_1372190

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-04-14 15:38:47 +04:00
Marc-André Lureau
f82f4776c0 tests: fix protocol test on win32
The pipe must be closed, or the child PID watch doesn't get triggered.

We should remove the message callback source on EOF, as EOF during main
loop run will reach a bad assert in the callback.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-04-14 15:38:47 +04:00
Philip Withnall
a072c84d95 Merge branch 'gdate-no-dst' into 'main'
GDate: Fix tests on Windows on certain locales

See merge request GNOME/glib!2600
2022-04-13 21:12:46 +00:00
Chun-wei Fan
a8f1058d3b glib/tests/date.c: Fix 2-digit year test
...for certain Windows locales, since the formats accepted for
g_date_set_parse() will vary depending on the current system locale.  For
instance, g_date_set_parse(gdate, "dd/mm/yy") is accepted on locales such
as zh-HK (Chinese (Hong Kong SAR)) but is rejected on zh-TW (Chinese
(Taiwan)).

One can tell from the "date format" settings in the Windows system
control panel whether there is a "dd/MM/YYYY" or "dd/MM/YY" option from the
drop-down list of date formats to display for the locale, which will indicate
whether g_date_set_parse(gdate, "dd/mm/yy") is accepted, which is true for
zh-HK but is not true for zh-TW.

If g_date_set_parse(gdate, "dd/mm/yy") is not accepted, try again with
g_date_set_parse(gdate, "yy/mm/dd") thereafter for the 2-digit-year tests.
2022-04-13 00:02:57 +08:00
Chun-wei Fan
697d3112b0 gdate.c: Use standard name if no daylight saving exists
We should normally have a standard name for the time zone even if we don't
have daylight saving in the time zone, so use the standard name also when
GetTimeZoneInformation() returns TIME_ZONE_ID_UNKNOWN[1][2].

[1]: https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-gettimezoneinformation
[2]: https://docs.microsoft.com/zh-tw/windows/win32/api/timezoneapi/nf-timezoneapi-settimezoneinformation
2022-04-12 23:43:16 +08:00
Philip Withnall
58f54e8303 tests: Reduce wakeup interval in gdbus-threading
When checking that the connection has the expected number of refs, the
test would block on a `GMainContext` iteration for up to 3s before
waking up and failing (if the refcount was still not as expected).

This check was written in the expectation that changing the refcount of
the connection would only happen due to dispatching a source on
`GMainContext` — hence the `GMainContext` would wake up as the refcount
changed.

That’s probably not actually true though. It might be the case that the
connection’s refcount is changed on from the GDBus worker thread, which
would not cause any wakeups on the main thread’s `GMainContext`.

In this case, the `GMainContext` iteration in
`assert_connection_has_one_ref()` would block for the full 3s, and then
wake up and notice the refcount is correct (then the test would
proceed).

That’s fine, apart from the fact that `test_threaded_singleton()` does
this 1000 times. If the slow case is hit on a significant number of
those test runs, the test will take around 3000s to complete, which is
significantly more than meson’s test timeout of 360s. So the test fails
with something like:
```
220/266 glib:gio+slow / gdbus-threading         TIMEOUT 360.07 s

--- command ---
G_TEST_SRCDIR='/builds/GNOME/glib/gio/tests' GIO_MODULE_DIR='' G_TEST_BUILDDIR='/builds/GNOME/glib/_build/gio/tests' /builds/GNOME/glib/_build/gio/tests/gdbus-threading
--- stdout ---
\# random seed: R02S83fe8de22db4d4f376e6d179e2bdd601
1..3
\# Start of gdbus tests
ok 1 /gdbus/delivery-in-thread
ok 2 /gdbus/method-calls-in-thread
\# GLib-GIO-DEBUG: refcount of 0x5602de913660 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913660 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913c60 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913c60 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913260 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913260 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
```

From this log, it can be seen that the sleep is happening on a different
`GMainContext` every other time, so the test *is* making progress.

Assuming this is a correct diagnosis (it’s a lot of guessing), this
commit tries to fix the test by adding a wakeup timeout to the
`GMainContext` in `assert_connection_has_one_ref()`, which will wake it
up every 50ms to re-check the exit condition.

This polling approach has been taken because it doesn’t seem feasible to
make sure that every `g_object_ref()`/`g_object_unref()` call on a
`GDBusConnection` causes the main context to wake up.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 14:39:43 +01:00
Philip Withnall
77416fc023 tests: Use g_assert_*() rather than g_assert() in gdbus-peer-object-manager
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 13:29:19 +01:00
Philip Withnall
20c3ab9e51 tests: Use G_TEST_OPTION_ISOLATE_DIRS in gdbus-peer-object-manager
This might fix a recent test failure:
https://gitlab.gnome.org/GNOME/glib/-/jobs/1929015. Unfortunately
there’s not much debug information in the logs to go on, and I can’t
reproduce it locally. All I have is:
```
192/272 glib:gio / gdbus-peer-object-manager    FAIL     0.43 s (killed by signal 11 SIGSEGV)

--- command ---
GIO_MODULE_DIR='' G_TEST_BUILDDIR='/builds/GNOME/glib/_build/gio/tests' G_TEST_SRCDIR='/builds/GNOME/glib/gio/tests' /builds/GNOME/glib/_build/gio/tests/gdbus-peer-object-manager
--- stdout ---
\# random seed: R02Seee9b7325ecd7c19249a3412397aed9b
1..2
\# Start of gdbus tests
\# Start of peer-object-manager tests
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 13:29:19 +01:00
Philip Withnall
df80a224d7 tests: Use g_test_message() rather than fprintf()
This ensures that the output is redirected properly, and prefixed with
`#` when outputting in TAP mode, so that it doesn’t confuse the TAP
format parser.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 13:21:29 +01:00
Philip Withnall
ba9620f947 tests: Ensure NormalizationTest.txt is installed for installed-tests
This should fix the installed-tests CI failure:
https://gitlab.gnome.org/GNOME/glib/-/jobs/1946794

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 13:20:48 +01:00
Philip Withnall
fd79c8742b Merge branch 'onceinit_test' into 'main'
Move tests/onceinit.c to glib/tests/onceinit.c

See merge request GNOME/glib!2601
2022-04-12 12:00:27 +00:00
Simon McVittie
bb04fdc013 Merge branch 'wip/pwithnall/fix-bsd-spawn-test' into 'main'
tests: Make a string comparison on an error string more relaxed

See merge request GNOME/glib!2597
2022-04-11 15:16:20 +00:00
Emmanuel Fleury
49ecdd1dba Move tests/onceinit.c to glib/tests/onceinit.c
Related to issue #1434
2022-04-11 15:26:40 +02:00
Emmanuel Fleury
91dddb0641 Convert onceinit.c to glib test framework 2022-04-11 15:26:33 +02:00
Aleksandr Melman
382244631c Update Russian translation 2022-04-09 15:34:12 +00:00
Yuri Chornoivan
51c7215c50 Update Ukrainian translation 2022-04-08 11:43:26 +00:00
Philip Withnall
403edad934 ci: Combine style-check-diff and check-todos jobs into one
They are functionally quite similar, and combining them saves around 1
minute of CI runner time per pipeline, which is a nice saving for very
little downside.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-08 12:37:08 +01:00
Philip Withnall
3515170461 tests: Make a string comparison on an error string more relaxed
It currently fails on FreeBSD with:
```
Bail out! GLib:ERROR:../glib/tests/spawn-test.c:111:test_spawn_basics: assertion failed (erroutput == "sort: cannot read: non-existing-file.txt: No such file or directory\n"): ("sort: No such file or directory\n" == "sort: cannot read: non-existing-file.txt: No such file or directory\n")
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-08 12:25:59 +01:00
Philip Withnall
690e64afef Merge branch 'unicode-normalize-test' into 'main'
Move test tests/unicode-normalize.c to glib/tests/

See merge request GNOME/glib!2586
2022-04-08 10:54:57 +00:00
Philip Withnall
be96ea9222 Merge branch 'wip/format_size_value_units' into 'main'
gutils: Add flags to g_format_size_full() to return only value or only units

See merge request GNOME/glib!2545
2022-04-08 10:54:45 +00:00
Philip Withnall
900b945988 Merge branch 'spawn_test' into 'main'
Move tests/spawn-test.c -> glib/tests/spawn-test.c

See merge request GNOME/glib!2575
2022-04-08 10:38:36 +00:00
Milan Crha
05a8ef6647 gutils: Add flags to g_format_size_full() to return only value or only units
This allows to split the formatted size into the value and into the units,
when can be shown differently in the UI.

Relate to https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1391
2022-04-08 11:36:03 +01:00
Charles Monzat
b9cbb61563 Update French translation 2022-04-08 10:21:58 +00:00
Emmanuel Fleury
b25eb3808d Move unicode-normalize test from tests/ to glib/tests/
Helps issue #1434
2022-04-08 11:27:13 +02:00
Emmanuel Fleury
2c37b92dfa Enable and convert tests/unicode-normalize.c to glib test framework 2022-04-08 11:24:43 +02:00
Fran Dieguez
8e5c72953b Update Galician translation 2022-04-07 21:36:07 +00:00
Emmanuel Fleury
762ed2e82b Move tests/spawn-test.c -> glib/tests/spawn-test.c
Related to issue #1434
2022-04-07 18:36:45 +02:00
Emmanuel Fleury
5a7a69bd99 Convert tests/spawn-test.c to glib test framework 2022-04-07 18:36:14 +02:00
Philip Withnall
a7aa029a11 Merge branch 'dup-socket' into 'main'
gio/tests: DuplicateHandle() is inappropriate for SOCKET

See merge request GNOME/glib!2592
2022-04-07 11:22:55 +00:00
Marc-André Lureau
2a925f273b gio/tests: DuplicateHandle() is inappropriate for SOCKET 2022-04-07 11:22:55 +00:00
Sebastian Dröge
3e9a5d40b2 Merge branch 'ci-expire-artifacts' into 'main'
ci: Expire CI artifacts after 1 week

See merge request GNOME/glib!2594
2022-04-07 10:12:55 +00:00
Sebastian Dröge
86a24bb19a Merge branch 'wip/pwithnall/converter-stream-debugging' into 'main'
tests: Remove an incorrect assertion in converter-stream

See merge request GNOME/glib!2591
2022-04-06 13:15:01 +00:00
Philip Withnall
f68943dcf2 ci: Expire CI artifacts after 1 week
The default is 30 days, but we don’t need them around that long. This
should free up some disk space on the GitLab/CI runner systems.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-06 12:54:54 +01:00
Sebastian Dröge
c80ff2474f Merge branch 'wip/pwithnall/2625-clang-cxx' into 'main'
gatomic: Add a C++ variant of g_atomic_int_compare_and_exchange()

Closes #2625

See merge request GNOME/glib!2578
2022-04-06 10:08:35 +00:00
Daniel Mustieles
be555e247a Updated Spanish translation 2022-04-06 08:21:56 +02:00
Philip Withnall
e2426dd74d Merge branch 'list-store-equal-full' into 'main'
gio: Add g_list_store_find_with_equal_func_full()

Closes #2447

See merge request GNOME/glib!2549
2022-04-05 18:02:15 +00:00
Jason Francis
a85246af3b gio: Add g_list_store_find_with_equal_func_full()
Fixes: #2447
2022-04-05 18:34:39 +01:00
Philip Withnall
aec5d17d77 tests: Remove an incorrect assertion in converter-stream
While the assertion always turned out to be true on Linux, it frequently
caused spurious test failures on FreeBSD.

After some remote debugging, I *think* the cause is as written up in the
comment in the code in this commit. However, I cannot be certain, as the
more debugging messages I added, the harder the failure was to
reproduce; and I don’t have access to a FreeBSD machine.

This fixes failures like:
```
Bail out! GLib-GIO:ERROR:../gio/tests/converter-stream.c:1043:test_converter_pollable: assertion failed (error == NULL): Resource temporarily unavailable (g-io-error-quark, 27)
```

It’s succeeded 1000 times in a row on the FreeBSD CI now; previously
it was failing one time in three:
https://gitlab.gnome.org/GNOME/glib/-/jobs/1936395.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-05 18:19:23 +01:00
Philip Withnall
59751e86fd Merge branch 'signal-group-connect-object' into 'main'
gobject: Add g_signal_group_connect_closure

See merge request GNOME/glib!2521
2022-04-05 16:32:12 +00:00
Jason Francis
2a842b1173 gobject: Add g_signal_group_connect_closure 2022-04-05 15:32:20 +01:00
Simon McVittie
28add9abfe Merge branch 'test-dbus-exit-on-close' into 'main'
tests: Don’t exit gdbus-method-invocation test early on connection close

See merge request GNOME/glib!2589
2022-04-05 14:23:53 +00:00
Simon McVittie
04e5f93e38 Merge branch 'version-bump' into 'main'
build: Post-release version bump to 2.73.0

See merge request GNOME/glib!2577
2022-04-05 14:20:14 +00:00