aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/zip_output_unittest.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/zip_output_unittest.sh')
-rwxr-xr-xsrc/google/protobuf/compiler/zip_output_unittest.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/google/protobuf/compiler/zip_output_unittest.sh b/src/google/protobuf/compiler/zip_output_unittest.sh
index 6fc7136d..f8597912 100755
--- a/src/google/protobuf/compiler/zip_output_unittest.sh
+++ b/src/google/protobuf/compiler/zip_output_unittest.sh
@@ -41,6 +41,8 @@ fail() {
TEST_TMPDIR=.
PROTOC=./protoc
+JAR=jar
+UNZIP=unzip
echo '
syntax = "proto2";
@@ -57,8 +59,9 @@ $PROTOC \
|| fail 'protoc failed.'
echo "Testing output to zip..."
-if unzip -h > /dev/null; then
- unzip -t $TEST_TMPDIR/testzip.zip > $TEST_TMPDIR/testzip.list || fail 'unzip failed.'
+if $UNZIP -h > /dev/null; then
+ $UNZIP -t $TEST_TMPDIR/testzip.zip > $TEST_TMPDIR/testzip.list \
+ || fail 'unzip failed.'
grep 'testing: testzip\.pb\.cc *OK$' $TEST_TMPDIR/testzip.list > /dev/null \
|| fail 'testzip.pb.cc not found in output zip.'
@@ -73,8 +76,14 @@ else
fi
echo "Testing output to jar..."
-if jar c $TEST_TMPDIR/testzip.proto > /dev/null; then
- jar tf $TEST_TMPDIR/testzip.jar > $TEST_TMPDIR/testzip.list || fail 'jar failed.'
+if $JAR c $TEST_TMPDIR/testzip.proto > /dev/null; then
+ $JAR tf $TEST_TMPDIR/testzip.jar > $TEST_TMPDIR/testzip.list \
+ || fail 'jar failed.'
+
+ # Check that -interface.jar timestamps are normalized:
+ if [[ "$(TZ=UTC $JAR tvf $TEST_TMPDIR/testzip.jar)" != *'Tue Jan 01 00:00:00 UTC 1980'* ]]; then
+ fail 'Zip did not contain normalized timestamps'
+ fi
grep '^test/jar/Foo\.java$' $TEST_TMPDIR/testzip.list > /dev/null \
|| fail 'Foo.java not found in output jar.'