1diff --git a/installed-tests/meson.build b/installed-tests/meson.build
2index 7e842025..1e5029e0 100644
3--- a/installed-tests/meson.build
4+++ b/installed-tests/meson.build
5@@ -1,7 +1,7 @@
6 ### Installed tests ############################################################
7
8-installed_tests_execdir = get_option('prefix') / pkglibexecdir / 'installed-tests'
9-installed_tests_metadir = abs_datadir / 'installed-tests' / meson.project_name()
10+installed_tests_execdir = get_option('installed_test_prefix') / 'libexec' / meson.project_name() / 'installed-tests'
11+installed_tests_metadir = get_option('installed_test_prefix') / 'share' / 'installed-tests' / meson.project_name()
12
13 # Simple shell script tests #
14
15diff --git a/meson.build b/meson.build
16index 084d5396..e5d73fcd 100644
17--- a/meson.build
18+++ b/meson.build
19@@ -540,7 +540,7 @@ install_data('installed-tests/extra/lsan.supp',
20 install_dir: get_option('datadir') / api_name / 'lsan')
21
22 if get_option('installed_tests')
23- schemadir = abs_datadir / 'glib-2.0' / 'schemas'
24+ schemadir = get_option('installed_test_prefix') / 'share' / 'glib-2.0' / 'schemas'
25 install_data('installed-tests/js/org.gnome.GjsTest.gschema.xml', install_dir: schemadir)
26 meson.add_install_script('build/compile-gschemas.py', schemadir)
27 endif
28diff --git a/meson_options.txt b/meson_options.txt
29index 66f66024..008687cb 100644
30--- a/meson_options.txt
31+++ b/meson_options.txt
32@@ -25,3 +25,5 @@ option('skip_gtk_tests', type: 'boolean', value: false,
33 description: 'Skip tests that need a display connection')
34 option('verbose_logs', type: 'boolean', value: false,
35 description: 'Enable extra log messages that may decrease performance (not allowed in release builds)')
36+option('installed_test_prefix', type: 'string', value: '',
37+ description: 'Prefix for installed tests')