Send full feature sets to plugins.

There are 4 different feature sets for every descriptor:
* Runtime/resolved - Used to make runtime decisions
* Source/resolved - Used to make codegen decisions
* Runtime/unresolved - Used to reason about the original proto file during runtime
* Source/unresolved - Used to validate features during codegen

Plugins will receive all 4 of these.  Unresolved features will show up in the `raw_features` fields nested inside `features`.  The runtime features will be in the `proto_file` field of the request, while the source features will be in the unstripped `source_file_descriptors` field.

PiperOrigin-RevId: 547925275
pull/13316/head
Mike Kruskal 2 years ago committed by Mike Kruskal
parent c5a1dbeb1e
commit f1de28a435
  1. 1
      src/google/protobuf/compiler/BUILD.bazel
  2. 41
      src/google/protobuf/compiler/command_line_interface.cc
  3. 22
      src/google/protobuf/compiler/command_line_interface.h
  4. 221
      src/google/protobuf/compiler/command_line_interface_unittest.cc
  5. 6
      src/google/protobuf/compiler/cpp/bootstrap_unittest.cc
  6. 10
      src/google/protobuf/compiler/cpp/generator_unittest.cc
  7. 4
      src/google/protobuf/compiler/cpp/unittest.cc
  8. 6
      src/google/protobuf/compiler/cpp/unittest.inc
  9. 2
      src/google/protobuf/compiler/java/message_serialization_unittest.cc
  10. 5
      src/google/protobuf/compiler/parser_unittest.cc
  11. 1
      src/google/protobuf/descriptor.h
  12. 4
      src/google/protobuf/extension_set_unittest.cc
  13. 2
      src/google/protobuf/io/zero_copy_stream_unittest.cc
  14. 2
      src/google/protobuf/json/json_test.cc
  15. 8
      src/google/protobuf/map_test.inc
  16. 4
      src/google/protobuf/message_unittest.inc
  17. 24
      src/google/protobuf/test_util2.h
  18. 4
      src/google/protobuf/text_format_unittest.cc

@ -295,6 +295,7 @@ cc_test(
":mock_code_generator", ":mock_code_generator",
"//:protobuf", "//:protobuf",
"//src/google/protobuf:cc_test_protos", "//src/google/protobuf:cc_test_protos",
"//src/google/protobuf:test_textproto",
"//src/google/protobuf:test_util2", "//src/google/protobuf:test_util2",
"//src/google/protobuf/compiler/cpp:names", "//src/google/protobuf/compiler/cpp:names",
"//src/google/protobuf/io", "//src/google/protobuf/io",

@ -302,27 +302,13 @@ std::string PluginName(absl::string_view plugin_prefix,
} }
// Get all transitive dependencies of the given file (including the file } // namespace
// itself), adding them to the given list of FileDescriptorProtos. The
// protos will be ordered such that every file is listed before any file that
// depends on it, so that you can call DescriptorPool::BuildFile() on them
// in order. Any files in *already_seen will not be added, and each file
// added will be inserted into *already_seen. If include_source_code_info is
// true then include the source code information in the FileDescriptorProtos.
// If include_json_name is true, populate the json_name field of
// FieldDescriptorProto for all fields.
struct TransitiveDependencyOptions {
bool include_json_name = false;
bool include_source_code_info = false;
bool retain_options = false;
};
void GetTransitiveDependencies( void CommandLineInterface::GetTransitiveDependencies(
const FileDescriptor* file, const FileDescriptor* file,
absl::flat_hash_set<const FileDescriptor*>* already_seen, absl::flat_hash_set<const FileDescriptor*>* already_seen,
RepeatedPtrField<FileDescriptorProto>* output, RepeatedPtrField<FileDescriptorProto>* output,
const TransitiveDependencyOptions& options = const TransitiveDependencyOptions& options) {
TransitiveDependencyOptions()) {
if (!already_seen->insert(file).second) { if (!already_seen->insert(file).second) {
// Already saw this file. Skip. // Already saw this file. Skip.
return; return;
@ -336,22 +322,19 @@ void GetTransitiveDependencies(
// Add this file. // Add this file.
FileDescriptorProto* new_descriptor = output->Add(); FileDescriptorProto* new_descriptor = output->Add();
if (options.retain_options) { *new_descriptor =
file->CopyTo(new_descriptor); google::protobuf::internal::InternalFeatureHelper::GetGeneratorProto(*file);
if (options.include_source_code_info) { if (options.include_source_code_info) {
file->CopySourceCodeInfoTo(new_descriptor); file->CopySourceCodeInfoTo(new_descriptor);
} }
} else { if (!options.retain_options) {
*new_descriptor = StripSourceRetentionOptions(*file->pool(), *new_descriptor);
StripSourceRetentionOptions(*file, options.include_source_code_info);
} }
if (options.include_json_name) { if (options.include_json_name) {
file->CopyJsonNameTo(new_descriptor); file->CopyJsonNameTo(new_descriptor);
} }
} }
} // namespace
// A MultiFileErrorCollector that prints errors to stderr. // A MultiFileErrorCollector that prints errors to stderr.
class CommandLineInterface::ErrorPrinter class CommandLineInterface::ErrorPrinter
: public MultiFileErrorCollector, : public MultiFileErrorCollector,
@ -2629,9 +2612,11 @@ bool CommandLineInterface::GeneratePluginOutput(
if (files_to_generate.contains(file_proto.name())) { if (files_to_generate.contains(file_proto.name())) {
const FileDescriptor* file = pool->FindFileByName(file_proto.name()); const FileDescriptor* file = pool->FindFileByName(file_proto.name());
*request.add_source_file_descriptors() = std::move(file_proto); *request.add_source_file_descriptors() = std::move(file_proto);
file_proto = StripSourceRetentionOptions(*file); file_proto =
google::protobuf::internal::InternalFeatureHelper::GetGeneratorProto(*file);
file->CopySourceCodeInfoTo(&file_proto); file->CopySourceCodeInfoTo(&file_proto);
file->CopyJsonNameTo(&file_proto); file->CopyJsonNameTo(&file_proto);
StripSourceRetentionOptions(*file->pool(), file_proto);
} }
} }

@ -73,6 +73,12 @@ class CodeGenerator; // code_generator.h
class GeneratorContext; // code_generator.h class GeneratorContext; // code_generator.h
class DiskSourceTree; // importer.h class DiskSourceTree; // importer.h
struct TransitiveDependencyOptions {
bool include_json_name = false;
bool include_source_code_info = false;
bool retain_options = false;
};
// This class implements the command-line interface to the protocol compiler. // This class implements the command-line interface to the protocol compiler.
// It is designed to make it very easy to create a custom protocol compiler // It is designed to make it very easy to create a custom protocol compiler
// supporting the languages of your choice. For example, if you wanted to // supporting the languages of your choice. For example, if you wanted to
@ -325,6 +331,22 @@ class PROTOC_EXPORT CommandLineInterface {
// listed as free numbers in the output. // listed as free numbers in the output.
void PrintFreeFieldNumbers(const Descriptor* descriptor); void PrintFreeFieldNumbers(const Descriptor* descriptor);
// Get all transitive dependencies of the given file (including the file
// itself), adding them to the given list of FileDescriptorProtos. The
// protos will be ordered such that every file is listed before any file that
// depends on it, so that you can call DescriptorPool::BuildFile() on them
// in order. Any files in *already_seen will not be added, and each file
// added will be inserted into *already_seen. If include_source_code_info
// (from TransitiveDependencyOptions) is true then include the source code
// information in the FileDescriptorProtos. If include_json_name is true,
// populate the json_name field of FieldDescriptorProto for all fields.
void GetTransitiveDependencies(
const FileDescriptor* file,
absl::flat_hash_set<const FileDescriptor*>* already_seen,
RepeatedPtrField<FileDescriptorProto>* output,
const TransitiveDependencyOptions& options =
TransitiveDependencyOptions());
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// The name of the executable as invoked (i.e. argv[0]). // The name of the executable as invoked (i.e. argv[0]).

@ -43,6 +43,7 @@
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "google/protobuf/compiler/command_line_interface_tester.h" #include "google/protobuf/compiler/command_line_interface_tester.h"
#include "google/protobuf/unittest_features.pb.h"
#ifndef _MSC_VER #ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
@ -67,6 +68,7 @@
#include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/compiler/plugin.pb.h"
#include "google/protobuf/compiler/subprocess.h" #include "google/protobuf/compiler/subprocess.h"
#include "google/protobuf/io/io_win32.h" #include "google/protobuf/io/io_win32.h"
#include "google/protobuf/test_textproto.h"
#include "google/protobuf/test_util2.h" #include "google/protobuf/test_util2.h"
#include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest.pb.h"
#include "google/protobuf/unittest_custom_options.pb.h" #include "google/protobuf/unittest_custom_options.pb.h"
@ -439,7 +441,7 @@ TEST_F(CommandLineInterfaceTest, Plugin_OptionRetention) {
std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH; std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH;
#else #else
std::string plugin_path = absl::StrCat( std::string plugin_path = absl::StrCat(
TestUtil::TestSourceDir(), "/third_party/protobuf/compiler/fake_plugin"); TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin");
#endif #endif
// Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest // Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest
@ -510,7 +512,7 @@ TEST_F(CommandLineInterfaceTest, Plugin_SourceFileDescriptors) {
std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH; std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH;
#else #else
std::string plugin_path = absl::StrCat( std::string plugin_path = absl::StrCat(
TestUtil::TestSourceDir(), "/third_party/protobuf/compiler/fake_plugin"); TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin");
#endif #endif
// Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest // Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest
@ -1384,13 +1386,13 @@ TEST_F(CommandLineInterfaceTest, FeaturesEditionZero) {
} }
TEST_F(CommandLineInterfaceTest, FeatureExtensions) { TEST_F(CommandLineInterfaceTest, FeatureExtensions) {
CreateTempFile("net/proto2/proto/descriptor.proto", CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("features.proto", CreateTempFile("features.proto",
R"schema( R"schema(
syntax = "proto2"; syntax = "proto2";
package pb; package pb;
import "net/proto2/proto/descriptor.proto"; import "google/protobuf/descriptor.proto";
extend google.protobuf.FeatureSet { extend google.protobuf.FeatureSet {
optional TestFeatures test = 9999; optional TestFeatures test = 9999;
} }
@ -1449,13 +1451,13 @@ TEST_F(CommandLineInterfaceTest, FeatureTargetError) {
} }
TEST_F(CommandLineInterfaceTest, FeatureExtensionError) { TEST_F(CommandLineInterfaceTest, FeatureExtensionError) {
CreateTempFile("net/proto2/proto/descriptor.proto", CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("features.proto", CreateTempFile("features.proto",
R"schema( R"schema(
syntax = "proto2"; syntax = "proto2";
package pb; package pb;
import "net/proto2/proto/descriptor.proto"; import "google/protobuf/descriptor.proto";
extend google.protobuf.FeatureSet { extend google.protobuf.FeatureSet {
optional TestFeatures test = 9999; optional TestFeatures test = 9999;
} }
@ -1482,6 +1484,165 @@ TEST_F(CommandLineInterfaceTest, FeatureExtensionError) {
"repeated field"); "repeated field");
} }
TEST_F(CommandLineInterfaceTest, Plugin_LegacyFeatures) {
CreateTempFile("foo.proto",
R"schema(
syntax = "proto2";
package foo;
message Foo {
optional int32 b = 1;
})schema");
#ifdef GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH
std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH;
#else
std::string plugin_path = absl::StrCat(
TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin");
#endif
// Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest
// sent by protoc.
Run(absl::StrCat(
"protocol_compiler --fake_plugin_out=$tmpdir --proto_path=$tmpdir "
"foo.proto --plugin=prefix-gen-fake_plugin=",
plugin_path));
ExpectNoErrors();
std::string base64_output = ReadFile("foo.proto.request");
std::string binary_request;
ASSERT_TRUE(absl::Base64Unescape(base64_output, &binary_request));
CodeGeneratorRequest request;
ASSERT_TRUE(request.ParseFromString(binary_request));
EXPECT_FALSE(
request.proto_file(0).message_type(0).field(0).options().has_features());
EXPECT_FALSE(request.source_file_descriptors(0)
.message_type(0)
.field(0)
.options()
.has_features());
}
TEST_F(CommandLineInterfaceTest, Plugin_RuntimeFeatures) {
CreateTempFile("foo.proto",
R"schema(
edition = "2023";
package foo;
message Foo {
int32 b = 1 [features.field_presence = IMPLICIT];
})schema");
#ifdef GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH
std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH;
#else
std::string plugin_path = absl::StrCat(
TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin");
#endif
// Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest
// sent by protoc.
Run(
absl::StrCat("protocol_compiler --experimental_editions "
"--fake_plugin_out=$tmpdir --proto_path=$tmpdir "
"foo.proto --plugin=prefix-gen-fake_plugin=",
plugin_path));
ExpectNoErrors();
std::string base64_output = ReadFile("foo.proto.request");
std::string binary_request;
ASSERT_TRUE(absl::Base64Unescape(base64_output, &binary_request));
CodeGeneratorRequest request;
ASSERT_TRUE(request.ParseFromString(binary_request));
EXPECT_THAT(
request.proto_file(0).message_type(0).field(0).options().features(),
EqualsProto(R"pb(field_presence: IMPLICIT
enum_type: OPEN
repeated_field_encoding: PACKED
string_field_validation: MANDATORY
message_encoding: LENGTH_PREFIXED
json_format: ALLOW
raw_features { field_presence: IMPLICIT }
)pb"));
EXPECT_THAT(request.source_file_descriptors(0)
.message_type(0)
.field(0)
.options()
.features(),
EqualsProto(R"pb(field_presence: IMPLICIT
enum_type: OPEN
repeated_field_encoding: PACKED
string_field_validation: MANDATORY
message_encoding: LENGTH_PREFIXED
json_format: ALLOW
raw_features { field_presence: IMPLICIT }
)pb"));
}
TEST_F(CommandLineInterfaceTest, Plugin_SourceFeatures) {
CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("google/protobuf/unittest_features.proto",
pb::TestFeatures::descriptor()->file()->DebugString());
CreateTempFile("foo.proto",
R"schema(
edition = "2023";
import "google/protobuf/unittest_features.proto";
package foo;
message Foo {
int32 b = 1 [
features.(pb.test).int_field_feature = 99,
features.(pb.test).int_source_feature = 87
];
}
)schema");
#ifdef GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH
std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH;
#else
std::string plugin_path = absl::StrCat(
TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin");
#endif
// Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest
// sent by protoc.
Run(
absl::StrCat("protocol_compiler --experimental_editions "
"--fake_plugin_out=$tmpdir --proto_path=$tmpdir "
"foo.proto --plugin=prefix-gen-fake_plugin=",
plugin_path));
ExpectNoErrors();
std::string base64_output = ReadFile("foo.proto.request");
std::string binary_request;
ASSERT_TRUE(absl::Base64Unescape(base64_output, &binary_request));
CodeGeneratorRequest request;
ASSERT_TRUE(request.ParseFromString(binary_request));
{
ASSERT_EQ(request.proto_file(2).name(), "foo.proto");
const FeatureSet& features =
request.proto_file(2).message_type(0).field(0).options().features();
EXPECT_THAT(features.raw_features(),
EqualsProto(R"pb([pb.test] { int_field_feature: 99 })pb"));
EXPECT_FALSE(features.GetExtension(pb::test).has_int_source_feature());
EXPECT_EQ(features.GetExtension(pb::test).int_field_feature(), 99);
}
{
ASSERT_EQ(request.source_file_descriptors(0).name(), "foo.proto");
const FeatureSet& features = request.source_file_descriptors(0)
.message_type(0)
.field(0)
.options()
.features();
EXPECT_THAT(features.raw_features(),
EqualsProto(R"pb([pb.test] {
int_field_feature: 99
int_source_feature: 87
})pb"));
EXPECT_EQ(features.GetExtension(pb::test).int_field_feature(), 99);
EXPECT_EQ(features.GetExtension(pb::test).int_source_feature(), 87);
}
}
#endif // PROTOBUF_FUTURE_EDITIONS #endif // PROTOBUF_FUTURE_EDITIONS
@ -2766,13 +2927,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcement) {
// The target option on a field indicates what kind of entity it may apply to // The target option on a field indicates what kind of entity it may apply to
// when it is used as an option. This test verifies that the enforcement // when it is used as an option. This test verifies that the enforcement
// works correctly on all entity types. // works correctly on all entity types.
CreateTempFile("net/proto2/proto/descriptor.proto", CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
syntax = "proto2"; syntax = "proto2";
package protobuf_unittest; package protobuf_unittest;
import "net/proto2/proto/descriptor.proto"; import "google/protobuf/descriptor.proto";
message MyOptions { message MyOptions {
optional string file_option = 1 [targets = TARGET_TYPE_FILE]; optional string file_option = 1 [targets = TARGET_TYPE_FILE];
optional string extension_range_option = 2 [targets = optional string extension_range_option = 2 [targets =
@ -2866,13 +3027,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcement) {
} }
TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsValid) { TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsValid) {
CreateTempFile("net/proto2/proto/descriptor.proto", CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
syntax = "proto2"; syntax = "proto2";
package protobuf_unittest; package protobuf_unittest;
import "net/proto2/proto/descriptor.proto"; import "google/protobuf/descriptor.proto";
message MyOptions { message MyOptions {
optional string message_or_file_option = 1 [ optional string message_or_file_option = 1 [
targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FILE]; targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FILE];
@ -2894,13 +3055,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsValid) {
} }
TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsInvalid) { TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsInvalid) {
CreateTempFile("net/proto2/proto/descriptor.proto", CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
syntax = "proto2"; syntax = "proto2";
package protobuf_unittest; package protobuf_unittest;
import "net/proto2/proto/descriptor.proto"; import "google/protobuf/descriptor.proto";
message MyOptions { message MyOptions {
optional string message_or_file_option = 1 [ optional string message_or_file_option = 1 [
targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FILE]; targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FILE];
@ -2922,13 +3083,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsInvalid) {
TEST_F(CommandLineInterfaceTest, TEST_F(CommandLineInterfaceTest,
TargetTypeEnforcementMultipleEdgesWithConstraintsValid) { TargetTypeEnforcementMultipleEdgesWithConstraintsValid) {
CreateTempFile("net/proto2/proto/descriptor.proto", CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
syntax = "proto2"; syntax = "proto2";
package protobuf_unittest; package protobuf_unittest;
import "net/proto2/proto/descriptor.proto"; import "google/protobuf/descriptor.proto";
message A { message A {
optional B b = 1 [targets = TARGET_TYPE_FILE, optional B b = 1 [targets = TARGET_TYPE_FILE,
targets = TARGET_TYPE_ENUM]; targets = TARGET_TYPE_ENUM];
@ -2949,13 +3110,13 @@ TEST_F(CommandLineInterfaceTest,
TEST_F(CommandLineInterfaceTest, TEST_F(CommandLineInterfaceTest,
TargetTypeEnforcementMultipleEdgesWithConstraintsInvalid) { TargetTypeEnforcementMultipleEdgesWithConstraintsInvalid) {
CreateTempFile("net/proto2/proto/descriptor.proto", CreateTempFile("google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
syntax = "proto2"; syntax = "proto2";
package protobuf_unittest; package protobuf_unittest;
import "net/proto2/proto/descriptor.proto"; import "google/protobuf/descriptor.proto";
message A { message A {
optional B b = 1 [targets = TARGET_TYPE_ENUM]; optional B b = 1 [targets = TARGET_TYPE_ENUM];
} }
@ -3129,28 +3290,27 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
TEST_P(EncodeDecodeTest, Encode) { TEST_P(EncodeDecodeTest, Encode) {
RedirectStdinFromFile(TestUtil::GetTestDataPath( RedirectStdinFromFile(TestUtil::GetTestDataPath(
"third_party/protobuf/" "google/protobuf/"
"testdata/text_format_unittest_data_oneof_implemented.txt")); "testdata/text_format_unittest_data_oneof_implemented.txt"));
std::string args; std::string args;
if (GetParam() != DESCRIPTOR_SET_IN) { if (GetParam() != DESCRIPTOR_SET_IN) {
args.append( args.append("google/protobuf/unittest.proto");
TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto"));
} }
EXPECT_TRUE( EXPECT_TRUE(
Run(absl::StrCat(args, " --encode=protobuf_unittest.TestAllTypes"))); Run(absl::StrCat(args, " --encode=protobuf_unittest.TestAllTypes")));
ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath(
"third_party/protobuf/testdata/golden_message_oneof_implemented")); "google/protobuf/testdata/golden_message_oneof_implemented"));
ExpectStderrMatchesText(""); ExpectStderrMatchesText("");
} }
TEST_P(EncodeDecodeTest, Decode) { TEST_P(EncodeDecodeTest, Decode) {
RedirectStdinFromFile(TestUtil::GetTestDataPath( RedirectStdinFromFile(TestUtil::GetTestDataPath(
"third_party/protobuf/testdata/golden_message_oneof_implemented")); "google/protobuf/testdata/golden_message_oneof_implemented"));
EXPECT_TRUE( EXPECT_TRUE(
Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + Run("google/protobuf/unittest.proto"
" --decode=protobuf_unittest.TestAllTypes")); " --decode=protobuf_unittest.TestAllTypes"));
ExpectStdoutMatchesTextFile(TestUtil::GetTestDataPath( ExpectStdoutMatchesTextFile(TestUtil::GetTestDataPath(
"third_party/protobuf/" "google/protobuf/"
"testdata/text_format_unittest_data_oneof_implemented.txt")); "testdata/text_format_unittest_data_oneof_implemented.txt"));
ExpectStderrMatchesText(""); ExpectStderrMatchesText("");
} }
@ -3158,7 +3318,7 @@ TEST_P(EncodeDecodeTest, Decode) {
TEST_P(EncodeDecodeTest, Partial) { TEST_P(EncodeDecodeTest, Partial) {
RedirectStdinFromText(""); RedirectStdinFromText("");
EXPECT_TRUE( EXPECT_TRUE(
Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + Run("google/protobuf/unittest.proto"
" --encode=protobuf_unittest.TestRequired")); " --encode=protobuf_unittest.TestRequired"));
ExpectStdoutMatchesText(""); ExpectStdoutMatchesText("");
ExpectStderrMatchesText( ExpectStderrMatchesText(
@ -3182,7 +3342,7 @@ TEST_P(EncodeDecodeTest, DecodeRaw) {
TEST_P(EncodeDecodeTest, UnknownType) { TEST_P(EncodeDecodeTest, UnknownType) {
EXPECT_FALSE( EXPECT_FALSE(
Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + Run("google/protobuf/unittest.proto"
" --encode=NoSuchType")); " --encode=NoSuchType"));
ExpectStdoutMatchesText(""); ExpectStdoutMatchesText("");
ExpectStderrMatchesText("Type not defined: NoSuchType\n"); ExpectStderrMatchesText("Type not defined: NoSuchType\n");
@ -3199,25 +3359,24 @@ TEST_P(EncodeDecodeTest, ProtoParseError) {
TEST_P(EncodeDecodeTest, EncodeDeterministicOutput) { TEST_P(EncodeDecodeTest, EncodeDeterministicOutput) {
RedirectStdinFromFile(TestUtil::GetTestDataPath( RedirectStdinFromFile(TestUtil::GetTestDataPath(
"third_party/protobuf/" "google/protobuf/"
"testdata/text_format_unittest_data_oneof_implemented.txt")); "testdata/text_format_unittest_data_oneof_implemented.txt"));
std::string args; std::string args;
if (GetParam() != DESCRIPTOR_SET_IN) { if (GetParam() != DESCRIPTOR_SET_IN) {
args.append( args.append("google/protobuf/unittest.proto");
TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto"));
} }
EXPECT_TRUE(Run(absl::StrCat( EXPECT_TRUE(Run(absl::StrCat(
args, " --encode=protobuf_unittest.TestAllTypes --deterministic_output"))); args, " --encode=protobuf_unittest.TestAllTypes --deterministic_output")));
ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath(
"third_party/protobuf/testdata/golden_message_oneof_implemented")); "google/protobuf/testdata/golden_message_oneof_implemented"));
ExpectStderrMatchesText(""); ExpectStderrMatchesText("");
} }
TEST_P(EncodeDecodeTest, DecodeDeterministicOutput) { TEST_P(EncodeDecodeTest, DecodeDeterministicOutput) {
RedirectStdinFromFile(TestUtil::GetTestDataPath( RedirectStdinFromFile(TestUtil::GetTestDataPath(
"third_party/protobuf/testdata/golden_message_oneof_implemented")); "google/protobuf/testdata/golden_message_oneof_implemented"));
EXPECT_FALSE( EXPECT_FALSE(
Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + Run("google/protobuf/unittest.proto"
" --decode=protobuf_unittest.TestAllTypes --deterministic_output")); " --decode=protobuf_unittest.TestAllTypes --deterministic_output"));
ExpectStderrMatchesText( ExpectStderrMatchesText(
"Can only use --deterministic_output with --encode.\n"); "Can only use --deterministic_output with --encode.\n");

@ -32,7 +32,7 @@
// Based on original Protocol Buffers design by // Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others. // Sanjay Ghemawat, Jeff Dean, and others.
// //
// This test insures that net/proto2/proto/descriptor.pb.{h,cc} match exactly // This test insures that google/protobuf/descriptor.pb.{h,cc} match exactly
// what would be generated by the protocol compiler. These files are not // what would be generated by the protocol compiler. These files are not
// generated automatically at build time because they are compiled into the // generated automatically at build time because they are compiled into the
// protocol compiler itself. So, if they were auto-generated, you'd have a // protocol compiler itself. So, if they were auto-generated, you'd have a
@ -144,9 +144,9 @@ TEST(BootstrapTest, GeneratedFilesMatch) {
// of the data to compare to. // of the data to compare to.
absl::flat_hash_map<absl::string_view, std::string> vpath_map; absl::flat_hash_map<absl::string_view, std::string> vpath_map;
absl::flat_hash_map<absl::string_view, std::string> rpath_map; absl::flat_hash_map<absl::string_view, std::string> rpath_map;
rpath_map["third_party/protobuf/test_messages_proto2"] = rpath_map["google/protobuf/test_messages_proto2"] =
"net/proto2/z_generated_example/test_messages_proto2"; "net/proto2/z_generated_example/test_messages_proto2";
rpath_map["third_party/protobuf/test_messages_proto3"] = rpath_map["google/protobuf/test_messages_proto3"] =
"net/proto2/z_generated_example/test_messages_proto3"; "net/proto2/z_generated_example/test_messages_proto3";
rpath_map["net/proto2/internal/proto2_weak"] = rpath_map["net/proto2/internal/proto2_weak"] =
"net/proto2/z_generated_example/proto2_weak"; "net/proto2/z_generated_example/proto2_weak";

@ -56,7 +56,7 @@ class CppGeneratorTest : public CommandLineInterfaceTester {
"google/protobuf/descriptor.proto", "google/protobuf/descriptor.proto",
google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); google::protobuf::DescriptorProto::descriptor()->file()->DebugString());
#ifdef PROTOBUF_FUTURE_EDITIONS #ifdef PROTOBUF_FUTURE_EDITIONS
CreateTempFile("third_party/protobuf/cpp_features.proto", CreateTempFile("google/protobuf/cpp_features.proto",
pb::CppFeatures::descriptor()->file()->DebugString()); pb::CppFeatures::descriptor()->file()->DebugString());
#endif // PROTOBUF_FUTURE_EDITIONS #endif // PROTOBUF_FUTURE_EDITIONS
} }
@ -97,7 +97,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumOnNonEnumField) {
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
edition = "2023"; edition = "2023";
import "third_party/protobuf/cpp_features.proto"; import "google/protobuf/cpp_features.proto";
message Foo { message Foo {
int32 bar = 1 [features.(pb.cpp).legacy_closed_enum = true]; int32 bar = 1 [features.(pb.cpp).legacy_closed_enum = true];
@ -116,7 +116,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnum) {
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
edition = "2023"; edition = "2023";
import "third_party/protobuf/cpp_features.proto"; import "google/protobuf/cpp_features.proto";
enum TestEnum { enum TestEnum {
TEST_ENUM_UNKNOWN = 0; TEST_ENUM_UNKNOWN = 0;
@ -136,7 +136,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumInherited) {
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
edition = "2023"; edition = "2023";
import "third_party/protobuf/cpp_features.proto"; import "google/protobuf/cpp_features.proto";
option features.(pb.cpp).legacy_closed_enum = true; option features.(pb.cpp).legacy_closed_enum = true;
enum TestEnum { enum TestEnum {
@ -158,7 +158,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumImplicit) {
CreateTempFile("foo.proto", CreateTempFile("foo.proto",
R"schema( R"schema(
edition = "2023"; edition = "2023";
import "third_party/protobuf/cpp_features.proto"; import "google/protobuf/cpp_features.proto";
option features.(pb.cpp).legacy_closed_enum = true; option features.(pb.cpp).legacy_closed_enum = true;
enum TestEnum { enum TestEnum {

@ -33,7 +33,7 @@
// Sanjay Ghemawat, Jeff Dean, and others. // Sanjay Ghemawat, Jeff Dean, and others.
// //
// To test the code generator, we actually use it to generate code for // To test the code generator, we actually use it to generate code for
// third_party/protobuf/unittest.proto, then test that. This means that we // google/protobuf/unittest.proto, then test that. This means that we
// are actually testing the parser and other parts of the system at the same // are actually testing the parser and other parts of the system at the same
// time, and that problems in the generator may show up as compile-time errors // time, and that problems in the generator may show up as compile-time errors
// rather than unittest failures, which may be surprising. However, testing // rather than unittest failures, which may be surprising. However, testing
@ -59,7 +59,7 @@
#define HELPERS_TEST_NAME HelpersTest #define HELPERS_TEST_NAME HelpersTest
#define DESCRIPTOR_INIT_TEST_NAME DescriptorInitializationTest #define DESCRIPTOR_INIT_TEST_NAME DescriptorInitializationTest
#define UNITTEST_PROTO_PATH "third_party/protobuf/unittest.proto" #define UNITTEST_PROTO_PATH "google/protobuf/unittest.proto"
#define UNITTEST ::protobuf_unittest #define UNITTEST ::protobuf_unittest
#define UNITTEST_IMPORT ::protobuf_unittest_import #define UNITTEST_IMPORT ::protobuf_unittest_import

@ -34,7 +34,7 @@
// Sanjay Ghemawat, Jeff Dean, and others. // Sanjay Ghemawat, Jeff Dean, and others.
// //
// To test the code generator, we actually use it to generate code for // To test the code generator, we actually use it to generate code for
// third_party/protobuf/unittest.proto, then test that. This means that we // google/protobuf/unittest.proto, then test that. This means that we
// are actually testing the parser and other parts of the system at the same // are actually testing the parser and other parts of the system at the same
// time, and that problems in the generator may show up as compile-time errors // time, and that problems in the generator may show up as compile-time errors
// rather than unittest failures, which may be surprising. However, testing // rather than unittest failures, which may be surprising. However, testing
@ -124,7 +124,7 @@ TEST(GENERATED_DESCRIPTOR_TEST_NAME, IdenticalDescriptors) {
// Import (parse) unittest.proto. // Import (parse) unittest.proto.
const FileDescriptor* parsed_descriptor = const FileDescriptor* parsed_descriptor =
importer.Import(TestUtil::MaybeTranslatePath(UNITTEST_PROTO_PATH)); importer.Import(UNITTEST_PROTO_PATH);
EXPECT_EQ("", error_collector.text_); EXPECT_EQ("", error_collector.text_);
ASSERT_TRUE(parsed_descriptor != nullptr); ASSERT_TRUE(parsed_descriptor != nullptr);
@ -2217,7 +2217,7 @@ TEST(DESCRIPTOR_INIT_TEST_NAME, Initialized) {
EXPECT_EQ(should_have_descriptors, EXPECT_EQ(should_have_descriptors,
DescriptorPool::generated_pool()->InternalIsFileLoaded( DescriptorPool::generated_pool()->InternalIsFileLoaded(
TestUtil::MaybeTranslatePath(UNITTEST_PROTO_PATH))); UNITTEST_PROTO_PATH));
} }
} // namespace cpp_unittest } // namespace cpp_unittest

@ -63,7 +63,7 @@ int CompileJavaProto(std::string proto_file_name) {
std::string proto_path = absl::StrCat( std::string proto_path = absl::StrCat(
"--proto_path=", "--proto_path=",
TestUtil::GetTestDataPath("third_party/protobuf/compiler/java")); TestUtil::GetTestDataPath("google/protobuf/compiler/java"));
std::string java_out = absl::StrCat("--java_out=", TestTempDir()); std::string java_out = absl::StrCat("--java_out=", TestTempDir());
const char* argv[] = { const char* argv[] = {

@ -2318,7 +2318,7 @@ TEST_F(ParserValidationErrorTest, ResovledUndefinedOptionError) {
// base2.proto: // base2.proto:
// package baz // package baz
// import net/proto2/proto/descriptor.proto // import google/protobuf/descriptor.proto
// message Bar { optional int32 foo = 1; } // message Bar { optional int32 foo = 1; }
// extend FileOptions { optional Bar bar = 7672757; } // extend FileOptions { optional Bar bar = 7672757; }
FileDescriptorProto other_file; FileDescriptorProto other_file;
@ -2461,8 +2461,7 @@ TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) {
// We now have a FileDescriptorProto, but to compare with the expected we // We now have a FileDescriptorProto, but to compare with the expected we
// need to link to a FileDecriptor, then output back to a proto. We'll // need to link to a FileDecriptor, then output back to a proto. We'll
// also need to give it the same name as the original. // also need to give it the same name as the original.
parsed.set_name( parsed.set_name("google/protobuf/unittest.proto");
TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto"));
// We need the imported dependency before we can build our parsed proto // We need the imported dependency before we can build our parsed proto
const FileDescriptor* public_import = const FileDescriptor* public_import =
protobuf_unittest_import::PublicImportMessage::descriptor()->file(); protobuf_unittest_import::PublicImportMessage::descriptor()->file();

@ -271,6 +271,7 @@ class PROTOBUF_EXPORT InternalFeatureHelper {
private: private:
friend class ::google::protobuf::compiler::CodeGenerator; friend class ::google::protobuf::compiler::CodeGenerator;
friend class ::google::protobuf::compiler::CommandLineInterface;
// Provides a restricted view exclusively to code generators. Raw features // Provides a restricted view exclusively to code generators. Raw features
// haven't been resolved, and are virtually meaningless to everyone else. Code // haven't been resolved, and are virtually meaningless to everyone else. Code

@ -65,7 +65,7 @@ namespace {
using ::google::protobuf::internal::DownCast; using ::google::protobuf::internal::DownCast;
using TestUtil::EqualsToSerialized; using TestUtil::EqualsToSerialized;
// This test closely mirrors third_party/protobuf/compiler/cpp/unittest.cc // This test closely mirrors google/protobuf/compiler/cpp/unittest.cc
// except that it uses extensions rather than regular fields. // except that it uses extensions rather than regular fields.
TEST(ExtensionSetTest, Defaults) { TEST(ExtensionSetTest, Defaults) {
@ -1368,7 +1368,7 @@ TEST(ExtensionSetTest, Proto3PackedDynamicExtensions) {
google::protobuf::FileDescriptorProto file_descriptor_proto; google::protobuf::FileDescriptorProto file_descriptor_proto;
file_descriptor_proto.set_syntax("proto3"); file_descriptor_proto.set_syntax("proto3");
file_descriptor_proto.set_name( file_descriptor_proto.set_name(
"third_party/protobuf/unittest_proto3_packed_extension.proto"); "google/protobuf/unittest_proto3_packed_extension.proto");
file_descriptor_proto.set_package("proto3_unittest"); file_descriptor_proto.set_package("proto3_unittest");
file_descriptor_proto.add_dependency( file_descriptor_proto.add_dependency(
DescriptorProto::descriptor()->file()->name()); DescriptorProto::descriptor()->file()->name());

@ -582,7 +582,7 @@ TEST_F(IoTest, CompressionOptions) {
// Some ad-hoc testing of compression options. // Some ad-hoc testing of compression options.
std::string golden_filename = std::string golden_filename =
TestUtil::GetTestDataPath("third_party/protobuf/testdata/golden_message"); TestUtil::GetTestDataPath("google/protobuf/testdata/golden_message");
std::string golden; std::string golden;
ABSL_CHECK_OK(File::GetContents(golden_filename, &golden, true)); ABSL_CHECK_OK(File::GetContents(golden_filename, &golden, true));

@ -1165,7 +1165,7 @@ TEST_P(JsonTest, TestDuration) {
EXPECT_THAT(ToJson(m5->value()), IsOkAndHolds("\"0.500s\"")); EXPECT_THAT(ToJson(m5->value()), IsOkAndHolds("\"0.500s\""));
} }
// These tests are not exhaustive; tests in //third_party/protobuf/conformance // These tests are not exhaustive; tests in //google/protobuf/conformance
// are more comprehensive. // are more comprehensive.
TEST_P(JsonTest, TestTimestamp) { TEST_P(JsonTest, TestTimestamp) {
auto m = ToProto<proto3::TestTimestamp>(R"json( auto m = ToProto<proto3::TestTimestamp>(R"json(

@ -3968,7 +3968,7 @@ TEST(MapSerializationTest, DeterministicSubmessage) {
std::string golden; std::string golden;
ABSL_CHECK_OK( ABSL_CHECK_OK(
File::GetContents(TestUtil::GetTestDataPath(absl::StrCat( File::GetContents(TestUtil::GetTestDataPath(absl::StrCat(
"third_party/protobuf/testdata/", filename)), "google/protobuf/testdata/", filename)),
&golden, true)); &golden, true));
t.ParseFromString(golden); t.ParseFromString(golden);
*(p.mutable_m()) = t; *(p.mutable_m()) = t;
@ -4010,7 +4010,7 @@ TEST(TextFormatMapTest, DynamicMessage) {
std::string expected_text; std::string expected_text;
ABSL_CHECK_OK( ABSL_CHECK_OK(
File::GetContents(TestUtil::GetTestDataPath("third_party/protobuf/" File::GetContents(TestUtil::GetTestDataPath("google/protobuf/"
"testdata/map_test_data.txt"), "testdata/map_test_data.txt"),
&expected_text, true)); &expected_text, true));
@ -4026,7 +4026,7 @@ TEST(TextFormatMapTest, Sorted) {
std::string expected_text; std::string expected_text;
ABSL_CHECK_OK( ABSL_CHECK_OK(
File::GetContents(TestUtil::GetTestDataPath("third_party/protobuf/" File::GetContents(TestUtil::GetTestDataPath("google/protobuf/"
"testdata/map_test_data.txt"), "testdata/map_test_data.txt"),
&expected_text, true)); &expected_text, true));
@ -4047,7 +4047,7 @@ TEST(TextFormatMapTest, ParseCorruptedString) {
std::string serialized_message; std::string serialized_message;
ABSL_CHECK_OK(File::GetContents( ABSL_CHECK_OK(File::GetContents(
TestUtil::GetTestDataPath( TestUtil::GetTestDataPath(
"third_party/protobuf/testdata/golden_message_maps"), "google/protobuf/testdata/golden_message_maps"),
&serialized_message, true)); &serialized_message, true));
UNITTEST::TestMaps message; UNITTEST::TestMaps message;
ABSL_CHECK(message.ParseFromString(serialized_message)); ABSL_CHECK(message.ParseFromString(serialized_message));

@ -132,7 +132,7 @@ TEST(MESSAGE_TEST_NAME, SerializeToBrokenOstream) {
TEST(MESSAGE_TEST_NAME, ParseFromFileDescriptor) { TEST(MESSAGE_TEST_NAME, ParseFromFileDescriptor) {
std::string filename = std::string filename =
TestUtil::GetTestDataPath("third_party/protobuf/testdata/golden_message"); TestUtil::GetTestDataPath("google/protobuf/testdata/golden_message");
int file = open(filename.c_str(), O_RDONLY | O_BINARY); int file = open(filename.c_str(), O_RDONLY | O_BINARY);
ASSERT_GE(file, 0); ASSERT_GE(file, 0);
@ -145,7 +145,7 @@ TEST(MESSAGE_TEST_NAME, ParseFromFileDescriptor) {
TEST(MESSAGE_TEST_NAME, ParsePackedFromFileDescriptor) { TEST(MESSAGE_TEST_NAME, ParsePackedFromFileDescriptor) {
std::string filename = TestUtil::GetTestDataPath( std::string filename = TestUtil::GetTestDataPath(
"third_party/protobuf/testdata/golden_packed_fields_message"); "google/protobuf/testdata/golden_packed_fields_message");
int file = open(filename.c_str(), O_RDONLY | O_BINARY); int file = open(filename.c_str(), O_RDONLY | O_BINARY);
ASSERT_GE(file, 0); ASSERT_GE(file, 0);

@ -45,32 +45,12 @@ namespace google {
namespace protobuf { namespace protobuf {
namespace TestUtil { namespace TestUtil {
// Translate net/proto2/* or third_party/protobuf/* to google/protobuf/*.
inline std::string TranslatePathToOpensource(absl::string_view google3_path) {
constexpr absl::string_view net_proto2 = "net/proto2/";
constexpr absl::string_view third_party_protobuf = "third_party/protobuf/";
if (!absl::ConsumePrefix(&google3_path, net_proto2)) {
ABSL_CHECK(absl::ConsumePrefix(&google3_path, third_party_protobuf))
<< google3_path;
}
absl::ConsumePrefix(&google3_path, "internal/");
absl::ConsumePrefix(&google3_path, "proto/");
absl::ConsumeSuffix(&google3_path, "public/");
return absl::StrCat("google/protobuf/", google3_path);
}
inline std::string MaybeTranslatePath(absl::string_view google3_path) {
return TranslatePathToOpensource(google3_path);
return std::string(google3_path);
}
inline std::string TestSourceDir() { inline std::string TestSourceDir() {
return google::protobuf::TestSourceDir(); return google::protobuf::TestSourceDir();
} }
inline std::string GetTestDataPath(absl::string_view google3_path) { inline std::string GetTestDataPath(absl::string_view path) {
return absl::StrCat(TestSourceDir(), "/", MaybeTranslatePath(google3_path)); return absl::StrCat(TestSourceDir(), "/", path);
} }
// Checks the equality of "message" and serialized proto of type "ProtoType". // Checks the equality of "message" and serialized proto of type "ProtoType".

@ -97,7 +97,7 @@ class TextFormatTest : public testing::Test {
static void SetUpTestSuite() { static void SetUpTestSuite() {
ABSL_CHECK_OK(File::GetContents( ABSL_CHECK_OK(File::GetContents(
TestUtil::GetTestDataPath( TestUtil::GetTestDataPath(
"third_party/protobuf/" "google/protobuf/"
"testdata/text_format_unittest_data_oneof_implemented.txt"), "testdata/text_format_unittest_data_oneof_implemented.txt"),
&static_proto_text_format_, true)); &static_proto_text_format_, true));
} }
@ -118,7 +118,7 @@ class TextFormatExtensionsTest : public testing::Test {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
ABSL_CHECK_OK(File::GetContents( ABSL_CHECK_OK(File::GetContents(
TestUtil::GetTestDataPath("third_party/protobuf/testdata/" TestUtil::GetTestDataPath("google/protobuf/testdata/"
"text_format_unittest_extensions_data.txt"), "text_format_unittest_extensions_data.txt"),
&static_proto_text_format_, true)); &static_proto_text_format_, true));
} }

Loading…
Cancel
Save