Browse Source

Added C# conformance tests.

The tests are run from Travis in the same way as on other
platforms. Currently some expected failures - but only expected
in that they're what we got to start with. Will try to fix them in
other pull requests.
Jon Skeet 10 năm trước cách đây
mục cha
commit
b6defa7c11
3 tập tin đã thay đổi với 41 bổ sung1 xóa
  1. 13 1
      conformance/Makefile.am
  2. 22 0
      conformance/failure_list_csharp.txt
  3. 6 0
      travis.sh

+ 13 - 1
conformance/Makefile.am

@@ -40,7 +40,7 @@ $(protoc_outputs): protoc_middleman
 
 BUILT_SOURCES = $(protoc_outputs)
 
-CLEANFILES = $(protoc_outputs) protoc_middleman javac_middleman conformance-java
+CLEANFILES = $(protoc_outputs) protoc_middleman javac_middleman conformance-java conformance-csharp
 
 MAINTAINERCLEANFILES =   \
   Makefile.in
@@ -55,6 +55,15 @@ conformance-java: javac_middleman
 	@echo 'java -classpath .:../java/target/classes ConformanceJava "$$@"' >> conformance-java
 	@chmod +x conformance-java
 
+# Currently the conformance code is alongside the rest of the C#
+# source, as it's easier to maintain there. We assume we've already
+# built that, so we just need a script to run it.
+conformance-csharp:
+	@echo "Writing shortcut script conformance-csharp..."
+	@echo '#! /bin/sh' > conformance-csharp
+	@echo 'mono ../csharp/src/Google.Protobuf.Conformance/bin/Release/Google.Protobuf.Conformance.exe "$$@"' >> conformance-csharp
+	@chmod +x conformance-csharp
+
 # Targets for actually running tests.
 test_cpp: protoc_middleman conformance-test-runner conformance-cpp
 	./conformance-test-runner --failure_list failure_list_cpp.txt ./conformance-cpp
@@ -62,5 +71,8 @@ test_cpp: protoc_middleman conformance-test-runner conformance-cpp
 test_java: protoc_middleman conformance-test-runner conformance-java
 	./conformance-test-runner ./conformance-java
 
+test_csharp: protoc_middleman conformance-test-runner conformance-csharp
+	./conformance-test-runner --failure_list failure_list_csharp.txt ./conformance-csharp
+
 test_ruby: protoc_middleman conformance-test-runner
 	RUBYLIB=../ruby/lib:. ./conformance-test-runner --failure_list failure_list_ruby.txt ./conformance_ruby.rb

+ 22 - 0
conformance/failure_list_csharp.txt

@@ -0,0 +1,22 @@
+ProtobufInput.PrematureEofBeforeUnknownValue.BOOL
+ProtobufInput.PrematureEofBeforeUnknownValue.BYTES
+ProtobufInput.PrematureEofBeforeUnknownValue.DOUBLE
+ProtobufInput.PrematureEofBeforeUnknownValue.ENUM
+ProtobufInput.PrematureEofBeforeUnknownValue.FIXED32
+ProtobufInput.PrematureEofBeforeUnknownValue.FIXED64
+ProtobufInput.PrematureEofBeforeUnknownValue.FLOAT
+ProtobufInput.PrematureEofBeforeUnknownValue.INT32
+ProtobufInput.PrematureEofBeforeUnknownValue.INT64
+ProtobufInput.PrematureEofBeforeUnknownValue.MESSAGE
+ProtobufInput.PrematureEofBeforeUnknownValue.SFIXED32
+ProtobufInput.PrematureEofBeforeUnknownValue.SFIXED64
+ProtobufInput.PrematureEofBeforeUnknownValue.SINT32
+ProtobufInput.PrematureEofBeforeUnknownValue.SINT64
+ProtobufInput.PrematureEofBeforeUnknownValue.STRING
+ProtobufInput.PrematureEofBeforeUnknownValue.UINT32
+ProtobufInput.PrematureEofBeforeUnknownValue.UINT64
+ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
+ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
+ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.BYTES
+ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.MESSAGE
+ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.STRING

+ 6 - 0
travis.sh

@@ -29,6 +29,11 @@ build_cpp_distcheck() {
 }
 
 build_csharp() {
+  # Just for the conformance tests. We don't currently
+  # need to really build protoc, but it's simplest to keep with the
+  # conventions of the other builds.
+  internal_build_cpp
+
   # Install latest version of Mono
   sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
   echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
@@ -39,6 +44,7 @@ build_csharp() {
 
   (cd csharp/src; mono ../../nuget.exe restore)
   csharp/buildall.sh
+  cd conformance && make test_csharp && cd ..
 }
 
 use_java() {