summaryrefslogtreecommitdiff
path: root/testing/tools/make_expected.sh
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-08-10 18:55:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-10 18:55:46 +0000
commit70cca3663a0ea6c290b55c290ba5eb1f1c9db572 (patch)
tree795a8448eb76b90320d46aca1808e6d64a6b3ae5 /testing/tools/make_expected.sh
parent6655d95a8586c1f272d5d418bb63514abbe1d695 (diff)
downloadpdfium-70cca3663a0ea6c290b55c290ba5eb1f1c9db572.tar.xz
Add proxy for syscall time
This CL adds a proxy, FXSYS_time, for the time syscall, so that a testing mechanism can be implemented. Specically there is now a flag for pdfium_test, --time=, that allows setting the time since the epoch that will be returned. This plumbed all the way down into the proxy and allows for stable results for tests that depend on getting the current time. There are other places in the code base that will need to be patched like this, that will be dealt with in follow on CLs. BUG=pdfium:1104 Change-Id: I2de185f8d47abe46704dd579c13a54948b7f81e0 Reviewed-on: https://pdfium-review.googlesource.com/39750 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'testing/tools/make_expected.sh')
-rwxr-xr-xtesting/tools/make_expected.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/testing/tools/make_expected.sh b/testing/tools/make_expected.sh
index a70df797c2..9b7e3d8716 100755
--- a/testing/tools/make_expected.sh
+++ b/testing/tools/make_expected.sh
@@ -6,6 +6,11 @@
#
# Script to generate expected result files.
+# Arbitrary timestamp, expressed in seconds since the epoch, used to make sure
+# that tests that depend on the current time are stable. Happens to be the
+# timestamp of the first commit to repo, 2014/5/9 17:48:50.
+TEST_SEED_TIME=1399672130
+
# Do this before "set -e" so "which" failing is not fatal.
PNGOPTIMIZER="$(which optipng)"
@@ -15,9 +20,9 @@ while (( "$#" )); do
echo $INFILE | grep -qs ' ' && echo space in filename detected && exit 1
EVTFILE="${INFILE%.*}.evt"
if [ -f "$EVTFILE" ]; then
- out/Debug/pdfium_test --send-events --png $INFILE
+ out/Debug/pdfium_test --send-events --time=$TEST_SEED_TIME --png $INFILE
else
- out/Debug/pdfium_test --png $INFILE
+ out/Debug/pdfium_test --time=$TEST_SEED_TIME --png $INFILE
fi
RESULTS="$INFILE.*.png"
for RESULT in $RESULTS ; do