Commit Graph

969 Commits

Author SHA1 Message Date
Emmanuel Fleury
9f760a7cc1 Moving tests/dirname-test.c to glib/tests/fileutils.c
Helps issue #1434
2021-12-16 10:41:13 +00:00
Emmanuel Fleury
241b9f41b4 Merging tests/child-test.c into glib/tests/spawn-multithreaded.c
Helps issue #1434
2021-12-15 23:12:59 +01:00
Philip Withnall
2c07c17840 Merge branch 'datetime_tests' into 'main'
Removing unnecessary test on gdatetime.c

See merge request GNOME/glib!2393
2021-12-14 15:25:40 +00:00
Philip Withnall
f493d3fd24 Merge branch 'cxx-test' into 'main'
Removing redundant cxx test tests/cxx-test.cpp

See merge request GNOME/glib!2391
2021-12-14 15:23:16 +00:00
Emmanuel Fleury
ae345e56c2 Distribute cxx test tests/cxx-test.cpp to each module tests directory
tests/cxx-test.cpp is removed and splitted into gio/tests/cxx.cpp,
gmodule/tests/cxx.cpp and gobject/tests/cxx.cpp.

Helps issue #1434
2021-12-14 14:43:03 +01:00
Emmanuel Fleury
6a17b114b6 Removing unnecessary test on gdatetime.c
Helps issue #1434
2021-12-14 13:46:06 +01:00
Emmanuel Fleury
cde56cfc70 Move tests/completion-test.c to glib/tests/completion.c
Helps issue #1434
2021-12-13 17:42:23 +01:00
Philip Withnall
fc25f8d7ef gfileutils: Correctly reset start value when canonicalising paths
If a path starts with more than two slashes, the `start` value was
previously incorrect:
 1. As per the `g_path_skip_root()` call, `start` was set to point to
    after the final initial slash. For a path with three initial
    slashes, this is the character after the third slash.
 2. The canonicalisation loop to find the first dir separator sets
    `output` to point to the character after the first slash (and it
    overwrites the first slash to be `G_DIR_SEPARATOR`).
 3. At this point, with a string `///usr`, `output` points to the second
    `/`; and `start` points to the `u`. This is incorrect, as `start`
    should point to the starting character for output, as per the
    original call to `g_path_skip_root()`.
 4. For paths which subsequently include a `..`, this results in the
    `output > start` check in the `..` loop below not skipping all the
    characters of a preceding path component, which is then caught by
    the `G_IS_DIR_SEPARATOR (output[-1])` assertion.

Fix this by resetting `start` to `output` after finding the final slash
to keep in the output, but before starting the main parsing loop.

Relatedly, split `start` into two variables: `after_root` and
`output_start`, since the variable actually has two roles in the two
parts of the function.

Includes a test.

This commit is heavily based on suggestions by Sebastian Wilhemi and
Sebastian Dröge.

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

oss-fuzz#41563
2021-12-02 17:50:17 +00:00
Philip Withnall
17ffe7b303 Merge branch 'move_bit-test' into 'main'
Merging tests/bit-test.c into glib/tests/utils.c

See merge request GNOME/glib!2379
2021-12-02 09:45:37 +00:00
Emmanuel Fleury
dd47df80e1 Merging tests/bit-test.c into glib/tests/utils.c 2021-12-01 14:10:44 +01:00
Philip Withnall
b5b3327636 Merge branch 'move_test_sources' into 'main'
GSource: move test to glib/tests/

See merge request GNOME/glib!2376
2021-12-01 11:39:46 +00:00
Nishal Kulkarni
70a8811ccc GSource: move test to glib/tests/
Previously tests existed in two places,
`$top_srcdir/tests/sources.c` contained additional tests,
they have now been moved to `$top_srcdir/glib/tests/mainloop.c`
and `$top_srcdir/tests/sources.c` was deleted.

