Skip to content

Commit 165477b

Browse files
committed
add test for previous commit
+ handle if first or second parameter to magick compare is not existing file
1 parent df3788e commit 165477b

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

test/common.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ magick_compare() {
1414

1515
requested_psnr=${4-$requested_psnr_dfl}
1616
# shellcheck disable=SC2086 # intentional
17-
psnr=$(compare -metric PSNR ${3-} "${1?}" "${2?}" null: 2>&1 |
18-
cut -d\ -f1 || true)
17+
if output=$(compare -metric PSNR ${3-} "${1?}" "${2?}" null: 2>&1)
18+
then :
19+
elif [ "$?" -ne 1 ]; then # RC 1 is also ok for IM compare
20+
echo "compare ERROR: $output"
21+
exit 1
22+
fi
23+
psnr=$(echo "$output" | cut -d\ -f1)
1924
echo IM PSNR: "$psnr (required $requested_psnr)"
2025
# TODO TOREMOVE if not needed (supposing it is IM bug, not feature)
2126
if expr "$psnr" : '[0-9][0-9.]*$' >/dev/null &&

test/regression/run_tests.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ test_random_psnr() {
150150
done
151151
}
152152

153+
test_cpu_huffman_reconf_df3788e87_20260320() {
154+
test_dir=testdata-test_cpu_huffman_reconf_df3788e87_20260320
155+
mkdir $test_dir && cd $test_dir
156+
"$GPUJPEG" -r 0 50x50.tst 50.jpg
157+
"$GPUJPEG" -r 0 60x60.tst 60.jpg
158+
"$GPUJPEG" -d 60.jpg 60.pnm 50.jpg 50.pnm
159+
magick_compare 50.jpg 50.pnm
160+
cd .. && rm $test_dir/* && rmdir $test_dir
161+
}
162+
163+
tests="
153164
test_commit_b620be2
154165
test_different_sizes
155166
test_fix_decode_outside_pinned_AND_fix_huff_buf_partially_not_cleared
@@ -159,4 +170,10 @@ test_nonexistent
159170
test_out_ext_XXX
160171
test_pam_pnm_y4m
161172
test_random_psnr
173+
test_cpu_huffman_reconf_df3788e87_20260320
174+
"
162175

176+
for n in $tests; do
177+
printf "\n\n\nRunning %s...\n" "$n"
178+
"$n"
179+
done

0 commit comments

Comments
 (0)