Commit Graph

1008 Commits

Author SHA1 Message Date
Emmanuel Fleury
cc41af57c3 Convert tests/threadpool-test.c to glib test framework 2022-05-05 10:47:05 +02:00
Emmanuel Fleury
49ecdd1dba Move tests/onceinit.c to glib/tests/onceinit.c
Related to issue #1434
2022-04-11 15:26:40 +02:00
Emmanuel Fleury
91dddb0641 Convert onceinit.c to glib test framework 2022-04-11 15:26:33 +02:00
Philip Withnall
690e64afef Merge branch 'unicode-normalize-test' into 'main'
Move test tests/unicode-normalize.c to glib/tests/

See merge request GNOME/glib!2586
2022-04-08 10:54:57 +00:00
Emmanuel Fleury
b25eb3808d Move unicode-normalize test from tests/ to glib/tests/
Helps issue #1434
2022-04-08 11:27:13 +02:00
Emmanuel Fleury
2c37b92dfa Enable and convert tests/unicode-normalize.c to glib test framework 2022-04-08 11:24:43 +02:00
Emmanuel Fleury
762ed2e82b Move tests/spawn-test.c -> glib/tests/spawn-test.c
Related to issue #1434
2022-04-07 18:36:45 +02:00
Emmanuel Fleury
5a7a69bd99 Convert tests/spawn-test.c to glib test framework 2022-04-07 18:36:14 +02:00
Emmanuel Fleury
795952cb8d Move tests/unicode-encoding.c to glib/tests/unicode-encoding.c
Related to issue #1434
2022-04-04 18:51:30 +02:00
Emmanuel Fleury
43759ca951 Convert tests/unicode-encoding.c to glib test framework 2022-04-04 18:51:24 +02:00
Emmanuel Fleury
5931ed8c2b Move test files on slices from tests/ to glib/tests/
slice-color.c and slice-concurrent.c are moved from tests/ to glib/tests/

Related to issue #1434
2022-03-22 11:42:33 +00:00
Emmanuel Fleury
1f2f3d7f37 Convert tests/slice-concurrent.c to glib test framework 2022-03-22 11:42:33 +00:00
Emmanuel Fleury
6211971c41 Convert tests/slice-color.c to glib test framework 2022-03-22 11:42:33 +00:00
Emmanuel Fleury
495508cf84 Enabling disabled slice-color test case 2022-03-22 11:42:33 +00:00
Emmanuel Fleury
2d6dc9ff2e Move tests/relation-test.c to glib/tests/relation.c
Related to issue #1434
2022-03-17 18:36:58 +01:00
Emmanuel Fleury
372b63bf1a Convert test/relation-test.c to glib test framework 2022-03-17 18:32:31 +01:00
Philip Withnall
d497bdebc0 Merge branch 'remove_type-test' into 'main'
Move tests/type-test.c to glib/tests/types.c

See merge request GNOME/glib!2527
2022-03-04 18:39:40 +00:00
Emmanuel Fleury
208dfe9ddc Move tests/type-test.c to glib/tests/types.c
Helps issue #1434
2022-03-04 16:24:20 +00:00
Emmanuel Fleury
9933e2b54c Convert tests/type-test.c to g_test framework 2022-03-04 16:24:20 +00:00
Emmanuel Fleury
78f6507196 Remove unused test tests/testgdateparser.c
Helps issue #1434
2022-02-23 18:34:44 +01:00
Emmanuel Fleury
16f0438bc6 Remove old test file tests/testglib.c 2022-02-22 18:48:01 +00:00
Philip Withnall
5ac86e21b3 Merge branch 'cleanup-warnings-split-2' into 'main'
Cleanup warnings split 2

See merge request GNOME/glib!2491
2022-02-18 13:39:25 +00:00
Loic Le Page
5f5a4a74b4 Fix non-initialized variable and pointer casted to int in tests/gio-test.c 2022-02-18 10:48:39 +01:00
Loic Le Page
2d5c6fc520 Fix global variable name hidden by local variables in tests/mapping-test.c 2022-02-18 10:25:33 +01:00
Philip Withnall
5b7383c544 tests: Merge iochannel-test into io-channel tests in glib directory
We’re trying to eliminate the legacy `tests/` directory. This commit
moves the code from `tests/iochannel-test.c` into
`glib/tests/io-channel.c` and ports it to the latest GLib test coding
standards:
 * Change `g_assert()` to `g_assert_*()`
 * Print verbose messages with `g_test_message()`
 * Rename some variables to conform to modern conventions
 * Use `GTest`

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

