浏览代码

Removed test_name from conformance.proto.

Change-Id: I382dcda97fa123a6da4ff5faad5d7ece95853f33
Josh Haberman 10 年之前
父节点
当前提交
23bf3b566f
共有 4 个文件被更改,包括 15 次插入15 次删除
  1. 3 5
      conformance/conformance.proto
  2. 9 8
      conformance/conformance_test.cc
  3. 2 1
      conformance/conformance_test.h
  4. 1 1
      conformance/failure_list_cpp.txt

+ 3 - 5
conformance/conformance.proto

@@ -57,13 +57,11 @@ option java_package = "com.google.protobuf.conformance";
 //   2. parse the protobuf or JSON payload in "payload" (which may fail)
 //   2. parse the protobuf or JSON payload in "payload" (which may fail)
 //   3. if the parse succeeded, serialize the message in the requested format.
 //   3. if the parse succeeded, serialize the message in the requested format.
 message ConformanceRequest {
 message ConformanceRequest {
-  string test_name = 1;
-
   // The payload (whether protobuf of JSON) is always for a TestAllTypes proto
   // The payload (whether protobuf of JSON) is always for a TestAllTypes proto
   // (see below).
   // (see below).
   oneof payload {
   oneof payload {
-    bytes protobuf_payload = 2;
-    string json_payload = 3;
+    bytes protobuf_payload = 1;
+    string json_payload = 2;
   }
   }
 
 
   enum RequestedOutput {
   enum RequestedOutput {
@@ -73,7 +71,7 @@ message ConformanceRequest {
   }
   }
 
 
   // Which format should the testee serialize its message to?
   // Which format should the testee serialize its message to?
-  RequestedOutput requested_output = 4;
+  RequestedOutput requested_output = 3;
 }
 }
 
 
 // Represents a single test case's output.
 // Represents a single test case's output.

+ 9 - 8
conformance/conformance_test.cc

@@ -164,9 +164,9 @@ void ConformanceTestSuite::ReportSuccess(const string& test_name) {
 void ConformanceTestSuite::ReportFailure(const string& test_name,
 void ConformanceTestSuite::ReportFailure(const string& test_name,
                                          const char* fmt, ...) {
                                          const char* fmt, ...) {
   if (expected_to_fail_.erase(test_name) == 1) {
   if (expected_to_fail_.erase(test_name) == 1) {
-    StringAppendF(&output_, "FAILED AS EXPECTED: ");
+    StringAppendF(&output_, "FAILED AS EXPECTED, test=%s: ", test_name.c_str());
   } else {
   } else {
-    StringAppendF(&output_, "ERROR: ");
+    StringAppendF(&output_, "ERROR, test=%s: ", test_name.c_str());
     unexpected_failing_tests_.insert(test_name);
     unexpected_failing_tests_.insert(test_name);
   }
   }
   va_list args;
   va_list args;
@@ -176,10 +176,11 @@ void ConformanceTestSuite::ReportFailure(const string& test_name,
   failures_++;
   failures_++;
 }
 }
 
 
-void ConformanceTestSuite::RunTest(const ConformanceRequest& request,
+void ConformanceTestSuite::RunTest(const string& test_name,
+                                   const ConformanceRequest& request,
                                    ConformanceResponse* response) {
                                    ConformanceResponse* response) {
-  if (test_names_.insert(request.test_name()).second == false) {
-    GOOGLE_LOG(FATAL) << "Duplicated test name: " << request.test_name();
+  if (test_names_.insert(test_name).second == false) {
+    GOOGLE_LOG(FATAL) << "Duplicated test name: " << test_name;
   }
   }
 
 
   string serialized_request;
   string serialized_request;
@@ -194,7 +195,8 @@ void ConformanceTestSuite::RunTest(const ConformanceRequest& request,
   }
   }
 
 
   if (verbose_) {
   if (verbose_) {
-    StringAppendF(&output_, "conformance test: request=%s, response=%s\n",
+    StringAppendF(&output_, "conformance test: name=%s, request=%s, response=%s\n",
+                  test_name.c_str(),
                   request.ShortDebugString().c_str(),
                   request.ShortDebugString().c_str(),
                   response->ShortDebugString().c_str());
                   response->ShortDebugString().c_str());
   }
   }
@@ -205,14 +207,13 @@ void ConformanceTestSuite::ExpectParseFailureForProto(
     const string& proto, const string& test_name) {
     const string& proto, const string& test_name) {
   ConformanceRequest request;
   ConformanceRequest request;
   ConformanceResponse response;
   ConformanceResponse response;
-  request.set_test_name(test_name);
   request.set_protobuf_payload(proto);
   request.set_protobuf_payload(proto);
 
 
   // We don't expect output, but if the program erroneously accepts the protobuf
   // We don't expect output, but if the program erroneously accepts the protobuf
   // we let it send its response as this.  We must not leave it unspecified.
   // we let it send its response as this.  We must not leave it unspecified.
   request.set_requested_output(ConformanceRequest::PROTOBUF);
   request.set_requested_output(ConformanceRequest::PROTOBUF);
 
 
-  RunTest(request, &response);
+  RunTest(test_name, request, &response);
   if (response.result_case() == ConformanceResponse::kParseError) {
   if (response.result_case() == ConformanceResponse::kParseError) {
     ReportSuccess(test_name);
     ReportSuccess(test_name);
   } else {
   } else {

+ 2 - 1
conformance/conformance_test.h

@@ -99,7 +99,8 @@ class ConformanceTestSuite {
  private:
  private:
   void ReportSuccess(const std::string& test_name);
   void ReportSuccess(const std::string& test_name);
   void ReportFailure(const std::string& test_name, const char* fmt, ...);
   void ReportFailure(const std::string& test_name, const char* fmt, ...);
-  void RunTest(const conformance::ConformanceRequest& request,
+  void RunTest(const std::string& test_name,
+               const conformance::ConformanceRequest& request,
                conformance::ConformanceResponse* response);
                conformance::ConformanceResponse* response);
   void ExpectParseFailureForProto(const std::string& proto,
   void ExpectParseFailureForProto(const std::string& proto,
                                   const std::string& test_name);
                                   const std::string& test_name);

+ 1 - 1
conformance/failure_list_cpp.txt

@@ -5,7 +5,7 @@
 # that we don't introduce regressions in other tests.
 # that we don't introduce regressions in other tests.
 #
 #
 # TODO(haberman): insert links to corresponding bugs tracking the issue.
 # TODO(haberman): insert links to corresponding bugs tracking the issue.
-# Should we use GitHub issues or the Google-internal bug tracker.
+# Should we use GitHub issues or the Google-internal bug tracker?
 
 
 PrematureEofBeforeKnownRepeatedValue.MESSAGE
 PrematureEofBeforeKnownRepeatedValue.MESSAGE
 PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
 PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE