Set XDG_CONFIG_DIR for all unittests so they can run in a silo

Sat, 13 Aug 2022 22:06:44 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 13 Aug 2022 22:06:44 -0500
changeset 41493
06dcfb1cc1b2
parent 41492
a1db3bb55aac
child 41494
ba5964adbf7f

Set XDG_CONFIG_DIR for all unittests so they can run in a silo

Testing Done:
Ran the tests and make sure they kept working without issue.

Reviewed at https://reviews.imfreedom.org/r/1587/

libpurple/protocols/jabber/tests/meson.build file | annotate | diff | comparison | revisions
libpurple/protocols/sametime/tests/meson.build file | annotate | diff | comparison | revisions
libpurple/tests/meson.build file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/tests/meson.build	Fri Aug 12 03:29:50 2022 -0500
+++ b/libpurple/protocols/jabber/tests/meson.build	Sat Aug 13 22:06:44 2022 -0500
@@ -4,5 +4,9 @@
 	    link_with : [jabber_prpl],
 	    dependencies : [libxml, libpurple_dep, libsoup, glib])
 
-	test('jabber_' + prog, e)
+	jabberenv = environment()
+	jabberenv.set('XDG_CONFIG_DIR', meson.current_build_dir() / 'config')
+
+	test('jabber_' + prog, e,
+	    env: jabberenv)
 endforeach
--- a/libpurple/protocols/sametime/tests/meson.build	Fri Aug 12 03:29:50 2022 -0500
+++ b/libpurple/protocols/sametime/tests/meson.build	Sat Aug 13 22:06:44 2022 -0500
@@ -4,6 +4,10 @@
 	    link_with : [sametime_prpl],
 	    dependencies : [libpurple_dep, gmime, glib])
 
+	stenv = environment()
+	stenv.set('G_TEST_SRCDIR', meson.current_source_dir())
+	stenv.set('XDG_CONFIG_DIR', meson.current_build_dir() / 'config')
+
 	test('sametime_' + prog, e,
-	    env : 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()))
+	    env : stenv)
 endforeach
--- a/libpurple/tests/meson.build	Fri Aug 12 03:29:50 2022 -0500
+++ b/libpurple/tests/meson.build	Sat Aug 13 22:06:44 2022 -0500
@@ -34,6 +34,9 @@
     dependencies: [libpurple_dep, glib]
 )
 
+testenv = environment()
+testenv.set('XDG_CONFIG_HOME', meson.current_build_dir() / 'config')
+
 foreach prog : PROGS
     e = executable('test_' + prog, 'test_@0@.c'.format(prog),
                    c_args : [
@@ -42,5 +45,7 @@
                    dependencies : [libpurple_dep, glib],
                    link_with: test_ui,
     )
-    test(prog, e)
+    test(prog, e,
+        env: testenv,
+    )
 endforeach

mercurial