Commit Graph

27178 Commits

Author SHA1 Message Date
Philip Withnall
2029d7e900 gpollfilemonitor: Add missing attribute checks for g_file_info_get_size()
Missed from the fixes for #2907.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-21 12:15:50 +00:00
Philip Withnall
4ba3470269 gio: Add some missing file info attribute checks in gio-list and gio-tree
Further fallout from #2907.

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

Fixes: #2948
2023-03-21 12:15:50 +00:00
Philip Withnall
23a009b2cb Merge branch '919-variant-dict-lookup-docs' into 'main'
gvariant: Document failure behaviour of g_variant_dict_lookup() better

Closes #919

See merge request GNOME/glib!3334
2023-03-21 12:07:20 +00:00
Philip Withnall
ec03755355 gio-tool-info: Fix a duplicate attribute name in the UI
`gio info` currently prints ‘display name:’ twice. One of those should
be ‘edit name:’ — this regressed in commit
a374b7c806.

Various translations still have the old string, but some unfortunately
do not, so this is effectively a new translatable string again.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-21 11:31:38 +00:00
Jan Beich
f6c40b1d27 meson: allow -Dlibelf=enabled without pkg-config
gio/meson.build:933:0: ERROR: Dependency "libelf" not found, tried pkgconfig
2023-03-20 14:57:36 +00:00
Colin Walters
8d7c1f9b75 tests: Finish update of gdbus-example-proxy-subclass to new GDBus API
This fixes bug #624696.

Incorporates a more recent change from 1dc774a653 to drop the
`g_type_init()` call, and reformats the indentation a bit.

Fixes: #322
2023-03-20 13:03:04 +00:00
Philip Withnall
7d090d1510 gvariant: Document failure behaviour of g_variant_dict_lookup() better
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #919
2023-03-20 12:16:54 +00:00
Philip Withnall
3d7e88a77d build: Drop old .gitignore files from test directories
They just listed built files. Since the move to Meson, these are all
kept in a separate build directory, not the source tree, so don’t need
to be ignored.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-20 12:09:02 +00:00
Philip Withnall
7dfde773f6 gstrfuncs: Clarify haystack_len behaviour of g_strstr_len()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #159
2023-03-20 11:55:53 +00:00
Philip Withnall
5fdacf78e2 tests: Check a few results in strfuncs tests
This fixes some written-but-never-read warnings from `scan-build`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-20 10:43:25 +00:00
Philip Withnall
7df41f6a1c tests: Re-enable mainloop test under AddressSanitizer
This is a partial revert of commit f378352051.

The leak of a `GMainLoop` which prompted it has been fixed by commit
4f5da83381 in merge request !2535.

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

See: #2598
Fixes: #2307
2023-03-17 15:44:14 +00:00
Emmanuele Bassi
e979fd9a15 Merge branch '2943-g-test-init-docs' into 'main'
gtestutils: Clarify docs about calling g_test_init() before anything

Closes #2943

See merge request GNOME/glib!3327
2023-03-17 11:29:29 +00:00
Philip Withnall
045bc7adde gtestutils: Clarify docs about calling g_test_init() before anything
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2943
2023-03-17 11:03:09 +00:00
Philip Withnall
98a567ce7f Merge branch 'queue-test' into 'main'
tests: Reduce number of iterations in queue test

See merge request GNOME/glib!3324
2023-03-16 17:45:22 +00:00
Philip Withnall
790fbfab4c Merge branch 'xry111/issue2936' into 'main'
gstrfuncs: Improve inline version of g_strdup() to avoid breaking C++ code

Closes #2936

See merge request GNOME/glib!3322
2023-03-16 12:13:10 +00:00
Philip Withnall
9d7c796f1e Merge branch 'fix-monitor-root-directory-fail' into 'main'
inotify: Avoid empty root directory string

See merge request GNOME/glib!3241
2023-03-16 12:12:01 +00:00
Philip Withnall
eff90c09f5 tests: Simplify a helper function in queue test
Remove an unnecessary intermediate variable.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Philip Withnall
ea852e2683 tests: Fix signed/unsigned comparisons and assignments in queue test
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Philip Withnall
2d89f84267 tests: Reduce number of iterations in queue test
Unless `-m thorough` is passed to the tests, reduce the number of
iterations in the random test.

