summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2023-03-17 11:55:56 +0000
committerSimon McVittie <smcv@collabora.com>2023-03-17 16:34:09 +0000
commita058d9617fabcc17346db2d25bcb1c2b589c3bc2 (patch)
tree97a907c4472eae77258faf349ea0ef01fb9fd080
parent319832190f44e16d4b9315b59cc8aa0b1c73f0e5 (diff)
downloadflatpak-a058d9617fabcc17346db2d25bcb1c2b589c3bc2.tar.gz
tests: Call g_test_init() before isolated_test_dir_global_setup()
g_test_init() is meant to be called before any other use of GTest APIs, and isolated_test_dir_global_setup() can call g_test_message(). GLib 2.76 makes this more of a practical problem. (isolated_test_dir_global_setup() is essentially a reimplementation of G_TEST_OPTION_ISOLATE_DIRS, since we don't depend on GLib 2.60.) Alternative to https://github.com/flatpak/flatpak/pull/5355. Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--tests/test-exports.c3
-rw-r--r--tests/test-instance.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/tests/test-exports.c b/tests/test-exports.c
index 6be9567a..931dcb58 100644
--- a/tests/test-exports.c
+++ b/tests/test-exports.c
@@ -1477,9 +1477,8 @@ main (int argc, char *argv[])
/* Do not call setlocale() here: some tests look at untranslated error
* messages. */
- isolated_test_dir_global_setup ();
-
g_test_init (&argc, &argv, NULL);
+ isolated_test_dir_global_setup ();
g_test_add_func ("/context/empty", test_empty_context);
g_test_add_func ("/context/filesystems", test_filesystems);
diff --git a/tests/test-instance.c b/tests/test-instance.c
index d6ba40d8..8954366a 100644
--- a/tests/test-instance.c
+++ b/tests/test-instance.c
@@ -491,9 +491,8 @@ main (int argc, char *argv[])
{
int res;
- isolated_test_dir_global_setup ();
-
g_test_init (&argc, &argv, NULL);
+ isolated_test_dir_global_setup ();
g_test_add_func ("/instance/gc", test_gc);
g_test_add_func ("/instance/claim-per-app-temp-directory",