Index: third_party/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh b/third_party/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh |
index 259d5d2124091ecbbef7cd10a1fb7971f422b650..3a024364dae675cbb5a0c4128e0847999394a34a 100755 |
--- a/third_party/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh |
+++ b/third_party/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh |
@@ -39,45 +39,51 @@ fail() { |
exit 1 |
} |
+TEST_TMPDIR=. |
+PROTOC=./protoc |
+ |
echo ' |
+ syntax = "proto2"; |
option java_multiple_files = true; |
option java_package = "test.jar"; |
option java_outer_classname = "Outer"; |
message Foo {} |
message Bar {} |
-' > testzip.proto |
+' > $TEST_TMPDIR/testzip.proto |
-./protoc --cpp_out=testzip.zip --python_out=testzip.zip --java_out=testzip.jar \ |
- testzip.proto || fail 'protoc failed.' |
+$PROTOC \ |
+ --cpp_out=$TEST_TMPDIR/testzip.zip --python_out=$TEST_TMPDIR/testzip.zip \ |
+ --java_out=$TEST_TMPDIR/testzip.jar -I$TEST_TMPDIR testzip.proto \ |
+ || fail 'protoc failed.' |
echo "Testing output to zip..." |
if unzip -h > /dev/null; then |
- unzip -t testzip.zip > testzip.list || fail 'unzip failed.' |
+ unzip -t $TEST_TMPDIR/testzip.zip > $TEST_TMPDIR/testzip.list || fail 'unzip failed.' |
- grep 'testing: testzip\.pb\.cc *OK$' testzip.list > /dev/null \ |
+ 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$' testzip.list > /dev/null \ |
+ 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$' testzip.list > /dev/null \ |
+ grep 'testing: testzip_pb2\.py *OK$' $TEST_TMPDIR/testzip.list > /dev/null \ |
|| fail 'testzip_pb2.py not found in output zip.' |
- grep -i 'manifest' testzip.list > /dev/null \ |
+ 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..." |
-if jar c testzip.proto > /dev/null; then |
- jar tf testzip.jar > 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.' |
- grep '^test/jar/Foo\.java$' testzip.list > /dev/null \ |
+ grep '^test/jar/Foo\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ |
|| fail 'Foo.java not found in output jar.' |
- grep '^test/jar/Bar\.java$' testzip.list > /dev/null \ |
+ grep '^test/jar/Bar\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ |
|| fail 'Bar.java not found in output jar.' |
- grep '^test/jar/Outer\.java$' testzip.list > /dev/null \ |
+ grep '^test/jar/Outer\.java$' $TEST_TMPDIR/testzip.list > /dev/null \ |
|| fail 'Outer.java not found in output jar.' |
- grep '^META-INF/MANIFEST\.MF$' testzip.list > /dev/null \ |
- || fail 'Manifest not ofund 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 |