This one test case takes the bulk of the time to run the `queue` test
suite, and is sometimes causing timeouts when running on CI
(particularly under valgrind). Reduce it to a fifth.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Philip Withnall
1f6a4d60d4 tests: Add copyright/licensing header to queue tests
This is put together through git archaeology:
```
git log glib/tests/queue.c
git log -- tests/queue-test.c
```

The following commits were too trivial to have meaningful copyright:
 - 8f02fac4ad
 - d81ac5339f
 - 29f2ced8eb
 - 1a2c5e155d
 - 8a90f5e9f6
 - 45dae4b506
 - 2aa71ab63b
 - 3a74ad128e

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

Helps: #1415
2023-03-16 12:05:07 +00:00
Philip Withnall
8b25142cb2 tests: Use g_assert_*() rather than g_assert() in queue tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Guillaume Desmottes
6b39af34aa glib: unicode: add some empty string tests 2023-03-15 15:14:53 +00:00
Guillaume Desmottes
deb495de42 glib: unicode: add tests for g_utf8_normalize()
Test corner cases and some examples from Unicode Standard Annex #15
http://unicode.org/reports/tr15/
2023-03-15 15:14:53 +00:00
Guillaume Desmottes
221bbde429 glib: unicode: fix unicode standard link 2023-03-15 15:14:53 +00:00
Philip Withnall
f535d0915f tests: Add a test for creating a file monitor on the root directory
While we can’t check for any events on it, this at least tests that
creating a file monitor works. It should cover the fix from the previous
commit.

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

Helps: !3241
2023-03-15 14:45:10 +00:00
Marco Trevisan
7fec23ed5e Merge branch 'desktop-app-info-startup-id' into 'main'
gdesktopappinfo: Add a missing NULL check

See merge request GNOME/glib!3325
2023-03-15 14:03:58 +00:00
Philip Withnall
1a9be3a1c8 tests: Add a test for D-Bus activating an unknown app with a context
This should catch regressions in the critical warning fixed in the
previous commit.

The launch has to have several conditions:
 - Session bus is running (to avoid the launch happening via the spawn
   codepath)
 - Use a non-existent D-Bus name (to trigger a launch error)
 - Use a launch context (to hit the critical warning code path)
 - Not have a startup ID specified in the platform data — this implies
   having an empty launch context
 - Use an async launch, as that provides an error handling path

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-15 13:50:51 +00:00
Xi Ruoyao
cc7f2f81cc
gstrfuncs: Improve inline version of g_strdup() to avoid breaking C++ code
Wrap the logic into a G_ALWAYS_INLINE function, instead of using a
complex statement-expression which is not allowed in braced initializer
lists and expanded into some bad thing when it's used as
`::g_strdup(...)`.

We cannot use `__builtin_constant_p (str)` because GCC documentation
clearly states that it always produces 0 when str is a const char *
argument of an inline function.  But `__builtin_constant_p (!str)`,
`__builtin_constant_p (!!str)`, and
`__builtin_constant_p (strlen (str))` functions properly with `-O1` or
above enabled.

Fixes #2936.
2023-03-15 15:18:34 +08:00
Philip Withnall
7cd57b3e85 gdesktopappinfo: Add a missing NULL check
It’s possible for the startup ID to be `NULL` if one wasn’t provided in
the platform data passed to `launch_uris_with_dbus()`.

Passing `NULL` to `g_app_launch_context_launch_failed()` causes a
critical warning.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-14 14:37:14 +00:00
Philip Withnall
8fbb8dc442 Merge branch 'test-failures' into 'main'
tests: Fix timeout sources in gdbus-auth and gapplication tests

See merge request GNOME/glib!3323
2023-03-14 10:26:27 +00:00
Philip Withnall
764f8426d4 tests: Remove explicit timeout handler from gdbus-auth tests
The timeout runs for the entire duration of the test, which is a
function that Meson’s test harness already provides for us.

Meson’s timeout can be easily adjusted by a factor to allow for running
tests more slowly under valgrind. The timeout in the code cannot, which
leads to spurious failures like
https://gitlab.gnome.org/GNOME/glib/-/jobs/2645271.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-13 11:21:17 +00:00
Philip Withnall
642ee744b8 tests: Fix g_source_remove() of non-existent source in gapplication test
If the timeout callback was executed, it would remove the timeout
source, leaving the `g_source_remove()` call in the main function with a
dangling source ID.

Fixes commit 73205b8bbd.

Spotted in https://gitlab.gnome.org/GNOME/glib/-/jobs/2645271.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-13 11:19:56 +00:00
Marco Trevisan
dc59380561 Merge branch 'bookmarkfile-timings' into 'main'
tests: Change the time function used in the bookmark tests

