Index: third_party/protobuf/src/google/protobuf/test_messages_proto3.proto |
diff --git a/third_party/protobuf/conformance/conformance.proto b/third_party/protobuf/src/google/protobuf/test_messages_proto3.proto |
similarity index 73% |
copy from third_party/protobuf/conformance/conformance.proto |
copy to third_party/protobuf/src/google/protobuf/test_messages_proto3.proto |
index fc96074ac8074ebfc5448c20fdc53f9650d65e6e..79230334d7268d97681e7605e9e9f32f204de020 100644 |
--- a/third_party/protobuf/conformance/conformance.proto |
+++ b/third_party/protobuf/src/google/protobuf/test_messages_proto3.proto |
@@ -27,10 +27,21 @@ |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+// |
+// Test schema for proto3 messages. This test schema is used by: |
+// |
+// - benchmarks |
+// - fuzz tests |
+// - conformance tests |
+// |
syntax = "proto3"; |
-package conformance; |
-option java_package = "com.google.protobuf.conformance"; |
+ |
+package protobuf_test_messages.proto3; |
+option java_package = "com.google.protobuf_test_messages.proto3"; |
+ |
+// This is the default, but we specify it here explicitly. |
+option optimize_for = SPEED; |
import "google/protobuf/any.proto"; |
import "google/protobuf/duration.proto"; |
@@ -39,84 +50,15 @@ import "google/protobuf/struct.proto"; |
import "google/protobuf/timestamp.proto"; |
import "google/protobuf/wrappers.proto"; |
-// This defines the conformance testing protocol. This protocol exists between |
-// the conformance test suite itself and the code being tested. For each test, |
-// the suite will send a ConformanceRequest message and expect a |
-// ConformanceResponse message. |
-// |
-// You can either run the tests in two different ways: |
-// |
-// 1. in-process (using the interface in conformance_test.h). |
-// |
-// 2. as a sub-process communicating over a pipe. Information about how to |
-// do this is in conformance_test_runner.cc. |
-// |
-// Pros/cons of the two approaches: |
-// |
-// - running as a sub-process is much simpler for languages other than C/C++. |
-// |
-// - running as a sub-process may be more tricky in unusual environments like |
-// iOS apps, where fork/stdin/stdout are not available. |
- |
-enum WireFormat { |
- UNSPECIFIED = 0; |
- PROTOBUF = 1; |
- JSON = 2; |
-} |
- |
-// Represents a single test case's input. The testee should: |
-// |
-// 1. parse this proto (which should always succeed) |
-// 2. parse the protobuf or JSON payload in "payload" (which may fail) |
-// 3. if the parse succeeded, serialize the message in the requested format. |
-message ConformanceRequest { |
- // The payload (whether protobuf of JSON) is always for a TestAllTypes proto |
- // (see below). |
- oneof payload { |
- bytes protobuf_payload = 1; |
- string json_payload = 2; |
- } |
- |
- // Which format should the testee serialize its message to? |
- WireFormat requested_output_format = 3; |
-} |
- |
-// Represents a single test case's output. |
-message ConformanceResponse { |
- oneof result { |
- // This string should be set to indicate parsing failed. The string can |
- // provide more information about the parse error if it is available. |
- // |
- // Setting this string does not necessarily mean the testee failed the |
- // test. Some of the test cases are intentionally invalid input. |
- string parse_error = 1; |
- |
- // If the input was successfully parsed but errors occurred when |
- // serializing it to the requested output format, set the error message in |
- // this field. |
- string serialize_error = 6; |
- |
- // This should be set if some other error occurred. This will always |
- // indicate that the test failed. The string can provide more information |
- // about the failure. |
- string runtime_error = 2; |
- |
- // If the input was successfully parsed and the requested output was |
- // protobuf, serialize it to protobuf and set it in this field. |
- bytes protobuf_payload = 3; |
- |
- // If the input was successfully parsed and the requested output was JSON, |
- // serialize to JSON and set it in this field. |
- string json_payload = 4; |
- |
- // For when the testee skipped the test, likely because a certain feature |
- // wasn't supported, like JSON input/output. |
- string skipped = 5; |
- } |
-} |
+option cc_enable_arenas = true; |
// This proto includes every type of field in both singular and repeated |
// forms. |
+// |
+// Also, crucially, all messages and enums in this file are eventually |
+// submessages of this message. So for example, a fuzz test of TestAllTypes |
+// could trigger bugs that occur in any message type in this file. We verify |
+// this stays true in a unit test. |
message TestAllTypes { |
message NestedMessage { |
int32 a = 1; |
@@ -210,6 +152,11 @@ message TestAllTypes { |
NestedMessage oneof_nested_message = 112; |
string oneof_string = 113; |
bytes oneof_bytes = 114; |
+ bool oneof_bool = 115; |
+ uint64 oneof_uint64 = 116; |
+ float oneof_float = 117; |
+ double oneof_double = 118; |
+ NestedEnum oneof_enum = 119; |
} |
// Well-known types |
@@ -248,6 +195,7 @@ message TestAllTypes { |
repeated google.protobuf.Value repeated_value = 316; |
// Test field-name-to-JSON-name convention. |
+ // (protobuf says names can be any valid C/C++ identifier.) |
int32 fieldname1 = 401; |
int32 field_name2 = 402; |
int32 _field_name3 = 403; |
@@ -260,6 +208,12 @@ message TestAllTypes { |
int32 Field_Name10 = 410; |
int32 FIELD_NAME11 = 411; |
int32 FIELD_name12 = 412; |
+ int32 __field_name13 = 413; |
+ int32 __Field_name14 = 414; |
+ int32 field__name15 = 415; |
+ int32 field__Name16 = 416; |
+ int32 field_name17__ = 417; |
+ int32 Field_name18__ = 418; |
} |
message ForeignMessage { |