diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-07-24 17:17:57 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-07-24 17:17:57 -0700 |
commit | 02250a7ff439cdc6ba7b209c3e8d20950340b102 (patch) | |
tree | 625baa9eb93b40eb76dd419ae7d7a7114c77d8c6 /src/google | |
parent | 72cc5a6eb3975bbe3bc8454f053835d9e46dbcb5 (diff) | |
download | protobuf-02250a7ff439cdc6ba7b209c3e8d20950340b102.tar.gz protobuf-02250a7ff439cdc6ba7b209c3e8d20950340b102.tar.bz2 protobuf-02250a7ff439cdc6ba7b209c3e8d20950340b102.zip |
Omit the zip test if tools are not available
Diffstat (limited to 'src/google')
-rwxr-xr-x | src/google/protobuf/compiler/zip_output_unittest.sh | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/src/google/protobuf/compiler/zip_output_unittest.sh b/src/google/protobuf/compiler/zip_output_unittest.sh index 8cd80e38..f8597912 100755 --- a/src/google/protobuf/compiler/zip_output_unittest.sh +++ b/src/google/protobuf/compiler/zip_output_unittest.sh @@ -59,32 +59,42 @@ $PROTOC \ || fail 'protoc failed.' echo "Testing output to zip..." -$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.' -grep 'testing: testzip\.pb\.h *OK$' $TEST_TMPDIR/testzip.list > /dev/null \ - || fail 'testzip.pb.h not found in output zip.' -grep 'testing: testzip_pb2\.py *OK$' $TEST_TMPDIR/testzip.list > /dev/null \ - || fail 'testzip_pb2.py not found in output zip.' -grep -i 'manifest' $TEST_TMPDIR/testzip.list > /dev/null \ - && fail 'Zip file contained manifest.' + grep 'testing: testzip\.pb\.cc *OK$' $TEST_TMPDIR/testzip.list > /dev/null \ + || fail 'testzip.pb.cc not found in output zip.' + grep 'testing: testzip\.pb\.h *OK$' $TEST_TMPDIR/testzip.list > /dev/null \ + || fail 'testzip.pb.h not found in output zip.' + grep 'testing: testzip_pb2\.py *OK$' $TEST_TMPDIR/testzip.list > /dev/null \ + || fail 'testzip_pb2.py not found in output zip.' + grep -i 'manifest' $TEST_TMPDIR/testzip.list > /dev/null \ + && fail 'Zip file contained manifest.' +else + echo "Warning: 'unzip' command not available. Skipping test." +fi echo "Testing output to jar..." -$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 + # 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.' -grep '^test/jar/Bar\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ - || fail 'Bar.java not found in output jar.' -grep '^test/jar/Outer\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ - || fail 'Outer.java not found in output jar.' -grep '^META-INF/MANIFEST\.MF$' $TEST_TMPDIR/testzip.list > /dev/null \ - || fail 'Manifest not found in output jar.' + grep '^test/jar/Foo\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ + || fail 'Foo.java not found in output jar.' + grep '^test/jar/Bar\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ + || fail 'Bar.java not found in output jar.' + grep '^test/jar/Outer\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ + || fail 'Outer.java not found in output jar.' + grep '^META-INF/MANIFEST\.MF$' $TEST_TMPDIR/testzip.list > /dev/null \ + || fail 'Manifest not found in output jar.' +else + echo "Warning: 'jar' command not available. Skipping test." +fi echo PASS |