Related to: #1434
2021-12-01 14:04:46 +05:30
Philip Withnall
9bd3ae856e Merge branch '2541-canonicalize-performance' into 'main'
gfileutils: Improve performance of g_canonicalize_filename()

Closes #2541

See merge request GNOME/glib!2374
2021-11-30 09:59:13 +00:00
Emmanuel Fleury
074d0a79d9 Removing tests/asyncqueue-test.c from tests/
Tests on async queues are already performed in a more extensive way in
glib/tests/asyncqueue.c. This test file can be safely removed without
any loss.
2021-11-29 16:46:13 +01:00
Nishal Kulkarni
279a610018 gqsort: Move test to glib/tests/
Previously tests existed in two places,
`$top_srcdir/tests/qsort-test.c` contained a similar test
to the one in `$top_srcdir/glib/tests/sort.c` called `test_sort_basic()`

The test for checking with zero elements was additional added to
`$top_srcdir/glib/tests/sort.c` and `$top_srcdir/tests/qsort-test.c`
was deleted.

Related to: #1434
2021-11-27 02:16:22 +05:30
Sebastian Wilhelmi
9a30a495ec gfileutils: Improve performance of g_canonicalize_filename()
Improve the performance of canonicalising filenames with many `..` or
`.` components, by modifying the path inline rather than calling
`memmove()`.

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

Fixes: #2541
2021-11-26 14:07:10 +00:00
Nishal Kulkarni
1c7936b368 slice-test: Use new g_newa0() function
Replace old `g_alloca()` and `memset()` with `g_newa0()`
2021-11-26 12:24:23 +00:00
Philip Withnall
8e963e0e31 Port internal uses to use g_source_set_static_name()
This should reduce allocations.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-26 11:01:07 +01:00
Philip Withnall
be012a8067 giomodule: Port to new g_module_open_full() API
Port all existing calls in GLib to the new API so that they can receive
more detailed error information (although none of them actually make use
of it at the moment).

This also serves to test the new API better through use.

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

Helps: #203
2021-07-21 21:54:35 +01:00
Michael Catanzaro
0818da5308 testgdate: fix -Wmisleading-indentation warning
No behavior changes. Just reindent the existing code to avoid a GCC
warning spam.

I considered changing the code to not run fflush() on every iteration of
the loop, but I doubt it matters much, so I left it be.
2021-06-16 12:22:28 -05:00
Jasper St. Pierre
edb40c7171 gobject: Allow passing %NULL for @data in g_object_remove_toggle_ref
gjs has some situations where it's not always aware of the @data that
was passed into g_object_add_toggle_ref, so allow passing %NULL to
just match on @notify.

Rebased and updated by Nitin Wartkar

Closes #817
2021-05-27 21:09:45 +05:30
Emmanuel Fleury
a369efd207 Fix missing initializer warning in tests/slice-threadinit.c
tests/slice-threadinit.c:34:30: warning: missing field 'sample' initializer
} pages[N_PAGES] = { { NULL, }, };
                             ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
e952248dc2 Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings 2021-05-13 20:16:46 +00:00
Emmanuel Fleury
00a15152f3 Fix signedness warning in tests/memchunks.c
tests/memchunks.c: In function ‘old_mem_chunk_new’:
tests/memchunks.c:140:35: error: comparison of integer expressions of different signedness: ‘gulong’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  140 |   g_return_val_if_fail (area_size >= atom_size, NULL);
      |                                   ^~
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
53157f32b9 Fix several signedness warnings in tests/unicode-encoding.c
tests/unicode-encoding.c: In function ‘process’:
tests/unicode-encoding.c:140:38: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  140 |       if (!ucs4_result || items_read == strlen (utf8))
      |                                      ^~
tests/unicode-encoding.c:161:15: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  161 |    items_read != strlen (utf8) ||
      |               ^~
tests/unicode-encoding.c:198:18: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  198 |    items_written != strlen (utf8))
      |                  ^~
