Commit Graph

25406 Commits

Author SHA1 Message Date
Philip Withnall
421c238e81 tests: Allow utf8-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
e51c80591b tests: Allow mutex 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
419f882952 tests: Allow bitlock performance test to be smoketested
Allow it to be run with a reduced iteration count when not run as `-m
perf`, in order to check that the test still works.

Previously it would do nothing 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
011202dbc5 tests: Encode invalid UTF-8 before outputted in a test message
`g_test_message()` requires correctly encoded arguments, but some of the
strings in the `uri` test are (deliberately) not valid UTF-8. Encode
them before printing them.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
b82bfe7642 tests: Fix an invalid UTF-8 sequence in the uri tests
This sequence was meant to be valid, but was incorrectly just the octal
form of the desired Unicode codepoint, not the UTF-8 encoding of that
codepoint.

This was causing `g_test_message()` to print an `[Invalid UTF-8]`
warning.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
d48470df52 tests: Fix TAP output from spawn-singlethread test
The output from the echo program ends up being outputted with the stdout
from the unit test in some tests. Ensure that the input to the echo
program is therefore a valid TAP comment, rather than garbage, so that
it’s safely ignored by a TAP parser looking at the output from the test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
75a39114d8 tests: Fix non-TAP output from socket test
This was breaking strict TAP parsers, such as Meson’s.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
8dde15a5b3 tests: Fix gengiotypefuncs.py helper script
It seems this script has potentially never worked properly under Python
3. It’s supposed to list all the `_get_type()` functions it can find in
the GIO headers, but since the regex string passed to `re.search()` was
not a Python regex, nothing was matching.

Fix that, and do another few small cleanups to the script.

This makes the `defaultvalue` test not skip all the types.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
f977ddf34f tests: Fix non-TAP output from debugcontroller test
When running under a strict TAP parser this was previously producing
problematic non-conforming output.

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
Philip Withnall
6b65b721e7 Merge branch 'timeloop-closure_test' into 'main'
Delete tests/gobject/timeloop-closure.c

See merge request GNOME/glib!2697
2022-06-10 14:13:05 +00:00
Philip Withnall
6e42e2efe1 Merge branch 'fix-freeze-count-underflow' into 'main'
gobject: Don't thaw excessively

Closes #2666

See merge request GNOME/glib!2736
2022-06-10 13:43:49 +00:00
Matthias Clasen
98bd4eabf2 gobject: Don't thaw excessively
We need to match the conditions in g_object_init
for when we already have a freeze. Without that,
we underflow the freeze count and trigger a
warning.

Fixes: #2666
2022-06-10 14:09:08 +01: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
Matthias Clasen
c0f277434b Merge branch 'wip/otte/liststore-properties' into 'main'
liststore: add n-items property

See merge request GNOME/glib!2738
2022-06-09 17:44:43 +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
714a0aa47d gbinding: Remove some duplicated code for checking property names
GObject already exports a public symbol for this with identical code.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 18:20:06 +01:00
Benjamin Otte
7a4ec897bc listmodel: Recommend implementing properties
"item-type" and "n-items" should ideally be implemented by listmodels,
so document that.
2022-06-09 17:08:42 +02:00
Benjamin Otte
51840393b2 liststore: Add tests for n-items property 2022-06-09 17:08:42 +02:00
Benjamin Otte
6b62d63d36 liststore: Add "n-items" property 2022-06-09 17:08:42 +02: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
fbdbbfa580 gobject-query: Add a --version argument
This has been documented in `man gobject-query` for a long time, but
seemingly never implemented.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:25:35 +01:00
Philip Withnall
6211e25953 gobject-query: Combine two identical if-branches
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:23:11 +01:00
Philip Withnall
ad77557277 gobject-query: Print --help output to stdout rather than stderr
UNIX tools print `--help` output to stdout by convention.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:22:51 +01:00
Philip Withnall
993f3f4407 gobject-query: Make a --help string slightly more helpful
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:06:25 +01:00
Philip Withnall
98e6ac788e gobject-query: Remove extraneous blank line between each output line
I don’t think it improves the output format.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:06:03 +01:00
Philip Withnall
91ff469f7e gobject-query: Use proper Unicode tree drawing characters
This makes the output a lot nicer to read:
```
│
├void
│
├GInterface
│ │
│ └GTypePlugin
│
├gchar
⋮
```
rather than
```
|
`void
|
`GInterface
  |
  `GTypePlugin
|
`gchar
⋮
```

It includes a change to correctly use vertical tees at the top level by
correctly setting the sibling node rather than always setting it to
zero.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:04:49 +01:00
Philip Withnall
17a1c29850 gobject-query: Delete unused code
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 12:51:06 +01:00
Benjamin Otte
9b55841d78 liststore: Use g_object_class_install_properties()
Not very useful yet, but future commits add more properties.
2022-06-08 15:45:27 +02:00
Emmanuel Fleury
fcbdfb5be8 Remove tests/gobject empty directory
Helps issue #1434
2022-06-08 15:25:04 +02:00
Emmanuel Fleury
afc8a8fcfe Remove tests/gobject/timeloop-closure.c performance test
This test has been here for long but is no more useful and can be
removed safely.
2022-06-08 15:22:11 +02:00
Philip Withnall
b23f9372a1 Merge branch 'gobject-perf-tests' into 'main'
tests: Move GObject performance tests to gobject/tests/performance/

See merge request GNOME/glib!2735
2022-06-08 13:11:52 +00: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
Philip Withnall
5d498f4d1c Merge branch 'move_testgobject' into 'main'
Move tests/gobject/testgobject.c to gobject/tests/basics-gobject.c

See merge request GNOME/glib!2696
2022-06-08 09:52:55 +00:00
Philip Withnall
f5c8148ec9 Merge branch 'gobject-speedups4' into 'main'
Speed up property lookup

See merge request GNOME/glib!2678
2022-06-08 09:34:19 +00:00
Matthias Clasen
426724d51c Add some tests around properties
Install the properties with a mixture of
g_object_class_install_properties and
g_object_class_install_properties, and verify
that finding them still works, regardless of
whether we use string literals or not.
2022-06-07 22:49:30 -04:00
Emmanuele Bassi
77c72f2a6d Merge branch 'wip/pwithnall/restore-macos-ci' into 'main'
Restore macOS CI

See merge request GNOME/glib!2694
2022-06-07 19:12:17 +00:00
Philip Withnall
3b87740e3e tests: Fix defined-but-not-used variables if HAVE_OPENPTY is undefined
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-07 19:12:46 +01:00
Philip Withnall
8640f95106 tests: Fix strict-aliasing and pointer-sign warnings in atomic tests
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-07 19:08:42 +01:00
Philip Withnall
98df887b7f tests: Silence set-but-not-used warnings for variables in autoptr test
Clang decides that `p` and `p2` are set but not used. Try a bit harder
to trick it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-07 18:27:20 +01:00
Philip Withnall
0e1b410779 tests: Remove unused variables from slice tests
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-07 18:27:20 +01:00
Philip Withnall
6a1e35422f tests: Remove unused function from slice-memchunk.c
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-07 18:27:19 +01:00