diff --git a/gthread/meson.build b/gthread/meson.build
index 4df201f35..612626315 100644
--- a/gthread/meson.build
+++ b/gthread/meson.build
@@ -36,3 +36,7 @@ pkg.generate(libgthread,
libgthread_dep = declare_dependency(link_with : libgthread)
meson.override_dependency('gthread-2.0', libgthread_dep)
+
+if build_tests
+ subdir('tests')
+endif
diff --git a/gthread/tests/init.c b/gthread/tests/init.c
new file mode 100644
index 000000000..79f68f050
--- /dev/null
+++ b/gthread/tests/init.c
@@ -0,0 +1,68 @@
+/* GLib testing framework examples and tests
+ *
+ * Copyright © 2022 Endless OS Foundation, LLC
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see .
+ *
+ * Author: Philip Withnall
+ */
+
+#include
+#include
+
+
+/* All of GThread is deprecated, but that’s OK */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+static void
+test_thread_deprecated_init (void)
+{
+ const GThreadFunctions functions = { NULL, };
+
+ /* Should be a no-op. */
+ g_thread_init (NULL);
+
+ /* Should emit a warning. */
+ g_test_expect_message ("GThread", G_LOG_LEVEL_WARNING,
+ "GThread system no longer supports custom thread implementations.");
+ g_thread_init ((gpointer) &functions);
+ g_test_assert_expected_messages ();
+}
+
+static void
+test_thread_deprecated_init_with_errorcheck_mutexes (void)
+{
+ /* Should warn. */
+ g_test_expect_message ("GThread", G_LOG_LEVEL_WARNING,
+ "GThread system no longer supports errorcheck mutexes.");
+ g_thread_init_with_errorcheck_mutexes (NULL);
+ g_test_assert_expected_messages ();
+}
+
+int
+main (int argc,
+ char *argv[])
+{
+ setlocale (LC_ALL, "");
+ g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
+
+ g_test_add_func ("/thread/deprecated/init", test_thread_deprecated_init);
+ g_test_add_func ("/thread/deprecated/init-with-errorcheck-mutexes", test_thread_deprecated_init_with_errorcheck_mutexes);
+
+ return g_test_run ();
+}
+
+G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/gthread/tests/meson.build b/gthread/tests/meson.build
new file mode 100644
index 000000000..86da67413
--- /dev/null
+++ b/gthread/tests/meson.build
@@ -0,0 +1,48 @@
+gthread_tests = {
+ 'init' : {},
+}
+
+test_env = environment()
+test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
+test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
+
+test_deps = [thread_dep, libglib_dep, libgthread_dep]
+test_cargs = ['-DG_LOG_DOMAIN="GLib-GThread"', '-UG_DISABLE_ASSERT']
+test_cpp_args = test_cargs
+
+foreach test_name, extra_args : gthread_tests
+ source = extra_args.get('source', test_name + '.c')
+ install = installed_tests_enabled and extra_args.get('install', true)
+
+ if install
+ test_conf = configuration_data()
+ test_conf.set('installed_tests_dir', installed_tests_execdir)
+ test_conf.set('program', test_name)
+ test_conf.set('env', '')
+ configure_file(
+ input: installed_tests_template_tap,
+ output: test_name + '.test',
+ install_dir: installed_tests_metadir,
+ install_tag: 'tests',
+ configuration: test_conf
+ )
+ endif
+
+ exe = executable(test_name, source,
+ c_args : test_cargs + extra_args.get('c_args', []),
+ cpp_args : test_cpp_args + extra_args.get('cpp_args', []),
+ dependencies : test_deps + extra_args.get('dependencies', []),
+ install_dir: installed_tests_execdir,
+ install_tag: 'tests',
+ install: install,
+ )
+
+ suite = ['gthread'] + extra_args.get('suite', [])
+ timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
+
+ if extra_args.get('can_fail', false)
+ suite += 'failing'
+ endif
+
+ test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
+endforeach