tests/unicode-encoding.c:260:22: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  260 |       if (items_read != strlen (utf8) ||
      |                      ^~
tests/unicode-encoding.c:294:18: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  294 |    items_written != strlen (utf8))
      |                  ^~
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
951105fae5 Fix several signedness warnings in tests/threadpool-test.c
tests/threadpool-test.c: In function ‘test_thread_sort’:
tests/threadpool-test.c:283:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  283 |   for (i = 0; i < limit; i++) {
      |                 ^
tests/threadpool-test.c:296:50: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  296 |   g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
      |                                                  ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/threadpool-test.c:296:3: note: in expansion of macro ‘g_assert’
  296 |   g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
      |   ^~~~~~~~
tests/threadpool-test.c:297:50: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  297 |   g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
      |                                                  ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/threadpool-test.c:297:3: note: in expansion of macro ‘g_assert’
  297 |   g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
      |   ^~~~~~~~
tests/threadpool-test.c: In function ‘test_thread_idle_time’:
tests/threadpool-test.c:355:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  355 |   for (i = 0; i < limit; i++) {
      |                 ^
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
3951ccffae Fix signedness warning in tests/thread-test.c
tests/thread-test.c: In function ‘test_g_static_private’:
tests/thread-test.c:214:60: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  214 |     g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i * 3);
      |                                                            ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/thread-test.c:214:5: note: in expansion of macro ‘g_assert’
  214 |     g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i * 3);
      |     ^~~~~~~~
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
5299ee541a Fix signedness warning in tests/unicode-collate.c
tests/unicode-collate.c: In function ‘main’:
tests/unicode-collate.c:77:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
   77 |  if (argc > i)
      |           ^
2021-05-06 14:35:46 +02:00
Emmanuel Fleury
1d02b96655 Fix signedness warnings in tests/gio-test.c
tests/gio-test.c: In function ‘recv_message’:
tests/gio-test.c:172:24: error: comparison of unsigned expression in ‘>= 0’ is always true
  172 |       g_assert (nbytes >= 0 && nbytes < BUFSIZE);
      |                        ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/gio-test.c:172:7: note: in expansion of macro ‘g_assert’
  172 |       g_assert (nbytes >= 0 && nbytes < BUFSIZE);
      |       ^~~~~~~~
tests/gio-test.c:188:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  188 |    for (j = 0; j < nbytes; j++)
      |                  ^
tests/gio-test.c:189:30: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’}
  189 |             g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
      |                              ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/gio-test.c:189:13: note: in expansion of macro ‘g_assert’
  189 |             g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
      |             ^~~~~~~~
2021-05-06 14:35:20 +02:00
Emmanuel Fleury
4d3c741ddb Fix several signedness warnings in tests/testglib.c
tests/testglib.c: In function ‘gnode_test’:
tests/testglib.c:302:34: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’}
  302 |       g_assert (P2C (node->data) == ('C' + i));
      |                                  ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/testglib.c:302:7: note: in expansion of macro ‘g_assert’
  302 |       g_assert (P2C (node->data) == ('C' + i));
      |       ^~~~~~~~
tests/testglib.c:306:76: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  306 |     g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
      |                                                                            ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/testglib.c:306:5: note: in expansion of macro ‘g_assert’
  306 |     g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
      |     ^~~~~~~~
tests/testglib.c: In function ‘test_arrays’:
tests/testglib.c:1316:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1316 |     if (g_array_index (garray, gint, i) != i)
      |                                         ^~
tests/testglib.c:1324:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1324 |     if (g_array_index (garray, gint, i) != (100 - i - 1))
      |                                         ^~
2021-05-06 14:21:40 +02:00
Emmanuel Fleury
65d93a16ab Fix several signedness warnings in tests/testglib.c
tests/testglib.c: In function ‘glist_test’:
tests/testglib.c:90:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
   90 |       if (*((gint*) t->data) != (9 - i))
      |                              ^~
