Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
glog
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
glog
Commits
62c3e3cd
Commit
62c3e3cd
authored
Mar 18, 2016
by
Artem Dinaburg
Committed by
NeroBurner
Jun 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The %p format is implementation defined. Compare it via a special token,
just like the null pointer test.
parent
0301bfdd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
googletest.h
src/googletest.h
+6
-2
logging_unittest.cc
src/logging_unittest.cc
+1
-1
logging_unittest.err
src/logging_unittest.err
+1
-1
No files found.
src/googletest.h
View file @
62c3e3cd
...
...
@@ -90,6 +90,8 @@ static const char TEST_SRC_DIR[] = "../..";
static
const
char
TEST_SRC_DIR
[]
=
"."
;
#endif
static
const
uint32_t
PTR_TEST_VALUE
=
0x12345678
;
DEFINE_string
(
test_tmpdir
,
GetTempDir
(),
"Dir we use for temp files"
);
DEFINE_string
(
test_srcdir
,
TEST_SRC_DIR
,
"Source-dir root, needed to find glog_unittest_flagfile"
);
...
...
@@ -447,10 +449,12 @@ static inline string Munge(const string& filename) {
while
(
fgets
(
buf
,
4095
,
fp
))
{
string
line
=
MungeLine
(
buf
);
char
null_str
[
256
];
char
ptr_str
[
256
];
sprintf
(
null_str
,
"%p"
,
static_cast
<
void
*>
(
NULL
));
sprintf
(
ptr_str
,
"%p"
,
reinterpret_cast
<
void
*>
(
PTR_TEST_VALUE
));
StringReplace
(
&
line
,
"__NULLP__"
,
null_str
);
// Remove 0x prefix produced by %p. VC++ doesn't put the prefix.
StringReplace
(
&
line
,
" 0x"
,
" "
);
StringReplace
(
&
line
,
"__PTRTEST__"
,
ptr_str
);
StringReplace
(
&
line
,
"__SUCCESS__"
,
StrError
(
0
));
StringReplace
(
&
line
,
"__ENOENT__"
,
StrError
(
ENOENT
));
...
...
src/logging_unittest.cc
View file @
62c3e3cd
...
...
@@ -323,7 +323,7 @@ void TestRawLogging() {
RAW_LOG
(
WARNING
,
"%s"
,
s
);
const
char
const_s
[]
=
"const array"
;
RAW_LOG
(
INFO
,
"%s"
,
const_s
);
void
*
p
=
reinterpret_cast
<
void
*>
(
0x12345678
);
void
*
p
=
reinterpret_cast
<
void
*>
(
PTR_TEST_VALUE
);
RAW_LOG
(
INFO
,
"ptr %p"
,
p
);
p
=
NULL
;
RAW_LOG
(
INFO
,
"ptr %p"
,
p
);
...
...
src/logging_unittest.err
View file @
62c3e3cd
...
...
@@ -80,7 +80,7 @@ no prefix
IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo bar 10 3.400000
WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: array
IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: const array
IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr
0x12345678
IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr
__PTRTEST__
IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr __NULLP__
EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 0000001000 3e8
IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000
...
...
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