File: fix_C%2B%2B_32bit_tests.patch

package info (click to toggle)
protobuf 3.21.12-3
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 41,020 kB
  • sloc: cpp: 179,370; java: 87,794; objc: 60,661; ansic: 37,810; cs: 28,526; python: 22,443; php: 11,464; ruby: 6,127; sh: 3,635; makefile: 3,341; pascal: 2,354; xml: 2,321; javascript: 311; lisp: 87; awk: 17
file content (58 lines) | stat: -rw-r--r-- 2,040 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Description: fix C++ build tests
 Add bits to expect 32 bit systems.
Author: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Bug-Debian: https://bugs.debian.org/1033998
Forwarded: no
Last-Update: 2023-04-07

---

--- protobuf-3.21.12.orig/src/google/protobuf/any_test.cc
+++ protobuf-3.21.12/src/google/protobuf/any_test.cc
@@ -62,9 +62,14 @@ TEST(AnyTest, TestPackAndUnpack) {
 
 TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) {
   protobuf_unittest::TestAny submessage;
-  submessage.mutable_text()->resize(INT_MAX, 'a');
   protobuf_unittest::TestAny message;
-  EXPECT_FALSE(message.mutable_any_value()->PackFrom(submessage));
+  try {
+    submessage.mutable_text()->resize(INT_MAX, 'a');
+    EXPECT_FALSE(message.mutable_any_value()->PackFrom(submessage));
+  }
+  catch (...) {
+    EXPECT_TRUE(message.mutable_any_value()->PackFrom(submessage));
+  }
 }
 
 TEST(AnyTest, TestUnpackWithTypeMismatch) {
--- protobuf-3.21.12.orig/src/google/protobuf/arena_unittest.cc
+++ protobuf-3.21.12/src/google/protobuf/arena_unittest.cc
@@ -1375,11 +1375,11 @@ TEST(ArenaTest, SpaceAllocated_and_Used)
   options.initial_block_size = arena_block.size();
   Arena arena_2(options);
   EXPECT_EQ(1024, arena_2.SpaceAllocated());
-  EXPECT_EQ(0, arena_2.SpaceUsed());
+  EXPECT_EQ(8 - sizeof(void*), arena_2.SpaceUsed());
   EXPECT_EQ(1024, arena_2.Reset());
   Arena::CreateArray<char>(&arena_2, 55);
   EXPECT_EQ(1024, arena_2.SpaceAllocated());
-  EXPECT_EQ(Align8(55), arena_2.SpaceUsed());
+  EXPECT_EQ(Align8(55) + 8 - sizeof(void*), arena_2.SpaceUsed());
   EXPECT_EQ(1024, arena_2.Reset());
 }
 
@@ -1418,11 +1418,11 @@ TEST(ArenaTest, BlockSizeSmallerThanAllo
 
     *Arena::Create<int64_t>(&arena) = 42;
     EXPECT_GE(arena.SpaceAllocated(), 8);
-    EXPECT_EQ(8, arena.SpaceUsed());
+    EXPECT_EQ(16 - sizeof(void*), arena.SpaceUsed());
 
     *Arena::Create<int64_t>(&arena) = 42;
     EXPECT_GE(arena.SpaceAllocated(), 16);
-    EXPECT_EQ(16, arena.SpaceUsed());
+    EXPECT_EQ(24 - sizeof(void*), arena.SpaceUsed());
   }
 }