tests/testglib.c:95:54: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
   95 |     if (g_list_position (list, g_list_nth (list, i)) != i)
      |                                                      ^~
tests/testglib.c:112:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  112 |       if (*((gint*) t->data) != i)
      |                              ^~
tests/testglib.c:130:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  130 |       if (*((gint*) t->data) != (9 - i))
      |                              ^~
tests/testglib.c:150:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  150 |       if (*((gint*) t->data) != (9 - i))
      |                              ^~
tests/testglib.c: In function ‘gslist_test’:
tests/testglib.c:170:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  170 |       if (*((gint*) st->data) != (9 - i))
      |                               ^~
tests/testglib.c:188:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  188 |       if (*((gint*) st->data) != i)
      |                               ^~
tests/testglib.c:206:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  206 |       if (*((gint*) st->data) != (9 - i))
      |                               ^~
tests/testglib.c:226:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  226 |       if (*((gint*) st->data) != (9 - i))
      |                               ^~
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
249f46ac76 Fix signedness warning in tests/timeloop.c
tests/timeloop.c: In function ‘read_all’:
tests/timeloop.c:41:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   41 |   while (bytes_read < len)
      |                     ^
tests/timeloop.c: In function ‘write_all’:
tests/timeloop.c:65:24: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   65 |   while (bytes_written < len)
      |                        ^
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
026611b5a9 Fix several signedness warnings in tests/slice-threadinit.c
tests/slice-threadinit.c: In function ‘main’:
tests/slice-threadinit.c:77:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
   77 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:108:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  108 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:113:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  113 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:131:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  131 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:139:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  139 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:161:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  161 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
7b78f0b8ce Fix signedness warnings in tests/gobject/performance-threaded.c
I did it wrong last time... my bad...

tests/gobject/performance-threaded.c: In function ‘main’:
tests/gobject/performance-threaded.c:361:21: warning: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
  361 |       for (k = 1; k < argc; k++)
      |                     ^
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
c339e29d46 Fix signedness warning in tests/mainloop-test.c
tests/mainloop-test.c: In function ‘cleanup_crawlers’:
tests/mainloop-test.c:358:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  358 |   for (i=0; i < crawler_array->len; i++)
      |               ^
2021-05-04 08:46:10 +02:00
Emmanuel Fleury
dcd3af7023 Fix signedness warning in tests/dirname-test.c
tests/dirname-test.c: In function ‘main’:
tests/dirname-test.c:105:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  105 |   for (i = 0; i < n_dirname_checks; i++)
      |                 ^
