From: Jeremy Bicha Date: Mon, 5 Jun 2023 17:49:20 +0000 (-0400) Subject: Revert "tests: Stop copying the tool tests" X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2~12 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=02a4f0bf28ff857a95d6caaf8935015c3bfae728;p=gtk4.git Revert "tests: Stop copying the tool tests" This reverts commit bb3a6214cbeaa3211be007192e536bd473323836. This is actually used by the installed tests which we also had to revert dropping (in a separate patch) Gbp-Pq: Name Revert-tests-Stop-copying-the-tool-tests.patch --- diff --git a/testsuite/tools/enumerate b/testsuite/tools/enumerate deleted file mode 100755 index 8abd9d67f1..0000000000 --- a/testsuite/tools/enumerate +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/bash - -GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} -TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/enumerate-data -TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/enumerate - -mkdir -p "$TEST_RESULT_DIR" - -shopt -s nullglob -TESTS=( "$TEST_DATA_DIR"/*.ui ) - -echo "1..${#TESTS[*]}" - -I=1 -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" - - cd $TEST_DATA_DIR - - $GTK_BUILDER_TOOL enumerate --callbacks $(basename $t) >$result - - cd $OLDPWD - - 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)) -done diff --git a/testsuite/tools/enumerate.in b/testsuite/tools/enumerate.in new file mode 100755 index 0000000000..8abd9d67f1 --- /dev/null +++ b/testsuite/tools/enumerate.in @@ -0,0 +1,37 @@ +#! /bin/bash + +GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} +TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/enumerate-data +TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/enumerate + +mkdir -p "$TEST_RESULT_DIR" + +shopt -s nullglob +TESTS=( "$TEST_DATA_DIR"/*.ui ) + +echo "1..${#TESTS[*]}" + +I=1 +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" + + cd $TEST_DATA_DIR + + $GTK_BUILDER_TOOL enumerate --callbacks $(basename $t) >$result + + cd $OLDPWD + + 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)) +done diff --git a/testsuite/tools/meson.build b/testsuite/tools/meson.build index 239e1b0e04..e19a8195d6 100644 --- a/testsuite/tools/meson.build +++ b/testsuite/tools/meson.build @@ -3,8 +3,12 @@ if bash.found() test_env = environment() foreach t : ['simplify', 'simplify-3to4', 'validate', 'enumerate', 'settings'] - test(t, - find_program(t, dirs: meson.current_source_dir()), + configure_file(output: t, + input: '@0@.in'.format(t), + copy: true, + ) + test(t, bash, + args: t, workdir: meson.current_build_dir(), protocol: 'tap', env: [ diff --git a/testsuite/tools/settings b/testsuite/tools/settings deleted file mode 100755 index 3c5ce69016..0000000000 --- a/testsuite/tools/settings +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/bash - -GTK_QUERY_SETTINGS=${GTK_QUERY_SETTINGS:-gtk4-query-settings} -TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp} - -shopt -s nullglob - -echo "1..1" - -name=gtk-query-settings -result=$TEST_RESULT_DIR/$name.out -$GTK_QUERY_SETTINGS 2>/dev/null >$result -EXPECTED=50 -SEEN=$(wc -l $result | cut -f1 -d' ') - -if [ $SEEN -eq $EXPECTED ]; then - echo "ok 1 $name." -else - echo "not ok 1 $name. Expected: $EXPECTED. Seen: $SEEN" -fi diff --git a/testsuite/tools/settings.in b/testsuite/tools/settings.in new file mode 100755 index 0000000000..3c5ce69016 --- /dev/null +++ b/testsuite/tools/settings.in @@ -0,0 +1,20 @@ +#! /bin/bash + +GTK_QUERY_SETTINGS=${GTK_QUERY_SETTINGS:-gtk4-query-settings} +TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp} + +shopt -s nullglob + +echo "1..1" + +name=gtk-query-settings +result=$TEST_RESULT_DIR/$name.out +$GTK_QUERY_SETTINGS 2>/dev/null >$result +EXPECTED=50 +SEEN=$(wc -l $result | cut -f1 -d' ') + +if [ $SEEN -eq $EXPECTED ]; then + echo "ok 1 $name." +else + echo "not ok 1 $name. Expected: $EXPECTED. Seen: $SEEN" +fi diff --git a/testsuite/tools/simplify b/testsuite/tools/simplify deleted file mode 100755 index 12b4cea8ef..0000000000 --- a/testsuite/tools/simplify +++ /dev/null @@ -1,47 +0,0 @@ -#! /bin/bash - -GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} -TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data -TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify - -mkdir -p "$TEST_RESULT_DIR" - -shopt -s nullglob -TESTS=( "$TEST_DATA_DIR"/*.ui ) - -echo "1..$((2 * ${#TESTS[*]}))" - -I=1 -for t in ${TESTS[*]}; do - name=$(basename $t .ui) - expected="$TEST_DATA_DIR/$name.expected" - result="$TEST_RESULT_DIR/$name.out" - result2="$TEST_RESULT_DIR/$name.out2" - diff="$TEST_RESULT_DIR/$name.diff" - ref="$TEST_RESULT_DIR/$name.ref" - - $GTK_BUILDER_TOOL simplify $t 2>/dev/null >$result - - 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)) - - cp $t $result2 - $GTK_BUILDER_TOOL simplify --replace $result2 2>/dev/null - - if diff -u "$expected" "$result2" > "$diff"; then - echo "ok $I $name (--replace)" - rm "$diff" - else - echo "not ok $I $name (--replace)" - cp "$expected" "$ref" - fi - - I=$((I+1)) -done diff --git a/testsuite/tools/simplify-3to4 b/testsuite/tools/simplify-3to4 deleted file mode 100755 index 0a97f1afd8..0000000000 --- a/testsuite/tools/simplify-3to4 +++ /dev/null @@ -1,47 +0,0 @@ -#! /bin/bash - -GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} -TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data-3to4 -TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify-3to4 - -mkdir -p "$TEST_RESULT_DIR" - -shopt -s nullglob -TESTS=( "$TEST_DATA_DIR"/*.ui ) - -echo "1..$((2 * ${#TESTS[*]}))" - -I=1 -for t in ${TESTS[*]}; do - name=$(basename $t .ui) - expected="$TEST_DATA_DIR/$name.expected" - result="$TEST_RESULT_DIR/$name.out" - result2="$TEST_RESULT_DIR/$name.out2" - diff="$TEST_RESULT_DIR/$name.diff" - ref="$TEST_RESULT_DIR/$name.ref" - - $GTK_BUILDER_TOOL simplify --3to4 $t 2>/dev/null >$result - - 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)) - - cp $t $result2 - $GTK_BUILDER_TOOL simplify --3to4 --replace $result2 2>/dev/null - - if diff -u "$expected" "$result2" > "$diff"; then - echo "ok $I $name (--replace)" - rm "$diff" - else - echo "not ok $I $name (--replace)" - cp "$expected" "$ref" - fi - - I=$((I+1)) -done diff --git a/testsuite/tools/simplify-3to4.in b/testsuite/tools/simplify-3to4.in new file mode 100755 index 0000000000..0a97f1afd8 --- /dev/null +++ b/testsuite/tools/simplify-3to4.in @@ -0,0 +1,47 @@ +#! /bin/bash + +GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} +TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data-3to4 +TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify-3to4 + +mkdir -p "$TEST_RESULT_DIR" + +shopt -s nullglob +TESTS=( "$TEST_DATA_DIR"/*.ui ) + +echo "1..$((2 * ${#TESTS[*]}))" + +I=1 +for t in ${TESTS[*]}; do + name=$(basename $t .ui) + expected="$TEST_DATA_DIR/$name.expected" + result="$TEST_RESULT_DIR/$name.out" + result2="$TEST_RESULT_DIR/$name.out2" + diff="$TEST_RESULT_DIR/$name.diff" + ref="$TEST_RESULT_DIR/$name.ref" + + $GTK_BUILDER_TOOL simplify --3to4 $t 2>/dev/null >$result + + 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)) + + cp $t $result2 + $GTK_BUILDER_TOOL simplify --3to4 --replace $result2 2>/dev/null + + if diff -u "$expected" "$result2" > "$diff"; then + echo "ok $I $name (--replace)" + rm "$diff" + else + echo "not ok $I $name (--replace)" + cp "$expected" "$ref" + fi + + I=$((I+1)) +done diff --git a/testsuite/tools/simplify.in b/testsuite/tools/simplify.in new file mode 100755 index 0000000000..12b4cea8ef --- /dev/null +++ b/testsuite/tools/simplify.in @@ -0,0 +1,47 @@ +#! /bin/bash + +GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} +TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data +TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify + +mkdir -p "$TEST_RESULT_DIR" + +shopt -s nullglob +TESTS=( "$TEST_DATA_DIR"/*.ui ) + +echo "1..$((2 * ${#TESTS[*]}))" + +I=1 +for t in ${TESTS[*]}; do + name=$(basename $t .ui) + expected="$TEST_DATA_DIR/$name.expected" + result="$TEST_RESULT_DIR/$name.out" + result2="$TEST_RESULT_DIR/$name.out2" + diff="$TEST_RESULT_DIR/$name.diff" + ref="$TEST_RESULT_DIR/$name.ref" + + $GTK_BUILDER_TOOL simplify $t 2>/dev/null >$result + + 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)) + + cp $t $result2 + $GTK_BUILDER_TOOL simplify --replace $result2 2>/dev/null + + if diff -u "$expected" "$result2" > "$diff"; then + echo "ok $I $name (--replace)" + rm "$diff" + else + echo "not ok $I $name (--replace)" + cp "$expected" "$ref" + fi + + I=$((I+1)) +done diff --git a/testsuite/tools/validate b/testsuite/tools/validate deleted file mode 100755 index 414a5053b3..0000000000 --- a/testsuite/tools/validate +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/bash - -GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} -TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/validate-data -TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/validate - -mkdir -p "$TEST_RESULT_DIR" - -shopt -s nullglob -TESTS=( "$TEST_DATA_DIR"/*.ui ) - -echo "1..${#TESTS[*]}" - -I=1 -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" - - cd $TEST_DATA_DIR - - $GTK_BUILDER_TOOL validate --deprecations $(basename $t) 2>$result - - cd $OLDPWD - - 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)) -done diff --git a/testsuite/tools/validate.in b/testsuite/tools/validate.in new file mode 100755 index 0000000000..414a5053b3 --- /dev/null +++ b/testsuite/tools/validate.in @@ -0,0 +1,37 @@ +#! /bin/bash + +GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool} +TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/validate-data +TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/validate + +mkdir -p "$TEST_RESULT_DIR" + +shopt -s nullglob +TESTS=( "$TEST_DATA_DIR"/*.ui ) + +echo "1..${#TESTS[*]}" + +I=1 +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" + + cd $TEST_DATA_DIR + + $GTK_BUILDER_TOOL validate --deprecations $(basename $t) 2>$result + + cd $OLDPWD + + 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)) +done