Loic Le Page
d15e6f7c9c
Fix global variable name hidden by local variables in glib/tests/dataset.c
2022-02-21 12:42:23 +01:00
Loic Le Page
becce7742c
Fix global variable name hidden by local variables in glib/tests/hash.c
2022-02-21 12:42:23 +01:00
Loic Le Page
479fcb40c0
Fix redefinition of local variable in glib/tests/logging.c
2022-02-21 12:42:23 +01:00
Loic Le Page
c53f24ba53
Fix global variable name hidden by local variables in glib/tests/mainloop.c
2022-02-21 12:42:22 +01:00
Loic Le Page
64760f1028
Refactor glib/tests/node.c
...
Replace C2P and P2C macros with standard GINT_TO_POINTER and
GPOINTER_TO_INT macros.
2022-02-21 12:42:22 +01:00
Loic Le Page
2885cbd737
Fix global variable name hidden by local variables in glib/tests/option-context.c
2022-02-21 12:42:22 +01:00
Loic Le Page
fb939a0029
Fix redefinition of local variable in glib/tests/sequence.c
2022-02-21 12:42:22 +01:00
Loic Le Page
5804fa1680
Fix global variable name hidden by local variables in glib/tests/spawn-multithreaded.c
2022-02-21 12:42:22 +01:00
Loic Le Page
22b7182d2a
Fix redefinition of local variable in glib/tests/strfuncs.c
2022-02-21 12:42:15 +01:00
Loïc Le Page
cbc3d65f6d
Fix global variable name hidden by local variables in glib/tests/utf8-validate.c
2022-02-21 12:38:11 +01:00
Philip Withnall
ae903744ee
Merge branch 'environment-test-fixes' into 'main'
...
tests: Fix various small memory leaks
See merge request GNOME/glib!2509
2022-02-20 12:09:00 +00:00
Philip Withnall
2bc1036f80
tests: Fix a memory leak in the mainloop test
...
The source needs to be removed from the `GMainContext` before being
unreffed, otherwise the main context and main loop will be kept around.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
ba556e6d34
tests: Fix a memory leak in the keyfile test
...
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
a389227fb9
tests: Fix a memory leak in the fileutils test
...
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
12a4fcdbed
tests: Fix a leak in environment.c with undefined behaviour tests on
...
`g_environ_setenv()` and `g_environ_unsetenv()` were correctly returning
`NULL` when their preconditions failed (as the test is supposed to be
exercising). That overwrote the value of `env` without freeing it,
resulting in a leak.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
cb18e6b969
Merge branch 'empty-argv' into 'main'
...
Various minor fixes for empty argv handling
See merge request GNOME/glib!2466
2022-02-20 09:36:41 +00:00
Philip Withnall
2249da981a
tests: Use g_assert_*() rather than g_assert() in environment.c
...
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 10:18:40 +00: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
Marc-André Lureau
4549a97a75
glib/tests: ucrt locale date output is a bit different
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-15 23:21:49 +00:00
Marc-André Lureau
f7c66423a4
glib/tests: set Polish ThreadLocale on win32 to fix a test
...
Fixes /date/month_substring
Bail out! GLib:ERROR:../glib/tests/date.c:1090:test_month_substring: 'g_date_valid (&date)' should be TRUE
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-15 23:21:49 +00:00
Marc-André Lureau
051d000acd
glib/tests: fix checking two-digit years on Windows
...
Fixes:
ok 10 /date/parse_locale_change
(when locale th_TH available)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-15 23:21:49 +00:00
Marc-André Lureau
acb46f8b36
glib/tests: add comment about %Z strftime on w32
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-16 03:00:06 +04:00
Philip Withnall
00ba3ceacc
Merge branch 'wip/smcv/aligned-alloc-tests' into 'main'
...
Fix some problems with g_aligned_alloc() tests
See merge request GNOME/glib!2488
2022-02-15 11:52:46 +00:00
Philip Withnall
27798cda22
Merge branch 'fix_gdate_tests' into 'main'
...
Fix unit test on date format '%Z' which is too versatile to be trustable
See merge request GNOME/glib!2482
2022-02-15 11:46:59 +00:00
Simon McVittie
b0f686a00e
tests: Don't test invalid aligned allocations if avoiding UB
...
We can't exercise precondition check failures if GLib was (inadvisably)
compiled with -Dglib_checks=false, and we shouldn't necessarily exercise
precondition check failures when using QA tools like valgrind, so skip
these tests if run with -m no-undefined.
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-15 11:03:00 +00:00
Simon McVittie
38cdfe3c02
tests: Make g_aligned_alloc tests fail if preconditions aren't checked
...
Previously, these tests would always pass. If the precondition check
failed (as we want it to), the subprocess would exit unsuccessfully;
but if the precondition check wrongly passed, the subprocess would
continue, allocate a nonzero amount of memory, and fail the
g_assert_null(), resulting in the subprocess exiting unsuccessfully
and the test still passing.
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-15 10:52:59 +00:00
Simon McVittie
d04f3491af
tests: Don't assume that all platforms are 64-bit
...
On ILP32 platforms, 4 is a valid alignment for g_aligned_alloc(), so
use 2 as our invalid alignment instead.
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-15 10:49:51 +00:00
Emmanuel Fleury
81764b6508
Fix unit test on date format '%Z' which is too versatile to be trustable
2022-02-15 11:43:25 +01:00
Philip Withnall
f9c08308ea
Merge branch 'ebassi/aligned-alloc' into 'main'
...
Add aligned memory allocators
Closes #2574
See merge request GNOME/glib!2421
2022-02-11 15:04:25 +00:00
Philip Withnall
a6311f81ee
gtestutils: Handle empty argv array passed to g_test_init()
...
This can happen if a caller (ab)uses `execve()` to execute a gtest
process with an empty `argv` array. `g_test_init()` has to gracefully
handle such a situation.
Fix a few problem areas in the code, and add a simple test which checks
that `g_test_init()` doesn’t crash when called with an empty `argv`.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:47:19 +00:00
Emmanuele Bassi
b37c99c44e
Add tests for g_aligned_alloc()
...
We want to test the API contract, by checking the return value for
zero-sized allocations, invalid alignments, and overflows.
2022-02-11 14:44:09 +00:00
Philip Withnall
1094bfc7d7
Merge branch 'wip/smcv/defer-test-cleanup' into 'main'
...
testutils: Defer global cleanup until we really exit
Closes #2563
See merge request GNOME/glib!2420
2022-02-11 14:21:43 +00:00
Simon McVittie
00b17c92bf
Add a test-case for calling g_test_build_filename after g_test_run
...
This will not reproduce the bug when run as a unit test, because in that
scenario, G_TEST_BUILDDIR and G_TEST_SRCDIR are set. It *can* reproduce
the bug (at least probabilistically) when run as an installed-test,
or manually in a build tree:
./_build/glib/tests/testing
Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2563
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-11 13:04:06 +00:00
Philip Withnall
a71ed21116
Merge branch 'unicode-script-math' into 'main'
...
Add G_UNICODE_SCRIPT_MATH to GUnicodeScript
See merge request GNOME/glib!2476
2022-02-11 12:42:55 +00:00
Alexis King
e85a085ca4
Add G_UNICODE_SCRIPT_MATH to GUnicodeScript
2022-02-11 12:42:55 +00:00
Philip Withnall
0c27ac8287
tests: Use g_test_skip() to skip a test on Windows
2022-02-10 13:40:28 +00:00
Marc-André Lureau
32f514b0fa
glib/tests: skip more tests that depend on installed translations
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:59 +04:00
Marc-André Lureau
6d21ff6305
glib/tests: skip test that aborts with plain Windows UCRT
...
setlocale() asserts on LC_MESSAGES:
minkernel\crts\ucrt\src\appcrt\locale\wsetlocale.cpp(448) : Assertion failed: LC_MIN <= _category && _category <= LC_MAX
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale
https://developercommunity.visualstudio.com/t/setlocale-assert-on-invalid-category/1646244
(apparently, MinGW wraps or reimplements the call)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:59 +04:00
Marc-André Lureau
9e9e323a2d
glib/tests: set DE ThreadLocale to fix a test
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:59 +04:00
Marc-André Lureau
2761e13446
glib/tests: skip some tests if langinfo isn't available
...
The fallback win32 code doesn't seem to be localized.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:59 +04:00
Marc-André Lureau
60e7430c80
glib/tests: skip rfc8536 file parsing on Windows
...
This is specific to Unix, as far as I can tell.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:56 +04:00
Marc-André Lureau
1713dd0a91
tests: skip read-only-directory test on win32
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 01:05:46 +04:00
Marc-André Lureau
354c454c56
tests: fix read-only-file test
...
The test is meant to check read-only files don't get overwritten, which
is 0400 in octal.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 01:04:30 +04:00
Marc-André Lureau
59b226d272
tests: use g_chmod in fileutils tests
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 00:36:46 +04:00
Marc-André Lureau
5f4e8f625d
tests: fix test_set_contents_full error test on win32
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 00:36:46 +04:00
Marc-André Lureau
a4e302f503
tests: fix test_set_contents_full mode check on win32
...
Fixes:
GLib:ERROR:../glib/tests/fileutils.c:1348:test_set_contents_full: assertion failed (statbuf.st_mode & ~S_IFMT == tests[i].new_mode): (438 == 420)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 00:36:46 +04:00
Philip Withnall
e74d6f4552
Merge branch 'test_two_digit_years' into 'main'
...
Improve coverage of two digit years in gdate tests
See merge request GNOME/glib!2477
2022-02-09 11:40:52 +00:00
Emmanuel Fleury
d2e86d806c
Improve coverage of two digit years in gdate tests
2022-02-08 23:35:59 +01:00
Marc-André Lureau
e05227371d
glib/win32: fix passing same fd for stdout & stderr spawn
...
Delay closing the FDs after all input FDs are duped.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-07 23:39:36 +04:00
Marc-André Lureau
34ce1b1f93
glib/spawn: win32 helper doesn't support same fd for out&err
...
This is fixed in the following commits of this MR.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-07 23:31:10 +04:00