2021-05-14 15:26:15 +01:00
|
|
|
From 57bed86429db9d871f1442c94f14e94e38972ca3 Mon Sep 17 00:00:00 2001
|
2019-05-17 02:24:40 +01:00
|
|
|
From: worldofpeace <worldofpeace@protonmail.ch>
|
|
|
|
Date: Thu, 16 May 2019 21:15:15 -0400
|
|
|
|
Subject: [PATCH] meson: add options for tests installation dirs
|
|
|
|
|
|
|
|
---
|
2019-08-21 22:12:07 +01:00
|
|
|
meson_options.txt | 6 ++++++
|
2021-05-14 15:26:15 +01:00
|
|
|
tests/meson.build | 23 ++++++++++++++++-------
|
|
|
|
2 files changed, 22 insertions(+), 7 deletions(-)
|
2019-05-17 02:24:40 +01:00
|
|
|
|
|
|
|
diff --git a/meson_options.txt b/meson_options.txt
|
2021-05-14 15:26:15 +01:00
|
|
|
index b9a2fb5..4b8629f 100644
|
2019-05-17 02:24:40 +01:00
|
|
|
--- a/meson_options.txt
|
|
|
|
+++ b/meson_options.txt
|
2021-05-14 15:26:15 +01:00
|
|
|
@@ -23,3 +23,9 @@ option('tests', type: 'boolean',
|
2019-08-21 22:12:07 +01:00
|
|
|
option('installed_tests', type: 'boolean',
|
2019-05-17 02:24:40 +01:00
|
|
|
value: true,
|
2019-08-21 22:12:07 +01:00
|
|
|
description: 'Install tests')
|
2019-05-17 02:24:40 +01:00
|
|
|
+option('installed_test_datadir', type: 'string',
|
|
|
|
+ value: '',
|
|
|
|
+ description: 'Installation directory for data files in tests')
|
|
|
|
+option('installed_test_bindir', type: 'string',
|
|
|
|
+ value: '',
|
|
|
|
+ description: 'Installation directory for binary files in tests')
|
2019-08-21 22:12:07 +01:00
|
|
|
diff --git a/tests/meson.build b/tests/meson.build
|
2021-05-14 15:26:15 +01:00
|
|
|
index 77281f5..c4c7fac 100644
|
2019-08-21 22:12:07 +01:00
|
|
|
--- a/tests/meson.build
|
|
|
|
+++ b/tests/meson.build
|
2021-05-14 15:26:15 +01:00
|
|
|
@@ -21,8 +21,17 @@ unit_tests = [
|
|
|
|
|
|
|
|
gen_installed_test = find_program('gen-installed-test.py')
|
2019-05-17 02:24:40 +01:00
|
|
|
|
|
|
|
-installed_test_datadir = join_paths(get_option('prefix'), get_option('datadir'), 'installed-tests', graphene_api_path)
|
|
|
|
-installed_test_bindir = join_paths(get_option('prefix'), get_option('libexecdir'), 'installed-tests', graphene_api_path)
|
|
|
|
+test_suffix = join_paths('installed-tests', graphene_api_path)
|
|
|
|
+
|
|
|
|
+test_datadir = join_paths(get_option('installed_test_datadir'), test_suffix)
|
|
|
|
+if test_datadir == ''
|
|
|
|
+ test_datadir = join_paths(get_option('prefix'), get_option('datadir'), test_suffix)
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
+test_bindir = join_paths(get_option('installed_test_bindir'), test_suffix)
|
|
|
|
+if test_bindir == ''
|
|
|
|
+ test_bindir = join_paths(get_option('prefix'), get_option('libexecdir'), test_suffix)
|
|
|
|
+endif
|
|
|
|
|
2019-08-21 22:12:07 +01:00
|
|
|
# Make tests conditional on having mutest-1 installed system-wide, or
|
|
|
|
# available as a subproject
|
2021-05-14 15:26:15 +01:00
|
|
|
@@ -40,13 +49,13 @@ if mutest_dep.found()
|
|
|
|
output: wrapper,
|
2019-08-21 22:12:07 +01:00
|
|
|
command: [
|
|
|
|
gen_installed_test,
|
|
|
|
- '--testdir=@0@'.format(installed_test_bindir),
|
|
|
|
+ '--testdir=@0@'.format(test_bindir),
|
|
|
|
'--testname=@0@'.format(unit),
|
|
|
|
'--outdir=@OUTDIR@',
|
|
|
|
'--outfile=@0@'.format(wrapper),
|
|
|
|
],
|
|
|
|
install: get_option('installed_tests'),
|
|
|
|
- install_dir: installed_test_datadir,
|
|
|
|
+ install_dir: test_datadir,
|
|
|
|
)
|
2019-05-17 02:24:40 +01:00
|
|
|
|
2019-08-21 22:12:07 +01:00
|
|
|
test(unit,
|
2021-05-14 15:26:15 +01:00
|
|
|
@@ -55,7 +64,7 @@ if mutest_dep.found()
|
2019-08-21 22:12:07 +01:00
|
|
|
include_directories: graphene_inc,
|
|
|
|
c_args: common_cflags,
|
|
|
|
install: get_option('installed_tests'),
|
|
|
|
- install_dir: installed_test_bindir,
|
|
|
|
+ install_dir: test_bindir,
|
|
|
|
),
|
|
|
|
env: ['MUTEST_OUTPUT=tap'],
|
|
|
|
protocol: 'tap',
|
2021-05-14 15:26:15 +01:00
|
|
|
@@ -70,13 +79,13 @@ if build_gir and host_system == 'linux' and not meson.is_cross_build()
|
|
|
|
output: wrapper,
|
|
|
|
command: [
|
|
|
|
gen_installed_test,
|
|
|
|
- '--testdir=@0@'.format(installed_test_bindir),
|
|
|
|
+ '--testdir=@0@'.format(test_bindir),
|
|
|
|
'--testname=@0@'.format(unit),
|
|
|
|
'--outdir=@OUTDIR@',
|
|
|
|
'--outfile=@0@'.format(wrapper),
|
|
|
|
],
|
|
|
|
install: get_option('installed_tests'),
|
|
|
|
- install_dir: installed_test_datadir,
|
|
|
|
+ install_dir: test_datadir,
|
|
|
|
)
|
|
|
|
|
|
|
|
test(unit,
|
2019-05-17 02:24:40 +01:00
|
|
|
--
|
2021-05-14 15:26:15 +01:00
|
|
|
2.31.1
|
2019-05-17 02:24:40 +01:00
|
|
|
|