X-Git-Url: https://git.draconx.ca/gitweb/liblbx.git/blobdiff_plain/9969a6cd8e946ea3bbcd7f4b357b0e60fc02fe43..fdff28dfb693888c083c47255c784256bede64cb:/tests/moo2data.at diff --git a/tests/moo2data.at b/tests/moo2data.at index 240787c..326763a 100644 --- a/tests/moo2data.at +++ b/tests/moo2data.at @@ -24,13 +24,16 @@ AT_ARG_OPTION_ARG([moo2-datadir], m4_divert_push([PREPARE_TESTS])dnl # Compute MD5 hash of standard input. test_md5sum () { - set x `md5sum /dev/null` + for md5_pos in 2 $#; do + AS_VAR_COPY([md5_digest], [$md5_pos]) + case $md5_digest in + d41d8cd98f00b204e9800998ecf8427e) + set x `$MD5 && echo $?` + eval "echo \$$md5_pos; return \$$#" + esac + done + return 77 } m4_divert_pop([PREPARE_TESTS]) @@ -71,19 +74,17 @@ dnl dnl Compute and validate the MD5 hash over the plane data from a PAM image. dnl Additional arguments specify PAM header fields that should be checked. m4_define([TEST_CHECK_PAM_MD5], -[exec 3<$1; AT_CHECK([pam_check_header <&3 \ - m4_map_args_sep([m4_apply([m4_car], m4_split(], [))], [ ], m4_shift2($@)) -status=$? -echo $pam_TUPLTYPE >$1.tt -exit $?], [0],[m4_map_args([m4_n], m4_shift2($@))]) -AT_CHECK([test_md5sum <&3 >$1.md5]) -exec 3<&- - -# For reliable verification of images with transparency, we must have a known -# constant colour value for transparent pixels. We can use netpbm tools to -# zero out those pixels. For affected image formats, if we cannot normalize -# the transparent pixels we have to skip the test if verification would fail. - +[AT_CHECK([:; { pam_check_header m4_map_args_sep( + [m4_apply([m4_car], m4_split(], [))], [ ], m4_shift2($@)) && + echo $pam_TUPLTYPE >$1.tt && + test_md5sum >$1.md5; } <$1], [0], [m4_map_args([m4_n], m4_shift2($@))]) +dnl AT_CHECK([test_md5sum <&3 >$1.md5]) +dnl exec 3<&- + +dnl For reliable verification of images with transparency, we must have a known +dnl constant colour value for transparent pixels. We can use netpbm tools to +dnl zero out those pixels. For affected image formats, if we cannot normalize +dnl the transparent pixels we have to skip the test if verification would fail. md5_reliable=true read pam_TUPLTYPE <$1.tt AS_CASE([$pam_TUPLTYPE],