Skip to content

Commit 9eccfef

Browse files
committed
review comments
1 parent bdec66a commit 9eccfef

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

tools/visual_regression.sh

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
# The optional argument allows you to compare a subset of the images
2323
# (only those with names starting with the specified prefix).
2424
#
25-
# Check build/images/diff/results.txt for results. This file is sorted
26-
# by PHASH difference (most different files on top.) The composite diff
27-
# images for failed tests (i.e., PHASH > 1.0) are stored in build/images/diff.
25+
# Check build/images/diff/results.txt for results. The composite diff
26+
# images for failed tests are stored in build/images/diff.
2827
#
2928

3029
# PNG viewer on OSX. Switch this to whatever your system uses.
@@ -36,10 +35,6 @@ LC_NUMERIC="en_US.UTF-8"
3635
# Check ImageMagick installation
3736
command -v convert >/dev/null 2>&1 || { echo >&2 "Error: ImageMagick not found."; exit 1; }
3837

39-
# Show images over this PHASH threshold. This is probably too low, but
40-
# a good first pass.
41-
THRESHOLD=0.01
42-
4338
# Directories. You might want to change BASE, if you're running from a
4439
# different working directory.
4540
BASE=.
@@ -110,7 +105,7 @@ if [ -n "$NPROC" ]; then
110105
nproc=$NPROC
111106
fi
112107

113-
echo "Running $totalImagesA tests with threshold $THRESHOLD (nproc=$nproc)..."
108+
echo "Running $totalImagesA tests (nproc=$nproc)..."
114109

115110
function ProgressBar {
116111
let _progress=(${1}*100/${2}*100)/100
@@ -142,14 +137,14 @@ function diff_image() {
142137
fi
143138

144139
# If the two files are byte-for-byte identical, skip the image comparison below.
145-
cmp -s $fileA $fileB && echo $name "0" >$diff.pass && return
140+
cmp -s $fileA $fileB && return
146141

147142
cp $fileA $diff-a.png
148143
cp $fileB $diff-b.png
149144

150145
# Store the composite diff image.
151146
# Add the result to results.text
152-
echo $name $hash >$diff.fail
147+
echo $name >$diff.fail
153148
# Threshold exceeded, save the diff and the original, current
154149
cp $diff-diff.png $DIFF/$name.png
155150
cp $diff-a.png $DIFF/$name'_'$ANAME.png
@@ -206,18 +201,15 @@ cat $BDIR/*.fail 1>$RESULTS.fail 2>/dev/null
206201
num_fails=`cat $RESULTS.fail | wc -l`
207202
rm -f $BDIR/*.fail
208203

209-
# Sort results by PHASH
210-
sort -r -n -k 2 $RESULTS.fail >$RESULTS
211-
sort -r -n -k 2 $BDIR/*.pass 1>>$RESULTS 2>/dev/null
204+
# Sort results
205+
sort $RESULTS.fail >$RESULTS
212206

213207
# The previous cleanup approach (rm -f) triggered the error: Argument list too long.
214-
find $BDIR -name '*-temp.pass' -type f -delete
215208
rm -f $RESULTS.fail
216209

217210
echo
218211
echo Results stored in $DIFF/results.txt
219-
echo All images with a difference over threshold, $THRESHOLD, are
220-
echo available in $DIFF, sorted by perceptual hash.
212+
echo All images with a difference, are available in $DIFF.
221213
echo
222214

223215
if [ "$num_warnings" -gt 0 ]

0 commit comments

Comments
 (0)