2021-05-04 08:45:56 +02:00
Emmanuel Fleury
0ddadf14cc Fix several signedness warnings in tests/gobject/performance-threaded.c
tests/gobject/performance-threaded.c: In function ‘run_test’:
tests/gobject/performance-threaded.c:302:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
  302 |     for (i = 0; i < n_threads; i++) {
      |                   ^
tests/gobject/performance-threaded.c:308:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
  308 |     for (i = 0; i < n_threads; i++) {
      |                   ^
tests/gobject/performance-threaded.c: In function ‘find_test’:
tests/gobject/performance-threaded.c:324:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  324 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
tests/gobject/performance-threaded.c: In function ‘main’:
tests/gobject/performance-threaded.c:351:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  351 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                     ^
tests/gobject/performance-threaded.c:369:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  369 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                     ^
2021-05-04 08:44:44 +02:00
Emmanuel Fleury
7ddcc082e2 Fix signedness warnings in tests/gobject/timeloop-closure.c
tests/gobject/timeloop-closure.c: In function ‘read_all’:
tests/gobject/timeloop-closure.c:42:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   42 |   while (bytes_read < len)
      |                     ^
tests/gobject/timeloop-closure.c: In function ‘write_all’:
tests/gobject/timeloop-closure.c:66:24: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   66 |   while (bytes_written < len)
      |                        ^
2021-05-04 08:43:29 +02:00
Emmanuel Fleury
7c69a1d5f6 Fix signedness warnings in tests/refcount/objects.c
tests/refcount/objects.c: In function ‘main’:
tests/refcount/objects.c:133:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘const unsigned int’}
  133 |   for (i = 0; i < n_threads; i++) {
      |                 ^
tests/refcount/objects.c:149:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘unsigned int’
  149 |   for (i = 0; i < 2 * n_threads; i++) {
      |                 ^
2021-05-04 08:43:29 +02:00
Emmanuel Fleury
3b424d746c Fix signedness warnings in tests/gobject/performance.c
tests/gobject/performance.c: In function ‘find_test’:
tests/gobject/performance.c:1019:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
 1019 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
tests/gobject/performance.c: In function ‘main’:
tests/gobject/performance.c:1054:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
 1054 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                     ^
2021-05-04 08:43:22 +02:00
Emmanuel Fleury
b419761189 Fix signedness warning in tests/onceinit.c
tests/onceinit.c: In function ‘stress_concurrent_initializers’:
tests/onceinit.c:267:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  267 |   for (i = 0; i < G_N_ELEMENTS (initializers); i++)
      |                 ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
b04ebbf67b Fix missing initializer warning in tests/gobject/defaultiface.c
tests/gobject/defaultiface.c: In function ‘test_dynamic_iface_register’:
tests/gobject/defaultiface.c:126:5: error: missing initializer for field ‘class_data’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  126 |     };
      |     ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
277d206d38 Fix multiple missing initializer warnings in tests/gobject/testcommon.h
tests/gobject/testmodule.c: In function ‘test_module_get_type’:
tests/gobject/testmodule.c:34:1: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   34 | DEFINE_TYPE (TestModule, test_module,
      | ^~~~~~~~~~~

tests/gobject/defaultiface.c: In function ‘test_static_iface_get_type’:
tests/gobject/defaultiface.c:58:1: error: missing initializer for field ‘class_finalize’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   58 | DEFINE_IFACE (TestStaticIface, test_static_iface,
      | ^~~~~~~~~~~~
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
76af9efbff Fix several missing initializer in tests/gobject/testgobject.c
tests/gobject/testgobject.c: In function ‘test_iface_get_type’:
tests/gobject/testgobject.c:53:7: error: missing initializer for field ‘class_init’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   53 |       };
      |       ^
tests/gobject/testgobject.c: In function ‘test_object_get_type’:
tests/gobject/testgobject.c:182:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  182 |       };
      |       ^
tests/gobject/testgobject.c: In function ‘derived_object_get_type’:
tests/gobject/testgobject.c:349:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  349 |       };
      |       ^
2021-04-29 12:40:05 +02:00
Simon McVittie
d499c53158 threadpool test: Don't leak the thread pool
Detected by AddressSanitizer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-29 20:26:05 +00:00
Sebastian Dröge
fa8a39c6c6 Merge branch 'py-fixes' into 'master'
Python formatting improvements

See merge request GNOME/glib!1757
2020-11-20 18:10:40 +00:00
Philip Withnall
1a7f0002a0 tests: Fix non-atomic access to some shared variables
And drop the `volatile` qualifier from the variables, as that doesn’t
help with thread safety.

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

Helps: #600
2020-11-20 14:40:19 +00:00
Philip Withnall
7cdb68713c tests: Drop unnecessary volatile qualifiers from tests
These variables were already (correctly) accessed atomically. The
`volatile` qualifier doesn’t help with that.

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

Helps: #600
2020-11-20 14:40:19 +00:00
Philip Withnall
d270b6c3db py: Various flake8 cleanups
None of these are particularly significant, but they do get the CI
output clean.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00
Philip Withnall
905b22a17e py: Reformat all Python files consistently
This commit is the unmodified results of running
```
black $(git ls-files '*.py')
```
with black version 19.10b0. See #2046.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00