Commit Graph

29624 Commits

Author SHA1 Message Date
Philip Withnall
fee9223e74 Merge branch '2887-memory-monitor-tests' into 'main'
tests: Fix race condition in memory-monitor-dbus.test

Closes #2887

See merge request GNOME/glib!3844
2024-01-23 11:16:52 +00:00
Philip Withnall
67a9fbf1fa tests: Wait for memory monitor to be able to handle signals before testing
This fixes a race condition which frequently caused the
`memory-monitor-dbus.py` test to fail.

The registration of the `LowMemoryMonitor` object on the bus, and the
`GMemoryMonitorDBus`’s connection to the warning signal raced, such that
it was possible for the mock `LowMemoryMonitor` to emit a warning signal
before the `GMemoryMonitorDBus` proxy was listening, and hence the proxy
would never see the signal.

Fix this by explicitly synchronising the two before proceeding to the
tests.

Make the same changes in the `memory-monitor-portal.py` test too, even
though that one was not failing. This should remove the need for a 2s
wait on every test run.

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

Fixes: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
e0276a3a17 tests: Wait for LMM server to be available when starting test
Otherwise the test can go on to wait for a signal from the service
before it’s actually finished starting up.

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

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
1f2d9e69c9 tests: Assert correct monitor implementation is used in power-profile-monitor-dbus
This wasn’t failing, but it seems like a sensible thing to check.

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

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
6b22aaaa68 tests: Assert correct monitor implementation is used in memory-monitor-dbus
This wasn’t failing, but it seems like a sensible thing to check.

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

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
e3b81b3f0d tests: Rework assertEventually() to use GLib main context
Rather than sleeping and blocking everything, use a timeout source on
the main context so that inputs can continue to be handled while waiting
for a timeout.

This introduces no functional changes to the test.

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

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
b8fba4ddb4 Merge branch 'freebsd-iconv' into 'main'
gconvert: match GNU iconv behaviour on FreeBSD

See merge request GNOME/glib!3824
2024-01-22 18:40:03 +00:00
Ting-Wei Lan
ec780d0d4a Use the FreeBSD cgit URL 2024-01-22 15:39:33 +00:00
Philip Withnall
143cb92c35
2.79.1
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-22 14:30:24 +00:00
Philip Withnall
8a4ad5f998 tests: Add some debug output to memory-monitor-dbus.py test
This will hopefully help diagnose #2887.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #2887
2024-01-22 11:22:45 +00:00
Philip Withnall
5278efbd63 tests: Ensure Python assertEventually() function uses correct main context
It should be doing already (or the tests would never work), but make it
clearer in the code that the same `GMainContext` is being iterated as is
being woken up in the rest of the test.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #2887
2024-01-22 11:22:01 +00:00
Emmanuele Bassi
74a584e25a Merge branch 'fix-dist-docs' into 'main'
ci: Fix tarballing the docs on dist

See merge request GNOME/glib!3803
2024-01-22 10:45:15 +00:00
Philip Withnall
aee343fe5c Merge branch 'auto-lock' into 'main'
Add G_*_AUTO_LOCK macros

Closes #3223

See merge request GNOME/glib!3822
2024-01-21 21:02:35 +00:00
Philip Withnall
ca0e7c376a Merge branch 'compile-windows-resources-only-shared' into 'main'
gio, gmodule, gthread: compile windows resources only in shared build

See merge request GNOME/glib!3842
2024-01-21 20:42:15 +00:00
Hailey Somerville
c65e163240 gio, gmodule, gthread: compile windows resources only in shared build
When linking static libraries, multiple resources is an error unless
handled in a special way. glib and gobject do not have this problem,
as they already only include resources when building a shared lib.
2024-01-21 18:51:52 +11:00
Michael Catanzaro
75310f658d Merge branch 'alatiera/gmessage-docs' into 'main'
docs: Fix member names of GLib.LogLevelFlags

See merge request GNOME/glib!3841
2024-01-19 17:33:56 +00:00
Jordan Petridis
a011dd0048 docs: Fix member names of GLib.LogLevelFlags 2024-01-19 19:04:04 +02:00
Simon McVittie
62ee8bf693 Merge branch 'wip/smcv/clean-girepository-abi' into 'main'
girepository: Exclude private symbols from the ABI

