Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
30681c75
Commit
30681c75
authored
Aug 23, 2017
by
Jisi Liu
Committed by
GitHub
Aug 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3546 from pherl/deathtest
Disable death tests on windows
parents
e416f5d2
6609e521
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
39 deletions
+2
-39
message_unittest.cc
src/google/protobuf/message_unittest.cc
+0
-38
googletest.h
src/google/protobuf/testing/googletest.h
+2
-1
No files found.
src/google/protobuf/message_unittest.cc
View file @
30681c75
...
...
@@ -257,44 +257,6 @@ TEST(MessageTest, CheckInitialized) {
"fields: a, b, c"
);
}
TEST
(
MessageTest
,
CheckOverflow
)
{
unittest
::
TestAllTypes
message
;
// Create a message with size just over 2GB. This triggers integer overflow
// when computing message size.
const
string
data
(
1024
,
'x'
);
Cord
one_megabyte
;
for
(
int
i
=
0
;
i
<
1024
;
i
++
)
{
one_megabyte
.
Append
(
data
);
}
for
(
int
i
=
0
;
i
<
2
*
1024
+
1
;
++
i
)
{
message
.
add_repeated_cord
()
->
CopyFrom
(
one_megabyte
);
}
Cord
serialized
;
EXPECT_FALSE
(
message
.
AppendToCord
(
&
serialized
));
}
TEST
(
MessageTest
,
CheckBigOverflow
)
{
// Checking for 4GB buffers on 32 bit systems is problematic.
if
(
sizeof
(
void
*
)
<
8
)
return
;
unittest
::
TestAllTypes
message
;
// Create a message with size just over 4GB. We should be able to detect this
// too, even though it will make a plain "int" wrap back to a positive number.
const
string
data
(
1024
,
'x'
);
Cord
one_megabyte
;
for
(
int
i
=
0
;
i
<
1024
;
i
++
)
{
one_megabyte
.
Append
(
data
);
}
for
(
int
i
=
0
;
i
<
4
*
1024
+
1
;
++
i
)
{
message
.
add_repeated_cord
()
->
CopyFrom
(
one_megabyte
);
}
Cord
serialized
;
EXPECT_FALSE
(
message
.
AppendToCord
(
&
serialized
));
}
#endif // PROTOBUF_HAS_DEATH_TEST
namespace
{
...
...
src/google/protobuf/testing/googletest.h
View file @
30681c75
...
...
@@ -39,7 +39,8 @@
#include <google/protobuf/stubs/common.h>
#include <gmock/gmock.h>
// Disable death tests if we use exceptions in CHECK().
#if !PROTOBUF_USE_EXCEPTIONS && defined(GTEST_HAS_DEATH_TEST)
#if !PROTOBUF_USE_EXCEPTIONS && defined(GTEST_HAS_DEATH_TEST) && \
!GTEST_OS_WINDOWS
#define PROTOBUF_HAS_DEATH_TEST
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment