File: tools-test

package info (click to toggle)
libgd2 2.3.3-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,396 kB
  • sloc: ansic: 49,708; sh: 5,660; javascript: 1,859; cpp: 1,308; makefile: 345; perl: 197; 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