Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
ce441670
Commit
ce441670
authored
Jul 25, 2017
by
Jisi Liu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/3.4.x' into vb
parents
11b4d5ec
4ae94d69
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
23 deletions
+36
-23
encoder.py
python/google/protobuf/internal/encoder.py
+1
-1
message_test.py
python/google/protobuf/internal/message_test.py
+3
-0
zip_output_unittest.sh
src/google/protobuf/compiler/zip_output_unittest.sh
+32
-22
No files found.
python/google/protobuf/internal/encoder.py
View file @
ce441670
...
...
@@ -819,7 +819,7 @@ def MapEncoder(field_descriptor):
encode_message
=
MessageEncoder
(
field_descriptor
.
number
,
False
,
False
)
def
EncodeField
(
write
,
value
,
deterministic
):
value_keys
=
sorted
(
value
.
iterkeys
())
if
deterministic
else
value
.
iter
keys
()
value_keys
=
sorted
(
value
.
keys
())
if
deterministic
else
value
.
keys
()
for
key
in
value_keys
:
entry_msg
=
message_type
.
_concrete_class
(
key
=
key
,
value
=
value
[
key
])
encode_message
(
write
,
entry_msg
,
deterministic
)
...
...
python/google/protobuf/internal/message_test.py
View file @
ce441670
...
...
@@ -166,6 +166,9 @@ class MessageTest(BaseTestCase):
def
__nonzero__
(
self
):
raise
BadArgError
()
def
__bool__
(
self
):
raise
BadArgError
()
with
self
.
assertRaises
(
BadArgError
):
golden_message
.
SerializeToString
(
deterministic
=
BadArg
())
...
...
src/google/protobuf/compiler/zip_output_unittest.sh
View file @
ce441670
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment