Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: tools/pdf-comparison.sh

Issue 1921943006: tools/pdf-comparison.sh: stop relying on /usr/bin/timeout (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/pdf-comparison.sh
diff --git a/tools/pdf-comparison.sh b/tools/pdf-comparison.sh
index d4036a418c8c5f89d818b15d1717dbd3a8f007c3..69f96c980f92ebde47d57d382c713e2eedcb84cc 100755
--- a/tools/pdf-comparison.sh
+++ b/tools/pdf-comparison.sh
@@ -19,7 +19,7 @@ if ! [ "$1" ] || ! [ "$2" ]; then
fi
BAD=''
-for CMD in 'python' 'ninja' 'pdfium_test' 'timeout' 'skdiff'; do
+for CMD in 'python' 'ninja' 'pdfium_test' 'skdiff'; do
if ! command -v "$CMD" > /dev/null ; then
echo "could not find $CMD command in PATH." >&2
BAD=1
@@ -69,10 +69,25 @@ if [ -z "$DIFFS" ]; then
exit 0;
fi
+# Portable version of timeout from GNU coreutils.
+timeout_py() { python -c "$(cat <<EOF
+import sys, subprocess, threading
+proc = subprocess.Popen(sys.argv[2:])
+timer = threading.Timer(float(sys.argv[1]), proc.terminate)
+timer.start()
+proc.wait()
+timer.cancel()
+exit(proc.returncode)
+EOF
+)" "$@"; }
+
# rasterize the remaining PDFs
for pdf in "$CON_DIR"/*pdf "$EXP_DIR"/*pdf ; do
- # timeout is from GNU coreutils
- if timeout 10 pdfium_test --png "$pdf"; then
+ if timeout_py 10 pdfium_test --png "$pdf"; then
+ if ! [ -f "$pdf".*.png ] ; then
+ echo "Missing pdfium_test output: '$pdf.*.png'" >&2
+ exit 1
+ fi
rm "$pdf"
else
echo "pdfium_test '$pdf' failed."
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698