diff --git a/testsuite/tools/meson.build b/testsuite/tools/meson.build
index 2515aa548e..64724d292b 100644
--- a/testsuite/tools/meson.build
+++ b/testsuite/tools/meson.build
@@ -1,3 +1,6 @@
+testexecdir = join_paths(installed_test_bindir, 'tools')
+testdatadir = join_paths(installed_test_datadir, 'tools')
+
bash = find_program('bash', required : false)
if bash.found()
test_env = environment()
@@ -5,28 +8,30 @@ if bash.found()
test_env.set('GTK_QUERY_SETTINGS', get_variable('gtk4_query_settings').full_path())
foreach t : ['simplify', 'settings']
- configure_file(output : 'test-@0@'.format(t),
- input : 'test-@0@.in'.format(t),
- configuration : configuration_data())
-
+ configure_file(output: t,
+ input: '@0@.in'.format(t),
+ configuration: configuration_data(),
+ install: get_option('install-tests'),
+ install_dir: testexecdir)
test(t, bash,
- args : 'test-@0@'.format(t),
- workdir : meson.current_build_dir(),
- env : test_env,
- suite: 'tools')
+ args: 'test-@0@'.format(t),
+ workdir: meson.current_build_dir(),
+ env: test_env,
+ suite: 'tools')
endforeach
-endif # bash found
+endif
-# Installed data
+if get_option('install-tests')
+ foreach t : ['simplify', 'settings']
+ test_conf = configuration_data()
+ test_conf.set('testexecdir', testexecdir)
+ test_conf.set('test', t)
+ configure_file(output: '@0@.test'.format(t),
+ input: 'tools.test.in',
+ configuration: test_conf,
+ install: true,
+ install_dir: testdatadir)
+ endforeach
-test_simplify_data = [
- 'simplify/test1.ui', 'simplify/test1.expected',
- 'simplify/test2.ui', 'simplify/test2.expected',
- 'simplify/test3.ui', 'simplify/test3.expected',
- 'simplify/test4.ui', 'simplify/test4.expected',
- 'simplify/test5.ui', 'simplify/test5.expected',
- 'simplify/test6.ui', 'simplify/test6.expected',
- 'simplify/test7.ui', 'simplify/test7.expected',
- 'simplify/test8.ui', 'simplify/test8.expected',
-]
-# TODO: install in case of installed tests - install_data()
+ install_subdir('simplify-data', install_dir: testexecdir)
+endif
diff --git a/testsuite/tools/test-settings.in b/testsuite/tools/settings.in
similarity index 100%
rename from testsuite/tools/test-settings.in
rename to testsuite/tools/settings.in
diff --git a/testsuite/tools/simplify/test1.expected b/testsuite/tools/simplify-data/test1.expected
similarity index 100%
rename from testsuite/tools/simplify/test1.expected
rename to testsuite/tools/simplify-data/test1.expected
diff --git a/testsuite/tools/simplify/test1.ui b/testsuite/tools/simplify-data/test1.ui
similarity index 100%
rename from testsuite/tools/simplify/test1.ui
rename to testsuite/tools/simplify-data/test1.ui
diff --git a/testsuite/tools/simplify/test2.expected b/testsuite/tools/simplify-data/test2.expected
similarity index 70%
rename from testsuite/tools/simplify/test2.expected
rename to testsuite/tools/simplify-data/test2.expected
index 20ffe8d3bb..99fefb9511 100644
--- a/testsuite/tools/simplify/test2.expected
+++ b/testsuite/tools/simplify-data/test2.expected
@@ -1,6 +1,6 @@
diff --git a/testsuite/tools/simplify/test2.ui b/testsuite/tools/simplify-data/test2.ui
similarity index 100%
rename from testsuite/tools/simplify/test2.ui
rename to testsuite/tools/simplify-data/test2.ui
diff --git a/testsuite/tools/simplify/test3.expected b/testsuite/tools/simplify-data/test3.expected
similarity index 62%
rename from testsuite/tools/simplify/test3.expected
rename to testsuite/tools/simplify-data/test3.expected
index 2490e7900a..6b9c07f163 100644
--- a/testsuite/tools/simplify/test3.expected
+++ b/testsuite/tools/simplify-data/test3.expected
@@ -1,6 +1,6 @@
diff --git a/testsuite/tools/simplify/test3.ui b/testsuite/tools/simplify-data/test3.ui
similarity index 100%
rename from testsuite/tools/simplify/test3.ui
rename to testsuite/tools/simplify-data/test3.ui
diff --git a/testsuite/tools/simplify/test4.expected b/testsuite/tools/simplify-data/test4.expected
similarity index 72%
rename from testsuite/tools/simplify/test4.expected
rename to testsuite/tools/simplify-data/test4.expected
index 41d8ecce20..286f1062ec 100644
--- a/testsuite/tools/simplify/test4.expected
+++ b/testsuite/tools/simplify-data/test4.expected
@@ -1,6 +1,6 @@
diff --git a/testsuite/tools/simplify/test4.ui b/testsuite/tools/simplify-data/test4.ui
similarity index 100%
rename from testsuite/tools/simplify/test4.ui
rename to testsuite/tools/simplify-data/test4.ui
diff --git a/testsuite/tools/simplify/test5.expected b/testsuite/tools/simplify-data/test5.expected
similarity index 100%
rename from testsuite/tools/simplify/test5.expected
rename to testsuite/tools/simplify-data/test5.expected
diff --git a/testsuite/tools/simplify/test5.ui b/testsuite/tools/simplify-data/test5.ui
similarity index 100%
rename from testsuite/tools/simplify/test5.ui
rename to testsuite/tools/simplify-data/test5.ui
diff --git a/testsuite/tools/simplify/test6.expected b/testsuite/tools/simplify-data/test6.expected
similarity index 100%
rename from testsuite/tools/simplify/test6.expected
rename to testsuite/tools/simplify-data/test6.expected
diff --git a/testsuite/tools/simplify/test6.ui b/testsuite/tools/simplify-data/test6.ui
similarity index 100%
rename from testsuite/tools/simplify/test6.ui
rename to testsuite/tools/simplify-data/test6.ui
diff --git a/testsuite/tools/simplify/test7.expected b/testsuite/tools/simplify-data/test7.expected
similarity index 100%
rename from testsuite/tools/simplify/test7.expected
rename to testsuite/tools/simplify-data/test7.expected
diff --git a/testsuite/tools/simplify/test7.ui b/testsuite/tools/simplify-data/test7.ui
similarity index 100%
rename from testsuite/tools/simplify/test7.ui
rename to testsuite/tools/simplify-data/test7.ui
diff --git a/testsuite/tools/simplify/test8.expected b/testsuite/tools/simplify-data/test8.expected
similarity index 80%
rename from testsuite/tools/simplify/test8.expected
rename to testsuite/tools/simplify-data/test8.expected
index d5b6825347..df3c4077e3 100644
--- a/testsuite/tools/simplify/test8.expected
+++ b/testsuite/tools/simplify-data/test8.expected
@@ -4,7 +4,7 @@
- True
+ 1
diff --git a/testsuite/tools/simplify/test8.ui b/testsuite/tools/simplify-data/test8.ui
similarity index 100%
rename from testsuite/tools/simplify/test8.ui
rename to testsuite/tools/simplify-data/test8.ui
diff --git a/testsuite/tools/test-simplify.in b/testsuite/tools/simplify.in
similarity index 68%
rename from testsuite/tools/test-simplify.in
rename to testsuite/tools/simplify.in
index 6b4f2e8131..642b50f0e6 100755
--- a/testsuite/tools/test-simplify.in
+++ b/testsuite/tools/simplify.in
@@ -1,7 +1,7 @@
#! /bin/bash
GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk-builder-tool}
-TEST_DATA_DIR=${TEST_DATA_DIR:-./simplify}
+TEST_DATA_DIR=${TEST_DATA_DIR:-./simplify-data}
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
shopt -s nullglob
@@ -14,13 +14,17 @@ for t in ${TESTS[*]}; do
name=$(basename $t .ui)
expected="$TEST_DATA_DIR/$name.expected"
result="$TEST_RESULT_DIR/$name.out"
+ diff="$TEST_RESULT_DIR/$name.diff"
+ ref="$TEST_RESULT_DIR/$name.ref"
$GTK_BUILDER_TOOL simplify $t 2>/dev/null >$result
- if diff "$expected" "$result" > /dev/null; then
+ if diff -u "$expected" "$result" > "$diff"; then
echo "ok $I $name"
+ rm "$diff"
else
echo "not ok $I $name"
+ cp "$expected" "$ref"
fi
I=$((I+1))
diff --git a/testsuite/tools/tools.test.in b/testsuite/tools/tools.test.in
new file mode 100644
index 0000000000..24c47ce34f
--- /dev/null
+++ b/testsuite/tools/tools.test.in
@@ -0,0 +1,4 @@
+[Test]
+Exec=/bin/sh -c "env G_ENABLE_DIAGNOSTIC=0 TEST_DATA_DIR=@testexecdir@/@test@-data @testexecdir@/@test@"
+Type=session
+Output=TAP