mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Internal change.
PiperOrigin-RevId: 964200763
This commit is contained in:
parent
090f4cbb88
commit
6b336e7038
1 changed files with 17 additions and 10 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
#include "google/protobuf/testing/file.h"
|
#include "google/protobuf/testing/file.h"
|
||||||
#include "google/protobuf/testing/file.h"
|
#include "google/protobuf/testing/file.h"
|
||||||
#include "google/protobuf/testing/path.h"
|
#include "google/protobuf/testing/path.h"
|
||||||
|
#include "google/protobuf/compiler/access_info_map.h"
|
||||||
#include "google/protobuf/compiler/profile.pb.h"
|
#include "google/protobuf/compiler/profile.pb.h"
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include "google/protobuf/testing/googletest.h"
|
#include "google/protobuf/testing/googletest.h"
|
||||||
|
|
@ -180,6 +181,9 @@ TEST(AnalyzeProfileProtoTest, PrintStatistics) {
|
||||||
if (google::protobuf::internal::ForceInlineStringInProtoc()) {
|
if (google::protobuf::internal::ForceInlineStringInProtoc()) {
|
||||||
GTEST_SKIP() << "Forced layout invalidates the test.";
|
GTEST_SKIP() << "Forced layout invalidates the test.";
|
||||||
}
|
}
|
||||||
|
if (!EnableAggressiveLazy()) {
|
||||||
|
GTEST_SKIP() << "Aggressive lazy is not enabled.";
|
||||||
|
}
|
||||||
AccessInfo info = ParseTextOrDie(R"pb(
|
AccessInfo info = ParseTextOrDie(R"pb(
|
||||||
language: "cpp"
|
language: "cpp"
|
||||||
message {
|
message {
|
||||||
|
|
@ -207,12 +211,12 @@ TEST(AnalyzeProfileProtoTest, PrintStatistics) {
|
||||||
options.pool = DescriptorPool::generated_pool();
|
options.pool = DescriptorPool::generated_pool();
|
||||||
EXPECT_STREQ(AnalyzeToText(info, options).c_str(),
|
EXPECT_STREQ(AnalyzeToText(info, options).c_str(),
|
||||||
R"(Message google::protobuf::compiler::tools::AnalyzeThis
|
R"(Message google::protobuf::compiler::tools::AnalyzeThis
|
||||||
int32 id: RARELY_USED(100)
|
int32 id:
|
||||||
string optional_string: RARELY_USED(100)
|
string optional_string:
|
||||||
string[] repeated_string: LIKELY_PRESENT(100.00%) RARELY_USED(100) NUM_ELEMS_HISTO[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] NUM_ELEMS_MEAN=66.1 NUM_ELEMS_STDDEV=1.5
|
string[] repeated_string: LIKELY_PRESENT(100.00%) NUM_ELEMS_HISTO[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] NUM_ELEMS_MEAN=66.1 NUM_ELEMS_STDDEV=1.5
|
||||||
AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY
|
AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY
|
||||||
AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%) RARELY_USED(100)
|
AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%)
|
||||||
Nested nested: RARELY_USED(100)
|
Nested nested:
|
||||||
========
|
========
|
||||||
singular_lazy_num=1
|
singular_lazy_num=1
|
||||||
singular_lazy_0usage_num=0
|
singular_lazy_0usage_num=0
|
||||||
|
|
@ -239,6 +243,9 @@ TEST(AnalyzeProfileProtoTest, PrintStatisticsAll) {
|
||||||
if (google::protobuf::internal::ForceInlineStringInProtoc()) {
|
if (google::protobuf::internal::ForceInlineStringInProtoc()) {
|
||||||
GTEST_SKIP() << "Forced layout invalidates the test.";
|
GTEST_SKIP() << "Forced layout invalidates the test.";
|
||||||
}
|
}
|
||||||
|
if (!EnableAggressiveLazy()) {
|
||||||
|
GTEST_SKIP() << "Aggressive lazy is not enabled.";
|
||||||
|
}
|
||||||
AccessInfo info = ParseTextOrDie(R"pb(
|
AccessInfo info = ParseTextOrDie(R"pb(
|
||||||
language: "cpp"
|
language: "cpp"
|
||||||
message {
|
message {
|
||||||
|
|
@ -260,12 +267,12 @@ TEST(AnalyzeProfileProtoTest, PrintStatisticsAll) {
|
||||||
options.pool = DescriptorPool::generated_pool();
|
options.pool = DescriptorPool::generated_pool();
|
||||||
EXPECT_STREQ(AnalyzeToText(info, options).c_str(),
|
EXPECT_STREQ(AnalyzeToText(info, options).c_str(),
|
||||||
R"(Message google::protobuf::compiler::tools::AnalyzeThis
|
R"(Message google::protobuf::compiler::tools::AnalyzeThis
|
||||||
int32 id: DEFAULT_PRESENT(1.00%) RARELY_USED(100)
|
int32 id: DEFAULT_PRESENT(1.00%)
|
||||||
string optional_string: DEFAULT_PRESENT(1.00%) RARELY_USED(100)
|
string optional_string: DEFAULT_PRESENT(1.00%)
|
||||||
string[] repeated_string: LIKELY_PRESENT(100.00%) RARELY_USED(100)
|
string[] repeated_string: LIKELY_PRESENT(100.00%)
|
||||||
AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY
|
AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY
|
||||||
AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%) RARELY_USED(100)
|
AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%)
|
||||||
Nested nested: DEFAULT_PRESENT(1.00%) RARELY_USED(100)
|
Nested nested: DEFAULT_PRESENT(1.00%)
|
||||||
========
|
========
|
||||||
singular_lazy_num=1
|
singular_lazy_num=1
|
||||||
singular_lazy_0usage_num=0
|
singular_lazy_0usage_num=0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue