Source release 16.4.0
This commit is contained in:
@@ -40,12 +40,11 @@
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/util/type_resolver.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
|
||||
#include <google/protobuf/util/type_resolver.h>
|
||||
#include "conformance.pb.h"
|
||||
|
||||
namespace conformance {
|
||||
@@ -88,7 +87,13 @@ class ForkPipeRunner : public ConformanceTestRunner {
|
||||
static int Run(int argc, char *argv[],
|
||||
const std::vector<ConformanceTestSuite*>& suites);
|
||||
|
||||
ForkPipeRunner(const std::string &executable)
|
||||
ForkPipeRunner(const std::string& executable,
|
||||
const std::vector<std::string>& executable_args)
|
||||
: child_pid_(-1),
|
||||
executable_(executable),
|
||||
executable_args_(executable_args) {}
|
||||
|
||||
explicit ForkPipeRunner(const std::string& executable)
|
||||
: child_pid_(-1), executable_(executable) {}
|
||||
|
||||
virtual ~ForkPipeRunner() {}
|
||||
@@ -108,6 +113,7 @@ class ForkPipeRunner : public ConformanceTestRunner {
|
||||
int read_fd_;
|
||||
pid_t child_pid_;
|
||||
std::string executable_;
|
||||
const std::vector<std::string> executable_args_;
|
||||
std::string current_test_name_;
|
||||
};
|
||||
|
||||
@@ -162,9 +168,7 @@ class ConformanceTestSuite {
|
||||
|
||||
// Gets the flag name to the failure list file.
|
||||
// By default, this would return --failure_list
|
||||
string GetFailureListFlagName() {
|
||||
return failure_list_flag_name_;
|
||||
}
|
||||
std::string GetFailureListFlagName() { return failure_list_flag_name_; }
|
||||
|
||||
void SetFailureListFlagName(const std::string& failure_list_flag_name) {
|
||||
failure_list_flag_name_ = failure_list_flag_name;
|
||||
@@ -185,7 +189,7 @@ class ConformanceTestSuite {
|
||||
// Test cases are classified into a few categories:
|
||||
// REQUIRED: the test case must be passed for an implementation to be
|
||||
// interoperable with other implementations. For example, a
|
||||
// parser implementaiton must accept both packed and unpacked
|
||||
// parser implementation must accept both packed and unpacked
|
||||
// form of repeated primitive fields.
|
||||
// RECOMMENDED: the test case is not required for the implementation to
|
||||
// be interoperable with other implementations, but is
|
||||
@@ -201,18 +205,18 @@ class ConformanceTestSuite {
|
||||
|
||||
class ConformanceRequestSetting {
|
||||
public:
|
||||
ConformanceRequestSetting(
|
||||
ConformanceLevel level,
|
||||
conformance::WireFormat input_format,
|
||||
conformance::WireFormat output_format,
|
||||
conformance::TestCategory test_category,
|
||||
const Message& prototype_message,
|
||||
const string& test_name, const string& input);
|
||||
ConformanceRequestSetting(ConformanceLevel level,
|
||||
conformance::WireFormat input_format,
|
||||
conformance::WireFormat output_format,
|
||||
conformance::TestCategory test_category,
|
||||
const Message& prototype_message,
|
||||
const std::string& test_name,
|
||||
const std::string& input);
|
||||
virtual ~ConformanceRequestSetting() {}
|
||||
|
||||
Message* GetTestMessage() const;
|
||||
std::unique_ptr<Message> NewTestMessage() const;
|
||||
|
||||
string GetTestName() const;
|
||||
std::string GetTestName() const;
|
||||
|
||||
const conformance::ConformanceRequest& GetRequest() const {
|
||||
return request_;
|
||||
@@ -222,7 +226,7 @@ class ConformanceTestSuite {
|
||||
return level_;
|
||||
}
|
||||
|
||||
string ConformanceLevelToString(ConformanceLevel level) const;
|
||||
std::string ConformanceLevelToString(ConformanceLevel level) const;
|
||||
|
||||
void SetPrintUnknownFields(bool print_unknown_fields) {
|
||||
request_.set_print_unknown_fields(true);
|
||||
@@ -233,8 +237,9 @@ class ConformanceTestSuite {
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual string InputFormatString(conformance::WireFormat format) const;
|
||||
virtual string OutputFormatString(conformance::WireFormat format) const;
|
||||
virtual std::string InputFormatString(conformance::WireFormat format) const;
|
||||
virtual std::string OutputFormatString(
|
||||
conformance::WireFormat format) const;
|
||||
conformance::ConformanceRequest request_;
|
||||
|
||||
private:
|
||||
@@ -243,12 +248,12 @@ class ConformanceTestSuite {
|
||||
::conformance::WireFormat output_format_;
|
||||
const Message& prototype_message_;
|
||||
std::unique_ptr<Message> prototype_message_for_compare_;
|
||||
string test_name_;
|
||||
std::string test_name_;
|
||||
};
|
||||
|
||||
bool CheckSetEmpty(const std::set<string>& set_to_check,
|
||||
bool CheckSetEmpty(const std::set<std::string>& set_to_check,
|
||||
const std::string& write_to_file, const std::string& msg);
|
||||
string WireFormatToString(conformance::WireFormat wire_format);
|
||||
std::string WireFormatToString(conformance::WireFormat wire_format);
|
||||
|
||||
// Parse payload in the response to the given message. Returns true on
|
||||
// success.
|
||||
@@ -257,26 +262,25 @@ class ConformanceTestSuite {
|
||||
const ConformanceRequestSetting& setting,
|
||||
Message* test_message) = 0;
|
||||
|
||||
void VerifyResponse(
|
||||
const ConformanceRequestSetting& setting,
|
||||
const string& equivalent_wire_format,
|
||||
const conformance::ConformanceResponse& response,
|
||||
bool need_report_success);
|
||||
void VerifyResponse(const ConformanceRequestSetting& setting,
|
||||
const std::string& equivalent_wire_format,
|
||||
const conformance::ConformanceResponse& response,
|
||||
bool need_report_success, bool require_same_wire_format);
|
||||
|
||||
void ReportSuccess(const std::string& test_name);
|
||||
void ReportFailure(const string& test_name,
|
||||
ConformanceLevel level,
|
||||
void ReportFailure(const std::string& test_name, ConformanceLevel level,
|
||||
const conformance::ConformanceRequest& request,
|
||||
const conformance::ConformanceResponse& response,
|
||||
const char* fmt, ...);
|
||||
void ReportSkip(const string& test_name,
|
||||
void ReportSkip(const std::string& test_name,
|
||||
const conformance::ConformanceRequest& request,
|
||||
const conformance::ConformanceResponse& response);
|
||||
|
||||
void RunValidInputTest(const ConformanceRequestSetting& setting,
|
||||
const string& equivalent_text_format);
|
||||
const std::string& equivalent_text_format);
|
||||
void RunValidBinaryInputTest(const ConformanceRequestSetting& setting,
|
||||
const string& equivalent_wire_format);
|
||||
const std::string& equivalent_wire_format,
|
||||
bool require_same_wire_format = false);
|
||||
|
||||
void RunTest(const std::string& test_name,
|
||||
const conformance::ConformanceRequest& request,
|
||||
|
||||
Reference in New Issue
Block a user