Skip to content

Commit 2572007

Browse files
committed
test/regression/run_test.sh: sort alphabetically
sort the tests - use magick_compare instead of imagemagick_compare + removed the compat - run magick_compare outside the if-branch (unneeded, we have `set -e`)
1 parent 586fcc8 commit 2572007

File tree

2 files changed

+32
-54
lines changed

2 files changed

+32
-54
lines changed

test/common.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,3 @@ magick_compare() {
4040
fi
4141
}
4242

43-
# compat ("image" prefix dropped because GraphicsMagic is also used if
44-
# IM not found /and may be prefered later/)
45-
imagemagick_compare() {
46-
magick_compare "$@"
47-
}

test/regression/run_tests.sh

Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,24 @@ if [ ! -x "$GPUJPEG" ] && [ -x "$DIR/../../build/gpujpegtool" ]; then
66
GPUJPEG=$DIR/../../build/gpujpegtool
77
fi
88

9-
. "$DIR/../common.sh" # for imagemagick_compare
9+
. "$DIR/../common.sh" # for magick_compare
1010

1111
test_commit_b620be2() {
1212
$GPUJPEG -e -s 1920x1080 -r 1 -f 444-u8-p0p1p2 /dev/zero out.jpg
1313
$GPUJPEG -d out.jpg out.rgb
1414
SIZE=$(stat -c %s out.rgb)
1515
dd if=/dev/zero bs="$SIZE" count=1 of=in.rgb
16-
if ! imagemagick_compare out.rgb in.rgb "-depth 8 -size 1920x1080"
17-
then
18-
echo " black pattern doesn't match!" >&2
19-
exit 1
20-
fi
16+
magick_compare out.rgb in.rgb "-depth 8 -size 1920x1080"
2117

2218
$GPUJPEG -e -s 16x16 -r 1 -f u8 /dev/zero out.jpg
2319
$GPUJPEG -d out.jpg out.r
2420
SIZE=$(stat -c %s out.r)
2521
dd if=/dev/zero bs="$SIZE" count=1 of=in.r
26-
if ! imagemagick_compare gray:out.r gray:in.r "-depth 8 -size 16x16"
27-
then
28-
echo "grayscale pattern doesn't match!" >&2
29-
exit 1
30-
fi
22+
magick_compare gray:out.r gray:in.r "-depth 8 -size 16x16"
3123

3224
rm in.rgb in.r out.rgb out.r out.jpg
3325
}
3426

35-
# the single test actually covers both fixes
36-
test_fix_decode_outside_pinned_AND_fix_huff_buf_partially_not_cleared() {
37-
"$GPUJPEG" -e 392x386.p_u8.noise.tst out.jpg
38-
"$GPUJPEG" -d out.jpg out.pnm
39-
if ! imagemagick_compare out.jpg out.pnm
40-
then
41-
echo "pattern doesn't match!" >&2
42-
exit 1
43-
fi
44-
rm out.jpg out.pnm
45-
}
46-
4727
# commits e52abeab (increasing size) 791a9e6b (shrinking) crashes
4828
test_different_sizes() {
4929
param_enc=
@@ -66,12 +46,41 @@ test_different_sizes() {
6646
rm $files
6747
}
6848

49+
# the single test actually covers both fixes
50+
test_fix_decode_outside_pinned_AND_fix_huff_buf_partially_not_cleared() {
51+
"$GPUJPEG" -e 392x386.p_u8.noise.tst out.jpg
52+
"$GPUJPEG" -d out.jpg out.pnm
53+
magick_compare out.jpg out.pnm
54+
rm out.jpg out.pnm
55+
}
56+
6957
test_fix_postprocess_memcpy_pitch_20250305() {
7058
$GPUJPEG -e 1119x561.c_ycbcr-jpeg.p_422-u8-p0p1p2.tst ycbcr422.jpg
7159
$GPUJPEG -d -c ycbcr-jpeg ycbcr422.jpg out.y4m
7260
rm ycbcr422.jpg out.y4m
7361
}
7462

63+
# test the gray_image.jpg from TwelveMonkeys sample set that caused
64+
# problems (see Git history)
65+
test_gray_image() {
66+
filename=gray-sample.jpg
67+
68+
if [ ! -f "$filename" ]; then
69+
url="https://github.com/haraldk/TwelveMonkeys/blob/master/\
70+
imageio/imageio-jpeg/src/test/resources/jpeg/$filename?raw=true"
71+
if ! curl -LO "$url"; then
72+
echo "Cannot download the image $filename from $url"
73+
return
74+
fi
75+
fi
76+
77+
"$GPUJPEG" -d "$filename" out.pnm
78+
magick_compare "$filename" out.pnm
79+
80+
# keeping the $filename intentionally as a cache
81+
rm out.pnm
82+
}
83+
7584
# sanity test (gpujpeg should fail)
7685
test_nonexistent() {
7786
! $GPUJPEG -e nonexistent.pam fail.jpg
@@ -93,32 +102,6 @@ test_pam_pnm_y4m() {
93102
rm data.raw in.y4m out.jpg out.pam out.pnm out.y4m
94103
}
95104

96-
# test the gray_image.jpg from TwelveMonkeys sample set that caused
97-
# problems (see Git history)
98-
test_gray_image() {
99-
filename=gray-sample.jpg
100-
101-
if [ ! -f "$filename" ]; then
102-
url="https://github.com/haraldk/TwelveMonkeys/blob/master/\
103-
imageio/imageio-jpeg/src/test/resources/jpeg/$filename?raw=true"
104-
if ! curl -LO "$url"; then
105-
echo "Cannot download the image $filename from $url"
106-
return
107-
fi
108-
fi
109-
110-
"$GPUJPEG" -d "$filename" out.pnm
111-
112-
if ! imagemagick_compare "$filename" out.pnm
113-
then
114-
echo "$filename doesn't match!" >&2
115-
exit 1
116-
fi
117-
118-
# keeping the $filename intentionally as a cache
119-
rm out.pnm
120-
}
121-
122105
## This test ensures given compression quality preserved
123106
## measured with PSNR. The required PSNR values are set
124107
## to the currently received values (measured with GM 1.3.45)

0 commit comments

Comments
 (0)