summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-10-18 10:41:57 +0800
committerMatthias Clasen <mclasen@redhat.com>2017-10-18 17:30:20 +0200
commitf8f94ab329b1deb8d315cdb8689203c7bb4d1906 (patch)
treed02d0a6096f75d849db73c8e3d05da9bd5b1174c /testsuite
parent896316a9d134cf5a4bbfa1920dbd6de029776907 (diff)
downloadgtk+-f8f94ab329b1deb8d315cdb8689203c7bb4d1906.tar.gz
Install tools tests
At the same time, update the expected test output to match the current tools output, and write diff and ref files in /tmp.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tools/meson.build47
-rwxr-xr-xtestsuite/tools/settings.in (renamed from testsuite/tools/test-settings.in)0
-rw-r--r--testsuite/tools/simplify-data/test1.expected (renamed from testsuite/tools/simplify/test1.expected)0
-rw-r--r--testsuite/tools/simplify-data/test1.ui (renamed from testsuite/tools/simplify/test1.ui)0
-rw-r--r--testsuite/tools/simplify-data/test2.expected (renamed from testsuite/tools/simplify/test2.expected)2
-rw-r--r--testsuite/tools/simplify-data/test2.ui (renamed from testsuite/tools/simplify/test2.ui)0
-rw-r--r--testsuite/tools/simplify-data/test3.expected (renamed from testsuite/tools/simplify/test3.expected)2
-rw-r--r--testsuite/tools/simplify-data/test3.ui (renamed from testsuite/tools/simplify/test3.ui)0
-rw-r--r--testsuite/tools/simplify-data/test4.expected (renamed from testsuite/tools/simplify/test4.expected)2
-rw-r--r--testsuite/tools/simplify-data/test4.ui (renamed from testsuite/tools/simplify/test4.ui)0
-rw-r--r--testsuite/tools/simplify-data/test5.expected (renamed from testsuite/tools/simplify/test5.expected)0
-rw-r--r--testsuite/tools/simplify-data/test5.ui (renamed from testsuite/tools/simplify/test5.ui)0
-rw-r--r--testsuite/tools/simplify-data/test6.expected (renamed from testsuite/tools/simplify/test6.expected)0
-rw-r--r--testsuite/tools/simplify-data/test6.ui (renamed from testsuite/tools/simplify/test6.ui)0
-rw-r--r--testsuite/tools/simplify-data/test7.expected (renamed from testsuite/tools/simplify/test7.expected)0
-rw-r--r--testsuite/tools/simplify-data/test7.ui (renamed from testsuite/tools/simplify/test7.ui)0
-rw-r--r--testsuite/tools/simplify-data/test8.expected (renamed from testsuite/tools/simplify/test8.expected)2
-rw-r--r--testsuite/tools/simplify-data/test8.ui (renamed from testsuite/tools/simplify/test8.ui)0
-rwxr-xr-xtestsuite/tools/simplify.in (renamed from testsuite/tools/test-simplify.in)8
-rw-r--r--testsuite/tools/tools.test.in4
20 files changed, 40 insertions, 27 deletions
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
index 5e32c80e12..5e32c80e12 100755
--- a/testsuite/tools/test-settings.in
+++ b/testsuite/tools/settings.in
diff --git a/testsuite/tools/simplify/test1.expected b/testsuite/tools/simplify-data/test1.expected
index de1472e5cd..de1472e5cd 100644
--- a/testsuite/tools/simplify/test1.expected
+++ b/testsuite/tools/simplify-data/test1.expected
diff --git a/testsuite/tools/simplify/test1.ui b/testsuite/tools/simplify-data/test1.ui
index 4f03810de1..4f03810de1 100644
--- a/testsuite/tools/simplify/test1.ui
+++ b/testsuite/tools/simplify-data/test1.ui
diff --git a/testsuite/tools/simplify/test2.expected b/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 @@
<!-- non-default property not stripped -->
<interface>
<object class="GtkWindow">
- <property name="visible">True</property>
+ <property name="visible">1</property>
</object>
</interface>
diff --git a/testsuite/tools/simplify/test2.ui b/testsuite/tools/simplify-data/test2.ui
index 20ffe8d3bb..20ffe8d3bb 100644
--- a/testsuite/tools/simplify/test2.ui
+++ b/testsuite/tools/simplify-data/test2.ui
diff --git a/testsuite/tools/simplify/test3.expected b/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 @@
<!-- translatable property not stripped -->
<interface>
<object class="GtkWindow">
- <property name="visible" translatable="yes">False</property>
+ <property name="visible" translatable="yes">0</property>
</object>
</interface>
diff --git a/testsuite/tools/simplify/test3.ui b/testsuite/tools/simplify-data/test3.ui
index 2490e7900a..2490e7900a 100644
--- a/testsuite/tools/simplify/test3.ui
+++ b/testsuite/tools/simplify-data/test3.ui
diff --git a/testsuite/tools/simplify/test4.expected b/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 @@
<!-- irrelevant comments and context are stripped -->
<interface>
<object class="GtkWindow">
- <property name="visible">True</property>
+ <property name="visible">1</property>
</object>
</interface>
diff --git a/testsuite/tools/simplify/test4.ui b/testsuite/tools/simplify-data/test4.ui
index eb5b0f0ea6..eb5b0f0ea6 100644
--- a/testsuite/tools/simplify/test4.ui
+++ b/testsuite/tools/simplify-data/test4.ui
diff --git a/testsuite/tools/simplify/test5.expected b/testsuite/tools/simplify-data/test5.expected
index 1fb898bc0e..1fb898bc0e 100644
--- a/testsuite/tools/simplify/test5.expected
+++ b/testsuite/tools/simplify-data/test5.expected
diff --git a/testsuite/tools/simplify/test5.ui b/testsuite/tools/simplify-data/test5.ui
index e379abdb2c..e379abdb2c 100644
--- a/testsuite/tools/simplify/test5.ui
+++ b/testsuite/tools/simplify-data/test5.ui
diff --git a/testsuite/tools/simplify/test6.expected b/testsuite/tools/simplify-data/test6.expected
index 8d4495b50e..8d4495b50e 100644
--- a/testsuite/tools/simplify/test6.expected
+++ b/testsuite/tools/simplify-data/test6.expected
diff --git a/testsuite/tools/simplify/test6.ui b/testsuite/tools/simplify-data/test6.ui
index e4f394dc21..e4f394dc21 100644
--- a/testsuite/tools/simplify/test6.ui
+++ b/testsuite/tools/simplify-data/test6.ui
diff --git a/testsuite/tools/simplify/test7.expected b/testsuite/tools/simplify-data/test7.expected
index a75c4d4570..a75c4d4570 100644
--- a/testsuite/tools/simplify/test7.expected
+++ b/testsuite/tools/simplify-data/test7.expected
diff --git a/testsuite/tools/simplify/test7.ui b/testsuite/tools/simplify-data/test7.ui
index 52e0da2f4b..52e0da2f4b 100644
--- a/testsuite/tools/simplify/test7.ui
+++ b/testsuite/tools/simplify-data/test7.ui
diff --git a/testsuite/tools/simplify/test8.expected b/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 @@
<child>
<object class="GtkLabel"/>
<packing>
- <property name="expand">True</property>
+ <property name="expand">1</property>
</packing>
</child>
</object>
diff --git a/testsuite/tools/simplify/test8.ui b/testsuite/tools/simplify-data/test8.ui
index 1aec7adfea..1aec7adfea 100644
--- a/testsuite/tools/simplify/test8.ui
+++ b/testsuite/tools/simplify-data/test8.ui
diff --git a/testsuite/tools/test-simplify.in b/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