Helps: #1434
2022-02-17 21:42:35 +00:00
Emmanuel Fleury
e5cb2e9bbf Remove tests/testgdate.c from tests
Related to issue #1434
2022-02-03 15:18:05 +01:00
Emmanuel Fleury
849d3812c9 Move tests/file-test.c to glib/tests/fileutils.c 2022-01-26 15:18:40 +01:00
Loic Le Page
42c77c7ac7 Enable full-static build on Windows
Glib cannot be built statically on Windows because glib, gobject and gio
modules need to perform specific initialization when DLL are loaded and
cleanup when unloaded. Those initializations and cleanups are performed
using the DllMain function which is not called with static builds.

Issue is known for a while and solutions were already proposed but never
merged (see: https://gitlab.gnome.org/GNOME/glib/-/issues/692). Last
patch is from version 2.36.x and since then the
"constructor/destructor" mechanism has been implemented and used in
other part of the system.

This patch takes back the old idea and updates it to the last version of
glib to allow static compilation on Windows.

WARNING: because DllMain doesn't exist anymore in static compilation
mode, there is no easy way of knowing when a Windows thread finishes.
This patch implements a workaround for glib threads created by calling
g_thread_new(), so all glib threads created through glib API will behave
exactly the same way in static and dynamic compilation modes.
Unfortunately, Windows threads created by using CreateThread() or
_beginthread/ex() will not work with glib TLS functions. If users need
absolutely to use a thread NOT created with glib API under Windows and
in static compilation mode, they should not use glib functions within
their thread or they may encounter memory leaks when the thread finishes.

This should not be an issue as users should use exclusively the glib API
to manipulate threads in order to be cross-platform compatible and this
would be very unlikely and cumbersome that they may mix up Windows native
threads API with glib one.

Closes #692
2022-01-26 10:14:02 +01:00
Philip Withnall
ce45b88b90 Merge branch 'unicode_caseconv_tests' into 'main'
Merge test/unicode-caseconv.c into glib/tests/unicode.c

See merge request GNOME/glib!2432
2022-01-19 15:54:19 +00:00
Emmanuel Fleury
b9f07a458a Merge test/unicode-caseconc.c into glib/tests/unicode.c
Related to issue #1434
2022-01-19 16:21:01 +01:00
Philip Withnall
6d2dc3f8c2 Merge branch 'remove_paramspec_test' into 'main'
Merge tests/gobject/paramspec-test.c into gobject/tests/param.c

See merge request GNOME/glib!2431
2022-01-17 22:25:28 +00:00
Philip Withnall
eefba53845 Merge branch 'tests_unicode-collate' into 'main'
Remove a disabled test case that was covered by glib/tests/collate.c

See merge request GNOME/glib!2434
2022-01-17 21:03:09 +00:00
Emmanuel Fleury
66ebcbced4 Merge tests/gobject/paramspec-test.c into gobject/tests/param.c
Helps issue #1434
2022-01-17 20:43:27 +00:00
Emmanuel Fleury
cddce179f5 Remove a disabled test case that was covered by glib/tests/collate.c
Related to issue #1434
2022-01-15 13:44:15 +01:00
Emmanuel Fleury
86fedcfb93 Merge tests/gobject/gvalue-test.c with gobject/tests/value.c
Helps issue #1434
2022-01-12 21:51:05 +01:00
Sophie Herold
68eab1d999 utils: Add XDG_STATE_HOME support 2021-12-24 20:11:39 +00:00
Philip Withnall
ca6cf3c64a Merge branch 'fix_warnings' into 'main'
Fix several cosmetic warnings

Closes #2559

See merge request GNOME/glib!2401
2021-12-23 12:51:19 +00:00
Emmanuel Fleury
3887de12a9 Fix old_mem_chunk_new() does not match original declaration warning in tests/slice-test.c
tests/slice-test.c:30:17: warning: type of ‘old_mem_chunk_new’ does not match original declaration
2021-12-17 16:35:45 +01:00
Emmanuel Fleury
20c8ea1bc6 Move tests/env-test.c into glib/tests/environment.c 2021-12-16 16:32:26 +01:00
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