test.sh: implement EXIT trap

This commit is contained in:
Johannes 'josch' Schauer 2018-08-27 08:17:06 +02:00
parent 2f3394a1cb
commit bd55ac5a45
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

11
test.sh
View file

@ -79,8 +79,17 @@ compare_pdfimages()
rm "$tempdir/images-000.png"
}
error()
{
echo test $j failed
echo intermediate data is left in $tempdir
exit 1
}
tempdir=$(mktemp --directory --tmpdir img2pdf.XXXXXXXXXX)
trap error EXIT
# we use -strip to remove all timestamps (tIME chunk and exif data)
convert -size 60x60 \( xc:none -fill red -draw 'circle 30,21 30,3' -gaussian-blur 0x3 \) \
\( \( xc:none -fill lime -draw 'circle 39,39 36,57' -gaussian-blur 0x3 \) \
@ -1360,3 +1369,5 @@ rm "$tempdir/group4.tiff" "$tempdir/out.pdf"
rm "$tempdir/alpha.png" "$tempdir/normal.png" "$tempdir/inverse.png" "$tempdir/palette1.png" "$tempdir/palette2.png" "$tempdir/palette4.png" "$tempdir/palette8.png" "$tempdir/gray8.png" "$tempdir/normal16.png" "$tempdir/gray16.png" "$tempdir/gray4.png" "$tempdir/gray2.png" "$tempdir/gray1.png"
rmdir "$tempdir"
trap - EXIT