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
8df69f08
Commit
8df69f08
authored
Mar 13, 2017
by
Josh Haberman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conformance test for JS now work, though 15 tests fail.
parent
f873d321
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
27 deletions
+49
-27
Makefile.am
conformance/Makefile.am
+14
-7
conformance_nodejs.js
conformance/conformance_nodejs.js
+20
-20
failure_list_js.txt
conformance/failure_list_js.txt
+15
-0
No files found.
conformance/Makefile.am
View file @
8df69f08
...
...
@@ -230,12 +230,19 @@ conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h google/protobu
endif
# JavaScript well-known types are expected to be in a directory called
# google-protobuf, because they are usually in the google-protobuf npm
# package. But we want to use the sources from our tree, so we recreate
# that directory structure here.
google-protobuf
:
mkdir
google-protobuf
if
USE_EXTERNAL_PROTOC
# Some implementations include pre-generated versions of well-known types.
protoc_middleman
:
$(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
$(PROTOC)
-I
$(srcdir)
-I
$(top_srcdir)
--cpp_out
=
.
--java_out
=
.
--ruby_out
=
.
--objc_out
=
.
--python_out
=
.
--php_out
=
.
--js_out
=
import_style
=
commonjs,binary:
.
$(conformance_protoc_inputs)
$(PROTOC)
-I
$(srcdir)
-I
$(top_srcdir)
--cpp_out
=
.
--java_out
=
.
--ruby_out
=
.
--python_out
=
.
--php_out
=
.
--js_out
=
import_style
=
commonjs,binary:
.
$(well_known_type_protoc_inputs)
protoc_middleman
:
$(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
google-protobuf
$(PROTOC)
-I
$(srcdir)
-I
$(top_srcdir)
--cpp_out
=
.
--java_out
=
.
--ruby_out
=
.
--objc_out
=
.
--python_out
=
.
--php_out
=
.
--js_out
=
import_style
=
commonjs,binary:
google-protobuf
$(conformance_protoc_inputs)
$(PROTOC)
-I
$(srcdir)
-I
$(top_srcdir)
--cpp_out
=
.
--java_out
=
.
--ruby_out
=
.
--python_out
=
.
--php_out
=
.
--js_out
=
import_style
=
commonjs,binary:
google-protobuf
$(well_known_type_protoc_inputs)
##
$(PROTOC)
-I
$(srcdir)
-I
$(top_srcdir)
--java_out
=
lite:lite
$(conformance_protoc_inputs)
$(well_known_type_protoc_inputs)
touch
protoc_middleman
...
...
@@ -244,9 +251,9 @@ else
# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is
# relative to srcdir, which may not be the same as the current directory when
# building out-of-tree.
protoc_middleman
:
$(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
oldpwd
=
`
pwd
`
&&
(
cd
$(srcdir)
&&
$$
oldpwd/../src/protoc
$(EXEEXT)
-I
.
-I
$(top_srcdir)
/src
--cpp_out
=
$$
oldpwd
--java_out
=
$$
oldpwd
--ruby_out
=
$$
oldpwd
--objc_out
=
$$
oldpwd
--python_out
=
$$
oldpwd
--php_out
=
$$
oldpwd
--js_out
=
import_style
=
commonjs,binary:
$$
oldpwd
$(conformance_protoc_inputs)
)
oldpwd
=
`
pwd
`
&&
(
cd
$(srcdir)
&&
$$
oldpwd/../src/protoc
$(EXEEXT)
-I
.
-I
$(top_srcdir)
/src
--cpp_out
=
$$
oldpwd
--java_out
=
$$
oldpwd
--ruby_out
=
$$
oldpwd
--python_out
=
$$
oldpwd
--php_out
=
$$
oldpwd
--js_out
=
import_style
=
commonjs,binary:
$$
oldpwd
$(well_known_type_protoc_inputs)
)
protoc_middleman
:
$(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
google-protobuf
oldpwd
=
`
pwd
`
&&
(
cd
$(srcdir)
&&
$$
oldpwd/../src/protoc
$(EXEEXT)
-I
.
-I
$(top_srcdir)
/src
--cpp_out
=
$$
oldpwd
--java_out
=
$$
oldpwd
--ruby_out
=
$$
oldpwd
--objc_out
=
$$
oldpwd
--python_out
=
$$
oldpwd
--php_out
=
$$
oldpwd
--js_out
=
import_style
=
commonjs,binary:
$$
oldpwd
/google-protobuf
$(conformance_protoc_inputs)
)
oldpwd
=
`
pwd
`
&&
(
cd
$(srcdir)
&&
$$
oldpwd/../src/protoc
$(EXEEXT)
-I
.
-I
$(top_srcdir)
/src
--cpp_out
=
$$
oldpwd
--java_out
=
$$
oldpwd
--ruby_out
=
$$
oldpwd
--python_out
=
$$
oldpwd
--php_out
=
$$
oldpwd
--js_out
=
import_style
=
commonjs,binary:
$$
oldpwd
/google-protobuf
$(well_known_type_protoc_inputs)
)
## @mkdir -p lite
## oldpwd=`pwd` &&
(
cd
$(srcdir)
&&
$$
oldpwd/../src/protoc
$(EXEEXT)
-I
.
-I
$(top_srcdir)
/src
--java_out
=
lite:
$$
oldpwd/lite
$(conformance_protoc_inputs)
$(well_known_type_protoc_inputs)
)
touch
protoc_middleman
...
...
@@ -336,7 +343,7 @@ test_python_cpp: protoc_middleman conformance-test-runner
./conformance-test-runner
--enforce_recommended
--failure_list
failure_list_python_cpp.txt ./conformance_python.py
test_nodejs
:
protoc_middleman conformance-test-runner
NODE_PATH
=
../js:. ./conformance-test-runner ./conformance_nodejs.js
NODE_PATH
=
../js:. ./conformance-test-runner
--enforce_recommended
--failure_list
failure_list_js.txt
./conformance_nodejs.js
if
OBJC_CONFORMANCE_TEST
...
...
conformance/conformance_nodejs.js
View file @
8df69f08
...
...
@@ -33,6 +33,7 @@
*/
var
conformance
=
require
(
'conformance_pb'
);
var
test_messages_proto3
=
require
(
'google/protobuf/test_messages_proto3_pb'
);
var
fs
=
require
(
'fs'
);
var
testCount
=
0
;
...
...
@@ -42,10 +43,15 @@ function doTest(request) {
var
response
=
new
conformance
.
ConformanceResponse
();
try
{
if
(
request
.
getRequestedOutputFormat
()
===
conformance
.
WireFormat
.
JSON
)
{
response
.
setSkipped
(
"JSON not supported."
);
return
response
;
}
switch
(
request
.
getPayloadCase
())
{
case
conformance
.
ConformanceRequest
.
PayloadCase
.
PROTOBUF_PAYLOAD
:
try
{
testMessage
=
conformance
.
TestAllTypes
.
deserializeBinary
(
testMessage
=
test_messages_proto3
.
TestAllTypes
.
deserializeBinary
(
request
.
getProtobufPayload
());
}
catch
(
err
)
{
response
.
setParseError
(
err
.
toString
());
...
...
@@ -62,14 +68,14 @@ function doTest(request) {
}
switch
(
request
.
getRequestedOutputFormat
())
{
case
conformance
.
UNSPECIFIED
:
case
conformance
.
WireFormat
.
UNSPECIFIED
:
response
.
setRuntimeError
(
"Unspecified output format"
);
return
response
;
case
conformance
.
PROTOBUF
:
case
conformance
.
WireFormat
.
PROTOBUF
:
response
.
setProtobufPayload
(
testMessage
.
serializeBinary
());
case
conformance
.
JSON
:
case
conformance
.
WireFormat
.
JSON
:
response
.
setSkipped
(
"JSON not supported."
);
return
response
;
...
...
@@ -80,7 +86,7 @@ function doTest(request) {
response
.
setRuntimeError
(
err
.
toString
());
}
return
response
return
response
;
}
function
onEof
(
totalRead
)
{
...
...
@@ -95,21 +101,22 @@ function onEof(totalRead) {
function
readBuffer
(
bytes
)
{
var
buf
=
new
Buffer
(
bytes
);
var
totalRead
=
0
;
//console.warn("Want to read: " + bytes);
while
(
totalRead
<
bytes
)
{
var
read
;
var
read
=
0
;
try
{
//console.warn("Trying to read: " + (bytes - totalRead));
read
=
fs
.
readSync
(
process
.
stdin
.
fd
,
buf
,
totalRead
,
bytes
-
totalRead
);
}
catch
(
e
)
{
if
(
e
.
code
==
'EOF'
)
{
return
onEof
(
totalRead
)
}
else
if
(
e
.
code
==
'EAGAIN'
)
{
}
else
{
throw
"conformance_nodejs: Error reading from stdin."
;
throw
"conformance_nodejs: Error reading from stdin."
+
e
;
}
}
if
(
read
===
0
)
{
return
onEof
(
totalRead
);
}
//console.warn("Read: " + read);
totalRead
+=
read
;
}
...
...
@@ -124,14 +131,6 @@ function writeBuffer(buffer) {
}
}
function
uint8ArrayToBuffer
(
arr
)
{
var
buffer
=
new
Buffer
(
arr
.
length
);
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
buffer
[
i
]
=
arr
[
i
];
}
return
buffer
;
}
// Returns true if the test ran successfully, false on legitimate EOF.
// If EOF is encountered in an unexpected place, raises IOError.
function
doTestIo
()
{
...
...
@@ -146,6 +145,7 @@ function doTestIo() {
throw
"conformance_nodejs: Failed to read request."
;
}
serializedRequest
=
new
Uint8Array
(
serializedRequest
);
var
request
=
conformance
.
ConformanceRequest
.
deserializeBinary
(
serializedRequest
);
var
response
=
doTest
(
request
);
...
...
@@ -155,7 +155,7 @@ function doTestIo() {
lengthBuf
=
new
Buffer
(
4
);
lengthBuf
.
writeInt32LE
(
serializedResponse
.
length
,
0
);
writeBuffer
(
lengthBuf
);
writeBuffer
(
uint8ArrayTo
Buffer
(
serializedResponse
));
writeBuffer
(
new
Buffer
(
serializedResponse
));
testCount
+=
1
...
...
@@ -164,7 +164,7 @@ function doTestIo() {
while
(
true
)
{
if
(
!
doTestIo
())
{
console
.
error
(
'conformance_
ruby
: received EOF from test runner '
+
console
.
error
(
'conformance_
nodejs
: received EOF from test runner '
+
"after "
+
testCount
+
" tests, exiting"
)
break
;
}
...
...
conformance/failure_list_js.txt
0 → 100644
View file @
8df69f08
Required.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput
Required.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.BOOL.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.DOUBLE.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.FIXED32.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.FIXED64.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.FLOAT.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.INT32.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.INT64.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.SFIXED32.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.SFIXED64.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.SINT32.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.SINT64.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.UINT32.ProtobufOutput
Required.ProtobufInput.ValidDataRepeated.UINT64.ProtobufOutput
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