Generate C# conformance test in script

This is already generated code, but wasn't included in our generation script.
This change makes sure it will be up-to-date, and uses the now-conventional .pb.cs file extension.

This does *not* affect the conformance tests run from Bazel, as they generate the file separately and build the conformance tests using only Program.cs and the freshly-generated code.
However, the csharp/src/Google.Protobuf.Conformance/BUILD.bazel still needs to be kept up-to-date with the filename change.
pull/11880/head
Jon Skeet 2 years ago
parent d2c6d5efd4
commit 34bb22cc46
  1. 5
      csharp/generate_protos.sh
  2. 4
      csharp/src/Google.Protobuf.Conformance/BUILD.bazel
  3. 107
      csharp/src/Google.Protobuf.Conformance/Conformance.pb.cs

@ -79,3 +79,8 @@ $PROTOC -Isrc -I. \
$PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \ $PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \
--csharp_opt=file_extension=.pb.cs \ --csharp_opt=file_extension=.pb.cs \
examples/addressbook.proto examples/addressbook.proto
# Conformance tests
$PROTOC -I. --csharp_out=csharp/src/Google.Protobuf.Conformance \
--csharp_opt=file_extension=.pb.cs \
conformance/conformance.proto

@ -37,7 +37,7 @@ CONFORMANCE_DEPS = [
filegroup( filegroup(
name = "srcs", name = "srcs",
srcs = [ srcs = [
"Conformance.cs", "Conformance.pb.cs",
"Program.cs", "Program.cs",
"Google.Protobuf.Conformance.csproj", "Google.Protobuf.Conformance.csproj",
], ],
@ -88,7 +88,7 @@ pkg_files(
srcs = [ srcs = [
"BUILD.bazel", "BUILD.bazel",
"Google.Protobuf.Conformance.csproj", "Google.Protobuf.Conformance.csproj",
"Conformance.cs", "Conformance.pb.cs",
"Program.cs", "Program.cs",
], ],
strip_prefix = strip_prefix.from_root(""), strip_prefix = strip_prefix.from_root(""),

@ -1,6 +1,6 @@
// <auto-generated> // <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: conformance.proto // source: conformance/conformance.proto
// </auto-generated> // </auto-generated>
#pragma warning disable 1591, 0612, 3021, 8981 #pragma warning disable 1591, 0612, 3021, 8981
#region Designer generated code #region Designer generated code
@ -11,11 +11,11 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic; using scg = global::System.Collections.Generic;
namespace Conformance { namespace Conformance {
/// <summary>Holder for reflection information generated from conformance.proto</summary> /// <summary>Holder for reflection information generated from conformance/conformance.proto</summary>
public static partial class ConformanceReflection { public static partial class ConformanceReflection {
#region Descriptor #region Descriptor
/// <summary>File descriptor for conformance.proto</summary> /// <summary>File descriptor for conformance/conformance.proto</summary>
public static pbr::FileDescriptor Descriptor { public static pbr::FileDescriptor Descriptor {
get { return descriptor; } get { return descriptor; }
} }
@ -24,34 +24,35 @@ namespace Conformance {
static ConformanceReflection() { static ConformanceReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UiHQoKRmFpbHVyZVNl", "Ch1jb25mb3JtYW5jZS9jb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2Ui",
"dBIPCgdmYWlsdXJlGAEgAygJIuMCChJDb25mb3JtYW5jZVJlcXVlc3QSGgoQ", "HQoKRmFpbHVyZVNldBIPCgdmYWlsdXJlGAEgAygJIuMCChJDb25mb3JtYW5j",
"cHJvdG9idWZfcGF5bG9hZBgBIAEoDEgAEhYKDGpzb25fcGF5bG9hZBgCIAEo", "ZVJlcXVlc3QSGgoQcHJvdG9idWZfcGF5bG9hZBgBIAEoDEgAEhYKDGpzb25f",
"CUgAEhYKDGpzcGJfcGF5bG9hZBgHIAEoCUgAEhYKDHRleHRfcGF5bG9hZBgI", "cGF5bG9hZBgCIAEoCUgAEhYKDGpzcGJfcGF5bG9hZBgHIAEoCUgAEhYKDHRl",
"IAEoCUgAEjgKF3JlcXVlc3RlZF9vdXRwdXRfZm9ybWF0GAMgASgOMhcuY29u", "eHRfcGF5bG9hZBgIIAEoCUg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mdvb2dsZS5wcm90",
"b2J1Zi5jb25mb3JtYW5jZaICC0NvbmZvcm1hbmNlYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.FailureSet), global::Conformance.FailureSet.Parser, new[]{ "Failure" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.FailureSet), global::Conformance.FailureSet.Parser, new[]{ "Failure" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "JspbPayload", "TextPayload", "RequestedOutputFormat", "MessageType", "TestCategory", "JspbEncodingOptions", "PrintUnknownFields" }, new[]{ "Payload" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "JspbPayload", "TextPayload", "RequestedOutputFormat", "MessageType", "TestCategory", "JspbEncodingOptions", "PrintUnknownFields" }, new[]{ "Payload" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped", "JspbPayload", "TextPayload" }, new[]{ "Result" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "TimeoutError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped", "JspbPayload", "TextPayload" }, new[]{ "Result" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.JspbEncodingConfig), global::Conformance.JspbEncodingConfig.Parser, new[]{ "UseJspbArrayAnyFormat" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.JspbEncodingConfig), global::Conformance.JspbEncodingConfig.Parser, new[]{ "UseJspbArrayAnyFormat" }, null, null, null, null)
})); }));
} }
@ -89,7 +90,8 @@ namespace Conformance {
/// </summary> /// </summary>
[pbr::OriginalName("JSON_IGNORE_UNKNOWN_PARSING_TEST")] JsonIgnoreUnknownParsingTest = 3, [pbr::OriginalName("JSON_IGNORE_UNKNOWN_PARSING_TEST")] JsonIgnoreUnknownParsingTest = 3,
/// <summary> /// <summary>
/// Test jspb wire format. Only used inside Google. Opensource testees just skip it. /// Test jspb wire format. Only used inside Google. Opensource testees just
/// skip it.
/// </summary> /// </summary>
[pbr::OriginalName("JSPB_TEST")] JspbTest = 4, [pbr::OriginalName("JSPB_TEST")] JspbTest = 4,
/// <summary> /// <summary>
@ -382,7 +384,7 @@ namespace Conformance {
/// <summary>Field number for the "jspb_payload" field.</summary> /// <summary>Field number for the "jspb_payload" field.</summary>
public const int JspbPayloadFieldNumber = 7; public const int JspbPayloadFieldNumber = 7;
/// <summary> /// <summary>
/// Only used inside google. Opensource testees just skip it. /// Only used inside Google. Opensource testees just skip it.
/// </summary> /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
@ -443,8 +445,8 @@ namespace Conformance {
private global::Conformance.TestCategory testCategory_ = global::Conformance.TestCategory.UnspecifiedTest; private global::Conformance.TestCategory testCategory_ = global::Conformance.TestCategory.UnspecifiedTest;
/// <summary> /// <summary>
/// Each test is given a specific test category. Some category may need /// Each test is given a specific test category. Some category may need
/// specific support in testee programs. Refer to the definition of TestCategory /// specific support in testee programs. Refer to the definition of
/// for more information. /// TestCategory for more information.
/// </summary> /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
@ -892,6 +894,9 @@ namespace Conformance {
case ResultOneofCase.SerializeError: case ResultOneofCase.SerializeError:
SerializeError = other.SerializeError; SerializeError = other.SerializeError;
break; break;
case ResultOneofCase.TimeoutError:
TimeoutError = other.TimeoutError;
break;
case ResultOneofCase.RuntimeError: case ResultOneofCase.RuntimeError:
RuntimeError = other.RuntimeError; RuntimeError = other.RuntimeError;
break; break;
@ -957,6 +962,23 @@ namespace Conformance {
} }
} }
/// <summary>Field number for the "timeout_error" field.</summary>
public const int TimeoutErrorFieldNumber = 9;
/// <summary>
/// This should be set if the test program timed out. The string should
/// provide more information about what the child process was doing when it
/// was killed.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string TimeoutError {
get { return resultCase_ == ResultOneofCase.TimeoutError ? (string) result_ : ""; }
set {
result_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
resultCase_ = ResultOneofCase.TimeoutError;
}
}
/// <summary>Field number for the "runtime_error" field.</summary> /// <summary>Field number for the "runtime_error" field.</summary>
public const int RuntimeErrorFieldNumber = 2; public const int RuntimeErrorFieldNumber = 2;
/// <summary> /// <summary>
@ -1061,6 +1083,7 @@ namespace Conformance {
None = 0, None = 0,
ParseError = 1, ParseError = 1,
SerializeError = 6, SerializeError = 6,
TimeoutError = 9,
RuntimeError = 2, RuntimeError = 2,
ProtobufPayload = 3, ProtobufPayload = 3,
JsonPayload = 4, JsonPayload = 4,
@ -1099,6 +1122,7 @@ namespace Conformance {
} }
if (ParseError != other.ParseError) return false; if (ParseError != other.ParseError) return false;
if (SerializeError != other.SerializeError) return false; if (SerializeError != other.SerializeError) return false;
if (TimeoutError != other.TimeoutError) return false;
if (RuntimeError != other.RuntimeError) return false; if (RuntimeError != other.RuntimeError) return false;
if (ProtobufPayload != other.ProtobufPayload) return false; if (ProtobufPayload != other.ProtobufPayload) return false;
if (JsonPayload != other.JsonPayload) return false; if (JsonPayload != other.JsonPayload) return false;
@ -1115,6 +1139,7 @@ namespace Conformance {
int hash = 1; int hash = 1;
if (resultCase_ == ResultOneofCase.ParseError) hash ^= ParseError.GetHashCode(); if (resultCase_ == ResultOneofCase.ParseError) hash ^= ParseError.GetHashCode();
if (resultCase_ == ResultOneofCase.SerializeError) hash ^= SerializeError.GetHashCode(); if (resultCase_ == ResultOneofCase.SerializeError) hash ^= SerializeError.GetHashCode();
if (resultCase_ == ResultOneofCase.TimeoutError) hash ^= TimeoutError.GetHashCode();
if (resultCase_ == ResultOneofCase.RuntimeError) hash ^= RuntimeError.GetHashCode(); if (resultCase_ == ResultOneofCase.RuntimeError) hash ^= RuntimeError.GetHashCode();
if (resultCase_ == ResultOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode(); if (resultCase_ == ResultOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode();
if (resultCase_ == ResultOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode(); if (resultCase_ == ResultOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode();
@ -1172,6 +1197,10 @@ namespace Conformance {
output.WriteRawTag(66); output.WriteRawTag(66);
output.WriteString(TextPayload); output.WriteString(TextPayload);
} }
if (resultCase_ == ResultOneofCase.TimeoutError) {
output.WriteRawTag(74);
output.WriteString(TimeoutError);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
@ -1214,6 +1243,10 @@ namespace Conformance {
output.WriteRawTag(66); output.WriteRawTag(66);
output.WriteString(TextPayload); output.WriteString(TextPayload);
} }
if (resultCase_ == ResultOneofCase.TimeoutError) {
output.WriteRawTag(74);
output.WriteString(TimeoutError);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
@ -1230,6 +1263,9 @@ namespace Conformance {
if (resultCase_ == ResultOneofCase.SerializeError) { if (resultCase_ == ResultOneofCase.SerializeError) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(SerializeError); size += 1 + pb::CodedOutputStream.ComputeStringSize(SerializeError);
} }
if (resultCase_ == ResultOneofCase.TimeoutError) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(TimeoutError);
}
if (resultCase_ == ResultOneofCase.RuntimeError) { if (resultCase_ == ResultOneofCase.RuntimeError) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RuntimeError); size += 1 + pb::CodedOutputStream.ComputeStringSize(RuntimeError);
} }
@ -1267,6 +1303,9 @@ namespace Conformance {
case ResultOneofCase.SerializeError: case ResultOneofCase.SerializeError:
SerializeError = other.SerializeError; SerializeError = other.SerializeError;
break; break;
case ResultOneofCase.TimeoutError:
TimeoutError = other.TimeoutError;
break;
case ResultOneofCase.RuntimeError: case ResultOneofCase.RuntimeError:
RuntimeError = other.RuntimeError; RuntimeError = other.RuntimeError;
break; break;
@ -1334,6 +1373,10 @@ namespace Conformance {
TextPayload = input.ReadString(); TextPayload = input.ReadString();
break; break;
} }
case 74: {
TimeoutError = input.ReadString();
break;
}
} }
} }
#endif #endif
@ -1381,6 +1424,10 @@ namespace Conformance {
TextPayload = input.ReadString(); TextPayload = input.ReadString();
break; break;
} }
case 74: {
TimeoutError = input.ReadString();
break;
}
} }
} }
} }
Loading…
Cancel
Save