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.
This commit is contained in:
Matthias Clasen 2017-10-18 10:41:57 +08:00
parent 896316a9d1
commit f8f94ab329
20 changed files with 40 additions and 27 deletions

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -4,7 +4,7 @@
<child>
<object class="GtkLabel"/>
<packing>
<property name="expand">True</property>
<property name="expand">1</property>
</packing>
</child>
</object>

View File

@ -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))

View File

@ -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