See merge request GNOME/glib!3840
2024-01-19 12:22:45 +00:00
Emmanuele Bassi
3706ad526e Merge branch 'wip/smcv/typo' into 'main'
gvarianttype: Fix typos

See merge request GNOME/glib!3839
2024-01-19 12:15:43 +00:00
Simon McVittie
25ec19723c girepository: Exclude private symbols from the ABI
This removes the gthash utility functions from the ABI, so link those
into their automated test statically.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-19 12:07:30 +00:00
Simon McVittie
6da5e6a327 gvarianttype: Fix typos
Saying that a GtkWidget is a GtkWidget is trivially true, but not the
point we were trying to make here.

Fixes: b5c07063 "docs: Use code for class names in links"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-19 11:53:00 +00:00
Emmanuele Bassi
4ff4f073a4 Merge branch 'altiera/docs' into 'main'
docs: Fix links to symbols outside the allowed namsepace

See merge request GNOME/glib!3809
2024-01-18 18:35:21 +00:00
Philip Withnall
16b93f92fa ci: Run the thorough test setup on a weekly schedule
Merge it with the `G_DISABLE_ASSERT` test run, to avoid tying up another
test runner for no particular benefit.

By running the thorough tests regularly, we’ll hopefully avoid them
atrophying again (see the previous few commits full of fixes to them).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:45:00 +00:00
Philip Withnall
eb19551ebe build: Add thorough test setup
This allows the tests to be run with `meson test --setup thorough` and
it will run all the GTest tests with `-m thorough`.

Since this argument isn’t supported by the Python tests, it’s not passed
to them.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Philip Withnall
a4b9b41afc tests: Fix a double-free in param test
This isn’t normally hit because it’s in a test which is disabled unless
run with `-m thorough`.

The data is owned by `g_test_add_data_func_full()` until the end of the
process.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Philip Withnall
d738dcc76f tests: Fix an expected message in param test
This isn’t normally hit because it’s in a test which is disabled unless
run with `-m thorough`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Philip Withnall
5d38f3ebd4 tests: Fix a double-unref in params tests
This isn’t normally hit because it’s in a test which is disabled unless
run with `-m thorough`.

The `GParamSpec` is initially floating, but its floating ref is sunk by
`g_object_interface_install_property()` (regardless of whether that call
succeeds or aborts). The behaviour of
`g_object_interface_install_property()` in this respect may have changed
more recently than the test was written.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Philip Withnall
5537ee4d7f tests: Drop a duplicate test from testing tests
The test cancellation timeout was being tested twice, once only when run
with `-m thorough`. Seems a bit pointless.

Merge the two tests and use the smaller timeout values from the two, so
the test suite doesn’t run any more slowly than it did.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Philip Withnall
82a6c54135 tests: Fix running mapping test with -m argument
`g_test_init()` needs to be called before custom command line handling
so it has a chance to strip out the arguments it handles.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Philip Withnall
615060d872 tests: Drop some unnecessary messages from mapping test
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Marco Trevisan
7cd819126a Merge branch 'test-improvements' into 'main'
tests: A couple of test isolation improvements

See merge request GNOME/glib!3837
2024-01-18 16:27:12 +00:00
Philip Withnall
64e630e132 tests: Disable crash reporting in g_error() path in testing-helper
This avoids four coredumps being processed for every run of the
`testing` unit tests (which test `GTest`).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 15:23:53 +00:00
Philip Withnall
5c05dfad97 tests: Run more appinfo tests under a GTestDBus environment
I ran Bustle/dbus-monitor on the session bus while running the full GLib
test suite, and noticed that these tests were causing `Launched` signal
emissions on the main session bus. That suggested they weren’t isolated
properly, which at best causes noise on the bus and at worst could cause
spurious test failures.

Fix that by running those tests in a `GTestDBus` environment, as some of
the other appinfo tests already are.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 15:22:30 +00:00
Philip Withnall
217e25ac67 Merge branch '3216-girepository-casting' into 'main'
girepository: Rearrange type hierarchy and add type casting and checking macros

Closes #3216

See merge request GNOME/glib!3836
2024-01-18 14:53:43 +00:00
Philip Withnall
b13d8883b8 Merge branch '3155-girepository-more-api-cleanups' into 'main'
girepository: Change various alignments to use size_t

