File: tools-test

package info (click to toggle)
libgd2 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,360 kB
  • sloc: ansic: 48,194; sh: 5,603; cpp: 1,298; makefile: 323; perl: 225; tcl: 45
file content (26 lines) | stat: -rw-r--r-- 1,031 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

set -e

DATA=$(cat <<EOF)
pngtogd gdtopng testfile.png image/png
pngtogd2 gd2topng testfile.png image/png 1024 2
giftogd2 gd2togif testfile.gif image/gif 1024 2
EOF
echo "$DATA" | while read tool reverse source_file expected_mime args; do
    $tool debian/tests/$source_file $AUTOPKGTEST_TMP/$source_file.gd $args
    $reverse $AUTOPKGTEST_TMP/$source_file.gd $AUTOPKGTEST_TMP/1-$source_file
    rm $AUTOPKGTEST_TMP/$source_file.gd
    $tool $AUTOPKGTEST_TMP/1-$source_file $AUTOPKGTEST_TMP/$source_file.gd $args
    $reverse $AUTOPKGTEST_TMP/$source_file.gd $AUTOPKGTEST_TMP/$source_file

    test "$(stat -c "%s" $AUTOPKGTEST_TMP/$source_file)" -gt 1000 && file -i $AUTOPKGTEST_TMP/$source_file | grep -q $expected_mime  &&
        diff -q $AUTOPKGTEST_TMP/$source_file $AUTOPKGTEST_TMP/1-$source_file || {
            echo "File $AUTOPKGTEST_TMP/$source_file unsatisfactory:"
            ls -l $AUTOPKGTEST_TMP/$source_file
            file -i $AUTOPKGTEST_TMP/$source_file
            false
        }
    
done