Debian Codegraph @

debian/tests/tools-test

raw
1 #!/bin/sh
2
3 set -e
4
5 DATA=$(cat <<EOF)
6 pngtogd gdtopng testfile.png image/png
7 pngtogd2 gd2topng testfile.png image/png 1024 2
8 giftogd2 gd2togif testfile.gif image/gif 1024 2
9 EOF
10 echo "$DATA" | while read tool reverse source_file expected_mime args; do
11 $tool debian/tests/$source_file $AUTOPKGTEST_TMP/$source_file.gd $args
12 $reverse $AUTOPKGTEST_TMP/$source_file.gd $AUTOPKGTEST_TMP/1-$source_file
13 rm $AUTOPKGTEST_TMP/$source_file.gd
14 $tool $AUTOPKGTEST_TMP/1-$source_file $AUTOPKGTEST_TMP/$source_file.gd $args
15 $reverse $AUTOPKGTEST_TMP/$source_file.gd $AUTOPKGTEST_TMP/$source_file
16
17 test "$(stat -c "%s" $AUTOPKGTEST_TMP/$source_file)" -gt 1000 && file -i $AUTOPKGTEST_TMP/$source_file | grep -q $expected_mime &&
18 diff -q $AUTOPKGTEST_TMP/$source_file $AUTOPKGTEST_TMP/1-$source_file || {
19 echo "File $AUTOPKGTEST_TMP/$source_file unsatisfactory:"
20 ls -l $AUTOPKGTEST_TMP/$source_file
21 file -i $AUTOPKGTEST_TMP/$source_file
22 false
23 }
24
25 done
26