Refactor and test fixes to make code more portable.

PiperOrigin-RevId: 668478266
pull/17946/head
Protobuf Team Bot 3 months ago committed by Copybara-Service
parent 07b325e5d7
commit c52d7ff8f5
  1. 6
      src/google/protobuf/any_test.cc
  2. 1
      src/google/protobuf/descriptor_database_unittest.cc
  3. 2
      src/google/protobuf/extension_set_unittest.cc
  4. 1
      src/google/protobuf/generated_message_reflection_unittest.cc
  5. 5
      src/google/protobuf/port.h
  6. 4
      src/google/protobuf/test_util2.h
  7. 1
      src/google/protobuf/unknown_field_set_unittest.cc

@ -45,9 +45,9 @@ TEST(AnyTest, TestPackAndUnpack) {
}
TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) {
#if defined(_MSC_VER) && defined(_M_IX86)
GTEST_SKIP() << "This toolchain can't allocate that much memory.";
#endif
if (std::string().max_size() < INT_MAX) {
GTEST_SKIP() << "This toolchain can't allocate that much memory.";
}
protobuf_unittest::TestAny submessage;
submessage.mutable_text()->resize(INT_MAX, 'a');
protobuf_unittest::TestAny message;

@ -18,7 +18,6 @@
#include "google/protobuf/descriptor.pb.h"
#include <gmock/gmock.h>
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/descriptor.h"
#include "google/protobuf/test_textproto.h"

@ -16,7 +16,6 @@
#include <string>
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/base/casts.h"
#include "absl/strings/cord.h"
@ -28,6 +27,7 @@
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl.h"
#include "google/protobuf/message_lite.h"
#include "google/protobuf/port.h"
#include "google/protobuf/test_util.h"
#include "google/protobuf/test_util2.h"
#include "google/protobuf/text_format.h"

@ -36,6 +36,7 @@
#include "google/protobuf/map_test_util.h"
#include "google/protobuf/map_unittest.pb.h"
#include "google/protobuf/message.h"
#include "google/protobuf/port.h"
#include "google/protobuf/test_util.h"
#include "google/protobuf/unittest.pb.h"
#include "google/protobuf/unittest_mset.pb.h"

@ -273,6 +273,11 @@ constexpr bool PerformDebugChecks() {
// available.
inline constexpr bool PtrIsAtLeast8BAligned() { return alignof(void*) >= 8; }
inline constexpr bool IsLazyParsingSupported() {
// We need 3 bits for pointer tagging in lazy parsing.
return PtrIsAtLeast8BAligned();
}
// Prefetch 5 64-byte cache line starting from 7 cache-lines ahead.
// Constants are somewhat arbitrary and pretty aggressive, but were
// chosen to give a better benchmark results. E.g. this is ~20%

@ -10,7 +10,7 @@
#include <string>
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/strings/strip.h"
@ -18,6 +18,8 @@
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
#include "google/protobuf/util/message_differencer.h"
#include "google/protobuf/testing/googletest.h"
namespace google {
namespace protobuf {
namespace TestUtil {

@ -20,7 +20,6 @@
#include "google/protobuf/stubs/callback.h"
#include "google/protobuf/stubs/common.h"
#include <gmock/gmock.h>
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/container/flat_hash_set.h"
#include "absl/functional/bind_front.h"

Loading…
Cancel
Save