See merge request GNOME/glib!3833
2024-01-18 14:50:42 +00:00
Emmanuele Bassi
a899933acb Merge branch 'lcov-clear' into 'main'
build: Ignore branches in g_clear_*() functions under lcov

See merge request GNOME/glib!3835
2024-01-18 13:58:21 +00:00
Philip Withnall
993eae63ab tests: Use g_assert_*() rather than g_assert() in gthash tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 13:15:22 +00:00
Philip Withnall
9cbe5ae67d tests: Add tests for several GIBaseInfo subclasses
They get at least these `GIBaseInfo` subclasses up to a reasonable (but
not complete) coverage level.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 13:15:22 +00:00
Philip Withnall
9aea530ac0 gibaseinfo: Add initialiser macro for GIAttributeIter
Makes it a little easier to use.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 13:15:22 +00:00
Philip Withnall
57d64b111f girepository: Add type-checking cast macros
These follow GObject conventions, using `G_TYPE_CHECK_INSTANCE_CAST` to
cast to the given type, and potentially performing some runtime checks
of the type instance’s `GType` too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
9debaffe0e gibaseinfo: Remove need for casting for gi_base_info_ref() and unref()
Just like is done with `g_object_{ref,unref}()`, make these functions
take a `void*` rather than a `GIBaseInfo*`, since they’ll most likely be
called with a type which is derived from `GIBaseInfo*` rather than a
`GIBaseInfo*` itself.

Add some runtime type checks to make up for lowering the compile time
type safety.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
5423bf4df7 girepository: Rework IS_(type) macros to use G_TYPE_CHECK_INSTANCE_TYPE
This means they’re now using the `GType` type system rather than the old
`GIInfoType` type system. Given the preceding few commits, these two
systems should now be equivalent.

This makes the type handling more conventional and hence a bit simpler
for people to use if they have experience with GObject.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
a99a35ab39 giregisteredtypeinfo: Make abstract and add subtypes
There are various info types which were previously treated as subtypes
of `GIRegisteredTypeInfo` by the runtime type system in the old version
of libgirepository.

Change the new type tree to reflect that, making several types now be
subtypes of `GIRegisteredTypeInfo`, and making `GIRegisteredTypeInfo`
abstract.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
7228c6d3e0 giboxedinfo: Add a tag type for boxed types
Boxed types are already represented within `GIInfoType`, so they should
have a `GType` representation as well.

In an upcoming commit, this will allow us to represent the subtype
relation between `GIBoxedInfo` and `GIRegisteredTypeInfo` too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
eafc35e5ed gienuminfo: Split out GIFlagsInfo as a derived type
Flag enums are already treated as a special kind of enum within
`GIInfoType`, so it would be tidier to give it its own `GType` too, with
a subtype relation to `GI_TYPE_ENUM_INFO`.

This will simplify implementing `GI_IS_ENUM_INFO` in a following commit
too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
d82675ffd3 gicallableinfo: Make abstract and add derived types
Previously (and incorrectly), `GICallableInfo`, `GIFunctionInfo`,
`GICallbackInfo`, `GISignalInfo` and `GIVFuncInfo` were all derived
directly from `GIBaseInfo`. `GICallableInfo` is supposed to represent
all of the other types, though, so that type hierarchy was incorrect. It
dated from when all the types were aliases of each other and the type
management was done entirely at runtime.

Fix that by making the other four types derive from `GICallableInfo`,
and marking `GICallableInfo` as abstract.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
4d5b6599fc gibaseinfo: Allow parent types to be specified for derived types
This doesn’t change the type hierarchy for now (i.e. it introduces no
functional changes), but it will allow us to add some intermediate types
into the `GIBaseInfo` hierarchy in an upcoming commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
71a19a6f65 gibaseinfo: Allow type flags to be specified for derived types
This doesn’t change any of the flags for now (i.e. it introduces no
functional changes), but it will allow us to make some of the types
abstract in an upcoming commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
8e3d98fc98 girepository: Add get_type() wrapper macros
This makes `GIBaseInfo` and derived types more consistent with GObject
convention, and thus a bit more comfortable to use.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
9377a0dd54 girepository: Split GIValueInfo out of gienuminfo.c
It’s a separate type, so it would be less confusing if it were in its
own file.

This doesn’t change any API.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-18 13:15:22 +00:00