Commit Graph

351 Commits

Author SHA1 Message Date
Marc-André Lureau
fdfe94fb16 tests/gobject-query: it is not a script (anymore?)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:01:51 +04:00
Philip Withnall
350b92821c Merge branch 'wip/smcv/deprecated-construct-prop' into 'main'
gobject: Only emit deprecation warnings for user-specified properties

Closes #2748

See merge request GNOME/glib!2912
2022-10-12 13:56:46 +00:00
Philip Withnall
e90733a457 Merge branch 'atomic-older-cplusplus' into 'main'
gatomic: fix the atomic compare_and_exchange macros on older C++ standard versions

See merge request GNOME/glib!2864
2022-10-12 09:56:19 +00:00
Marco Trevisan (Treviño)
80cf66034b gobject/tests/param: Add unit test for handling invalid NULL param spec
This was fixed by !2921 but there was no test with the MR, so add one.
2022-10-10 21:01:10 +02:00
Marco Trevisan
87b4771d1f Merge branch 'install-tag-2' into 'main'
meson: Set install_tag remaining installed files

See merge request GNOME/glib!2905
2022-09-21 10:05:18 +00:00
Simon McVittie
86d4da1634 gobject: Add a test for deprecated properties
Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2748
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21 10:27:55 +01:00
Xavier Claessens
c00df192ee meson: Set install_tag on installed tests files
This could be done automatically by Meson, this commit can be reverted
when we have that Meson PR in our CI:
https://github.com/mesonbuild/meson/pull/10829
2022-09-20 11:30:02 -04:00
Marco Trevisan
22f0522c10 Merge branch 'mcatanzaro/gtype-criticals' into 'main'
Replace most GObject warnings with criticals

See merge request GNOME/glib!2852
2022-09-19 14:35:12 +00:00
Marco Trevisan (Treviño)
1cbe7a6734 meson: Build C++ tests for the currently supported C++ standard versions
We've various macros definitions that are depending using C++ features
that may not work in all the standard versions, so recompile the cxx
tests that we have in all the ones we want to support.
2022-09-15 01:18:40 +02:00
Sebastian Dröge
d41b5bf999 Revert "Merge branch 'wip/smcv/deprecated-construct-prop' into 'main'"
This reverts merge request !2888
2022-09-13 11:20:03 +00:00
Simon McVittie
fef0408eaa gobject: Add a test for deprecated properties
Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2748
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-13 11:20:45 +01:00
Emmanuele Bassi
903c004b37 Fix array-bounds compiler warnings with GCC 12
GCC isn't smart enough to recognise that the assertion on the size of
N_PROPERTIES also affects the assertion on the GParamSpec array access,
so we need to coalesce the two checks into one to avoid an array-bounds
compiler warning.
2022-09-02 12:46:57 +01:00
Michael Catanzaro
0ffe86a1f7 Replace most GObject warnings with criticals
All of these warnings indicate programmer error, so critical is most
appropriate here.

Exceptions: deprecation warnings are just warnings. Also, warnings that
are worded with uncertainty can remain warnings rather than criticals.
2022-08-09 13:18:47 -05:00
Emmanuele Bassi
8f68c1e646 Rename G_MARKUP_PARSE_FLAGS_NONE
The prefix for GMarkupParseFlags enumeration members is G_MARKUP; this
means that G_MARKUP_PARSE_FLAGS_NONE gets split into
GLib.MarkupParseFlags.PARSE_FLAGS_NONE by the introspection scanner.

The `/*< nick=none >*/` trigraph attribute is a glib-mkenum thing, and
does not affect the introspection scanner; it would also only affect the
GEnumValue nickname, which is not used by language bindings to resolve
the name of the enumeration member. Plus, GMarkupParseFlags does not
have a corresponding GType anyway.
2022-07-25 22:30:22 +01:00
Simon McVittie
72868c026d gobject/tests/performance: Only run a quick version as installed-tests
ginsttest-runner defaults to timing out each test after 5 minutes,
but gobject/tests/performance/performance.c defaults to running each
of 18 tests for 15 seconds. The result is close enough to 5 minutes
that the setup overhead is enough to make it time out.

We're only running these tests to prove that they still work, not to
get meaningful performance numbers, so cut them down to 1 second per
test-case (the result of which is that performance.c takes about a
minute).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-24 17:34:55 +01:00
Simon McVittie
0714bcb7f4 gobject/tests/performance: Use the other installed-tests template
These are not GTest tests, and don't output TAP.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-24 17:15:47 +01:00
James Hilliard
d0b9ebbaac meson: fix build without cpp toolchain
We don't need a cpp toolchain for building glib so lets just
automatically disable tests requiring one when not available.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-07-15 12:58:41 -06:00
Marco Trevisan (Treviño)
28dc989fc1 gobject/tests: Add test to verify that custom dispatch is called on init
As per this, rename the old test so that it's more in line with the
new one and with what it does.
2022-07-09 00:24:13 +02:00
Marco Trevisan (Treviño)
ed130c8d3b gobject/tests/custom-dispatch: Mark the foo property as explicit-notify
We're calling g_object_notify so let's not make gobject to call it for
us.

This also allows to test that changing a property again doesn't lead to
dispatch properties being called.
2022-07-08 23:54:43 +02:00
Matthias Clasen
edcd2d4df4 Add a test for custom dispatch_properties_changed
This tests that we call a custom dispatch_properties_changed,
even in the absence of connected notify handlers. (A recent
optimization broke that and caused a regression in GTK).
2022-07-08 14:03:34 +01:00
Philip Withnall
ed564b71dd Merge branch '2672-dataset-tests-and-fixes' into 'main'
gdataset: Preserve destruction order

