summaryrefslogtreecommitdiff
path: root/testing/tools/make_expected.sh
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-26 14:42:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-26 14:42:35 +0000
commit789a227a635b13b782a38f0a38bcb35b099f12d8 (patch)
treef82d33eb96ba887bacb24909066d7e3f9c8675f0 /testing/tools/make_expected.sh
parent9b8b217e6f8f2ff03b09d6075e689804928c7b3c (diff)
downloadpdfium-789a227a635b13b782a38f0a38bcb35b099f12d8.tar.xz
Optionally optimize PNGs with optipng in make_expected.sh.
Change-Id: I10b1844052431fdb25d028eac39f45f481f32ba1 Reviewed-on: https://pdfium-review.googlesource.com/31351 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'testing/tools/make_expected.sh')
-rwxr-xr-xtesting/tools/make_expected.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/testing/tools/make_expected.sh b/testing/tools/make_expected.sh
index 3d4252f0d3..793c3f5b66 100755
--- a/testing/tools/make_expected.sh
+++ b/testing/tools/make_expected.sh
@@ -5,7 +5,10 @@
# found in the LICENSE file.
#
# Script to generate expected result files.
-#
+
+# Do this before "set -e" so "which" failing is not fatal.
+PNGOPTIMIZER="$(which optipng)"
+
set -e
while (( "$#" )); do
INFILE="$1"
@@ -15,6 +18,9 @@ while (( "$#" )); do
for RESULT in $RESULTS ; do
EXPECTED=`echo -n $RESULT | sed 's/[.]pdf[.]/_expected.pdf./'`
mv $RESULT $EXPECTED
+ if [ -n "$PNGOPTIMIZER" ]; then
+ "$PNGOPTIMIZER" $EXPECTED
+ fi
done
shift
done