See merge request GNOME/glib!3315
2023-03-13 11:00:13 +00:00
Philip Withnall
b65b9255bb Merge branch 'rtld-next-cygwin' into 'main'
tests: only build messages-low-memory if RTLD_NEXT is available

See merge request GNOME/glib!3321
2023-03-13 10:48:13 +00:00
Christoph Reiter
94fd305dbd tests: only build messages-low-memory if RTLD_NEXT is available
This fixes the build under cygwin which doesn't have RTLD_NEXT.
Use the existing have_rtld_next to skip the test program in that case.
2023-03-12 12:29:03 +01:00
Sabri Ünal
ed256d6447 Update Turkish translation 2023-03-10 18:39:48 +00:00
Guillaume Bernard
d05417e3f1 Update French translation 2023-03-10 17:17:40 +00:00
Philip Withnall
618c340726 Merge branch 'fix-issue-2922' into 'main'
GWin32AppInfo: Add NULL string checks

Closes #2922

See merge request GNOME/glib!3317
2023-03-10 16:05:03 +00:00
Philip Withnall
cb7089d461 Merge branch 'wip/abono/always-inline-fallback' into 'main'
gmacros: Add GCC < 5 fallback for __always_inline__

See merge request GNOME/glib!3318
2023-03-10 15:33:11 +00:00
Philip Withnall
66492ec02e Merge branch 'dab_disable_fuzzing_tests' into 'main'
fuzzing: do not build tests if build_tests is false

See merge request GNOME/glib!3319
2023-03-10 15:32:45 +00:00
Philip Withnall
8a9ada6639
2.76.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-10 14:33:15 +00:00
Stéphane Cerveau
52b9af5fd9 fuzzing: do not build tests if build_tests is false 2023-03-10 12:11:11 +01:00
Alessandro Bono
13b564d027 gmacros: Add GCC < 5 fallback for __always_inline__
Commit 15cd0f0461 introduced a check
for the __always_inline__ attribute. However, we don't define a
fallback for GCC < 5.
2023-03-09 14:33:43 +01:00
Alessandro Bono
3bbd728868 gmacros: Sort alphabetically 2023-03-09 14:30:38 +01:00
Luca Bacci
061da06118 GWin32AppInfo: Add NULL string checks
Fixes #2922
2023-03-09 14:29:38 +01:00
Jordi Mas i Hernandez
d9a01931c3 Update Catalan translation 2023-03-07 20:57:29 +00:00
Ondrej Holy
1e4a8d3271 Merge branch '2934-false-null-file-attributes' into 'main'
glocalfile: Set various file attributes if their value is FALSE

Closes #2934

See merge request GNOME/glib!3313
2023-03-07 15:33:59 +00:00
Philip Withnall
e35f4a04cc tests: Change the time function used in the bookmark tests
The current comparison has been seen to fail on vs2017-x86
(https://gitlab.gnome.org/pwithnall/glib/-/jobs/2643197):
```
not ok /bookmarks/deprecated - GLib:ERROR:../glib/tests/bookmarkfile.c:921:test_deprecated: assertion failed (t >= now): (1678122080 >= 1678122081)
```

I guess this is caused by a mismatch between the system clock as used by
`time (NULL)` and `g_get_real_time ()` (which is ultimately what
`g_bookmark_file_set_added()` uses) on Windows.

Attempt to fix that by using `g_get_real_time()` in the test harness
too, so the clock being used is consistent.

If that doesn’t work, my next guess is that some of the code in
`test_deprecated()` is being reordered by the compiler. But that
shouldn’t happen, because the `time()` call has side-effects, and
`g_bookmark_file_set_added()` has side-effects, so they shouldn’t be
reordered with respect to each other. And certainly not so that the
latter one (in code order) ends up being called 1s after the other.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-06 18:25:42 +00:00
Philip Withnall
ff2fad77ef Merge branch 'wip/oholy/lost-and-found-is-hidden' into 'main'
glocalfileinfo: Mark the lost+found dir as hidden again

See merge request GNOME/glib!3310
2023-03-06 17:47:46 +00:00
Philip Withnall
ab3076a242 Merge branch '2932-check-etag-attributes' into 'main'
gfile: Check ETag attribute is present before trying to get it

Closes #2932

See merge request GNOME/glib!3312
2023-03-06 17:42:01 +00:00