Closes #2672 and #2676

See merge request GNOME/glib!2776
2022-07-07 11:52:19 +00:00
Philip Withnall
41691cc4c8 Merge branch 'more-spdx' into 'main'
Add more SPDX license headers

See merge request GNOME/glib!2706
2022-07-05 11:06:49 +00:00
Peter Bloomfield
4ef2025d47 gobject/tests/binding: Add a test with run-dispose
Add tests in which `g_object_run_dispose()` is called on the source or target
of a `GBinding`. After commit a4fa456e67,
the target test caused a failed assertion in `g_weak_ref_set()` that was not
found by the existing tests.  Commit 94ba14d542
weakens the assertion to allow the test to succeed.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2676
2022-07-04 13:16:21 -04:00
Emmanuele Bassi
c0766caf20 Use varargs for enum types definition macros
Makes the syntax a little bit better.
2022-06-30 01:46:54 +01:00
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
2a9ef1e0b4 Test the newly added G_DEFINE macros for enumeration types 2022-06-30 01:46:54 +01: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
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
Marc-André Lureau
a5d551e2be gobject/tests/performance: fix leaks
Easily spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-06-23 17:18:21 +04:00
Simon McVittie
879b9cd669 gregex: Add G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-23 10:47:39 +01:00
Simon McVittie
0d4e401ede gmarkup: Add G_MARKUP_PARSE_FLAGS_NONE
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-23 10:47:27 +01:00
Simon McVittie
de8672fe0b gtestutils: Add G_TEST_SUBPROCESS_DEFAULT, G_TEST_TRAP_DEFAULT
This makes calls to test subprocesses with default behaviour more
self-documenting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-23 10:47:13 +01:00
Simon McVittie
7045260c22 gsignal: Add G_CONNECT_DEFAULT
This makes calls to g_signal_connect_data() and g_signal_connect_object()
with default flags more self-documenting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-06-23 10:46:45 +01:00
Marco Trevisan
cb0cc996ee Merge branch 'test-suite-fixes' into 'main'
tests: Various fixes for TAP output of tests

See merge request GNOME/glib!2749
2022-06-22 18:48:59 +00:00
Philip Withnall
1aaf1e7de1 tests: Allow signal-handler performance tests to be smoketested
As with the previous commit, allow them to be smoketested when run
without `-m perf`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:57:33 +01:00
Philip Withnall
6f435e40cd tests: Run GObject performance tests under meson test
Pass arguments to them so that they take minimal time. This will not
produce useful performance profiling results, but will smoketest that
the tests still run, don’t crash, and therefore probably aren’t
bitrotting too badly.

This is useful because a fair amount of work has gone into these
performance tests, and they’re useful every few years to analyse and
compare GObject performance. We don’t want them to bitrot between uses.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:57:33 +01:00
Philip Withnall
6747702d77 tests: Fix use of deprecated threading API in performance-threaded
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
6b8240f061 tests: Fix performance-threaded test when run for zero seconds
When running the test with `-s 0` it would previously crash. Fix that,
and make it so that it only does a single test run in that case.

This will be useful in an upcoming commit for smoketesting the test to
avoid bitrot.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
74e71c78c0 tests: Fix a non-TAP formatted debug message in the basics-gobject test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
1b377e6574 build: Drop MALLOC_PERTURB_ from test environments
It’s set already by Meson, to an actually random value.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Matthias Clasen
dccab10d9f Add another testcase
This is similar to the notify-in-init testcase
added recently, but with a custom constructor.
2022-06-12 12:01:16 -04:00
Matthias Clasen
fb380b9899 Add a testcase for notify-in-instance-init
This is reproducing a problem that was observed
in gtk3's gtk_check_button_init.
2022-06-12 12:01:08 -04:00
Matthias Clasen
12152788f9 tests: Add a singleton construct-property test
Beef up the singleton testcase to reproduce a
freeze count underflow when setting properties
at construction time, with a custom constructor.

Helps: #2666
2022-06-10 14:09:07 +01:00
Philip Withnall
9af0444b92 tests: Simplify singleton test code using G_DECLARE_FINAL_TYPE
This doesn’t functionally change the test, just drops some boilerplate.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-10 14:09:07 +01:00
Philip Withnall
7a4560e052 tests: Port GObject singleton test to GTest framework
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-10 14:09:07 +01:00
Philip Withnall
edd497fc99 Merge branch 'binding-code-duplication' into 'main'
gbinding: Remove some duplicated code for checking property names and improve tests slightly

See merge request GNOME/glib!2740
2022-06-10 11:24:09 +00:00
Philip Withnall
103a9d5ae1 Merge branch 'gobject-query' into 'main'
gobject-query: Minor cleanups and add unit tests

See merge request GNOME/glib!2739
2022-06-09 17:33:13 +00:00
Philip Withnall
67a168c5d1 tests: Test g_binding_get_source() and g_binding_get_target()
These are deprecated, but it’s easy enough to test them anyway. This
bumps up code coverage a bit and hopefully ensures we don’t accidentally
regress on them in future.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 18:20:29 +01:00
Philip Withnall
c49f481967 tests: Add basic tests for gobject-query utility
At the moment these tests basically just ensure that the program’s
compiled properly and doesn’t crash on startup. They don’t check
functionality very deeply.

But they’re a start.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:26:15 +01:00
Philip Withnall
d463de05b1 tests: Move GObject performance tests to gobject/tests/performance/
This doesn’t change the tests’ behaviour, but moves them to a slightly
more logical location.

They are still not installed or run by default.

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

Helps: #1434
2022-06-08 11:30:31 +01:00