Commit a0cecfd3 authored by Feng Xiao's avatar Feng Xiao

Make conformance tests build for C++ and Java.

Change-Id: Ibb3fe6f919cc7ca0df91da5e1697ba33d259e433
parent 13e1279d
...@@ -17,9 +17,10 @@ other_language_protoc_outputs = \ ...@@ -17,9 +17,10 @@ other_language_protoc_outputs = \
bin_PROGRAMS = conformance-test-runner conformance-cpp bin_PROGRAMS = conformance-test-runner conformance-cpp
conformance_test_runner_LDADD = $(top_srcdir)/src/libprotobuf.la conformance_test_runner_LDADD = $(top_srcdir)/src/libprotobuf.la
conformance_test_runner_SOURCES = conformance_test.cc conformance_test_runner.cc conformance_test_runner_SOURCES = conformance_test.cc conformance_test_runner.cc \
third_party/jsoncpp/jsoncpp.cpp
nodist_conformance_test_runner_SOURCES = conformance.pb.cc nodist_conformance_test_runner_SOURCES = conformance.pb.cc
conformance_test_runner_CPPFLAGS = -I$(top_srcdir)/src conformance_test_runner_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)
# Explicit deps beacuse BUILT_SOURCES are only done before a "make all/check" # Explicit deps beacuse BUILT_SOURCES are only done before a "make all/check"
# so a direct "make test_cpp" could fail if parallel enough. # so a direct "make test_cpp" could fail if parallel enough.
conformance_test_runner-conformance_test.$(OBJEXT): conformance.pb.h conformance_test_runner-conformance_test.$(OBJEXT): conformance.pb.h
...@@ -63,7 +64,7 @@ else ...@@ -63,7 +64,7 @@ else
# relative to srcdir, which may not be the same as the current directory when # relative to srcdir, which may not be the same as the current directory when
# building out-of-tree. # building out-of-tree.
protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(protoc_inputs) protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(protoc_inputs)
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd $(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 $(protoc_inputs) )
touch protoc_middleman touch protoc_middleman
endif endif
...@@ -80,13 +81,13 @@ MAINTAINERCLEANFILES = \ ...@@ -80,13 +81,13 @@ MAINTAINERCLEANFILES = \
Makefile.in Makefile.in
javac_middleman: ConformanceJava.java protoc_middleman $(other_language_protoc_outputs) javac_middleman: ConformanceJava.java protoc_middleman $(other_language_protoc_outputs)
javac -classpath ../java/target/classes ConformanceJava.java com/google/protobuf/conformance/Conformance.java jar=`ls ../java/util/target/*.jar` && javac -classpath ../java/target/classes:$$jar ConformanceJava.java com/google/protobuf/conformance/Conformance.java
@touch javac_middleman @touch javac_middleman
conformance-java: javac_middleman conformance-java: javac_middleman
@echo "Writing shortcut script conformance-java..." @echo "Writing shortcut script conformance-java..."
@echo '#! /bin/sh' > conformance-java @echo '#! /bin/sh' > conformance-java
@echo 'java -classpath .:../java/target/classes ConformanceJava "$$@"' >> conformance-java @jar=`ls ../java/util/target/*.jar` && echo java -classpath .:../java/target/classes:$$jar ConformanceJava '$$@' >> conformance-java
@chmod +x conformance-java @chmod +x conformance-java
# Currently the conformance code is alongside the rest of the C# # Currently the conformance code is alongside the rest of the C#
...@@ -103,7 +104,7 @@ test_cpp: protoc_middleman conformance-test-runner conformance-cpp ...@@ -103,7 +104,7 @@ test_cpp: protoc_middleman conformance-test-runner conformance-cpp
./conformance-test-runner --failure_list failure_list_cpp.txt ./conformance-cpp ./conformance-test-runner --failure_list failure_list_cpp.txt ./conformance-cpp
test_java: protoc_middleman conformance-test-runner conformance-java test_java: protoc_middleman conformance-test-runner conformance-java
./conformance-test-runner ./conformance-java ./conformance-test-runner --failure_list failure_list_java.txt ./conformance-java
test_csharp: protoc_middleman conformance-test-runner conformance-csharp test_csharp: protoc_middleman conformance-test-runner conformance-csharp
./conformance-test-runner --failure_list failure_list_csharp.txt ./conformance-csharp ./conformance-test-runner --failure_list failure_list_csharp.txt ./conformance-csharp
......
...@@ -42,8 +42,7 @@ ...@@ -42,8 +42,7 @@
#include <google/protobuf/util/type_resolver_util.h> #include <google/protobuf/util/type_resolver_util.h>
#include <google/protobuf/wire_format_lite.h> #include <google/protobuf/wire_format_lite.h>
#include "third_party/jsoncpp/value.h" #include "third_party/jsoncpp/json.h"
#include "third_party/jsoncpp/reader.h"
using conformance::ConformanceRequest; using conformance::ConformanceRequest;
using conformance::ConformanceResponse; using conformance::ConformanceResponse;
......
...@@ -44,8 +44,7 @@ ...@@ -44,8 +44,7 @@
#include <google/protobuf/util/type_resolver.h> #include <google/protobuf/util/type_resolver.h>
#include <google/protobuf/wire_format_lite.h> #include <google/protobuf/wire_format_lite.h>
#include "third_party/jsoncpp/value.h" #include "third_party/jsoncpp/json.h"
#include "third_party/jsoncpp/reader.h"
namespace conformance { namespace conformance {
class ConformanceRequest; class ConformanceRequest;
......
This diff is collapsed.
This diff is collapsed.
...@@ -127,6 +127,14 @@ ...@@ -127,6 +127,14 @@
</instructions> </instructions>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<profiles> <profiles>
......
...@@ -186,7 +186,7 @@ bool ReadCodePoint(StringPiece str, int index, ...@@ -186,7 +186,7 @@ bool ReadCodePoint(StringPiece str, int index,
uint32 *cp, int* num_left, int *num_read) { uint32 *cp, int* num_left, int *num_read) {
if (*num_left == 0) { if (*num_left == 0) {
// Last read was complete. Start reading a new unicode code point. // Last read was complete. Start reading a new unicode code point.
*cp = str[index++]; *cp = static_cast<uint8>(str[index++]);
*num_read = 1; *num_read = 1;
// The length of the code point is determined from reading the first byte. // The length of the code point is determined from reading the first byte.
// //
...@@ -235,7 +235,7 @@ bool ReadCodePoint(StringPiece str, int index, ...@@ -235,7 +235,7 @@ bool ReadCodePoint(StringPiece str, int index,
*num_read = 0; *num_read = 0;
} }
while (*num_left > 0 && index < str.size()) { while (*num_left > 0 && index < str.size()) {
uint32 ch = str[index++]; uint32 ch = static_cast<uint8>(str[index++]);
--(*num_left); --(*num_left);
++(*num_read); ++(*num_read);
*cp = (*cp << 6) | (ch & 0x3f); *cp = (*cp << 6) | (ch & 0x3f);
......
...@@ -93,7 +93,7 @@ use_java() { ...@@ -93,7 +93,7 @@ use_java() {
build_java() { build_java() {
# Java build needs `protoc`. # Java build needs `protoc`.
internal_build_cpp internal_build_cpp
cd java && mvn test && cd .. cd java && mvn test && cd util && mvn test && mvn assembly:single && cd ../..
cd conformance && make test_java && cd .. cd conformance && make test_java && cd ..
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment