Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
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
brpc
Commits
7c3f109e
Commit
7c3f109e
authored
Mar 04, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add LOG_AT macro when linking with glog
parent
26a0df84
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
9 deletions
+18
-9
CMakeLists.txt
CMakeLists.txt
+3
-0
CMakeLists.txt
src/CMakeLists.txt
+1
-1
logging.h
src/butil/logging.h
+3
-0
bthread_butex_unittest.cpp
test/bthread_butex_unittest.cpp
+3
-3
bthread_fd_unittest.cpp
test/bthread_fd_unittest.cpp
+1
-1
bthread_timer_thread_unittest.cpp
test/bthread_timer_thread_unittest.cpp
+1
-1
string_number_conversions_unittest.cc
test/string_number_conversions_unittest.cc
+2
-1
string_split_unittest.cc
test/string_split_unittest.cc
+4
-2
No files found.
CMakeLists.txt
View file @
7c3f109e
...
@@ -129,6 +129,9 @@ set(DYNAMIC_LIB
...
@@ -129,6 +129,9 @@ set(DYNAMIC_LIB
dl
dl
z
z
)
)
if
(
BRPC_WITH_GLOG
)
set
(
DYNAMIC_LIB
${
DYNAMIC_LIB
}
${
GLOG_LIB
}
)
endif
()
# for *.so
# for *.so
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
/output/lib
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
/output/lib
)
...
...
src/CMakeLists.txt
View file @
7c3f109e
...
@@ -21,7 +21,7 @@ add_library(brpc-static STATIC $<TARGET_OBJECTS:BUTIL_LIB> $<TARGET_OBJECTS:OBJ_
...
@@ -21,7 +21,7 @@ add_library(brpc-static STATIC $<TARGET_OBJECTS:BUTIL_LIB> $<TARGET_OBJECTS:OBJ_
target_link_libraries
(
brpc-shared
${
DYNAMIC_LIB
}
)
target_link_libraries
(
brpc-shared
${
DYNAMIC_LIB
}
)
if
(
WITH_GLOG
)
if
(
BRPC_
WITH_GLOG
)
target_link_libraries
(
brpc-shared
${
GLOG_LIB
}
)
target_link_libraries
(
brpc-shared
${
GLOG_LIB
}
)
endif
()
endif
()
...
...
src/butil/logging.h
View file @
7c3f109e
...
@@ -53,6 +53,9 @@
...
@@ -53,6 +53,9 @@
# define DVPLOG(...) DVLOG(__VA_ARGS__)
# define DVPLOG(...) DVLOG(__VA_ARGS__)
# endif
# endif
#define LOG_AT(severity, file, line) \
google::LogMessage(file, line, google::severity).stream()
#else
#else
#ifdef BAIDU_INTERNAL
#ifdef BAIDU_INTERNAL
...
...
test/bthread_butex_unittest.cpp
View file @
7c3f109e
...
@@ -43,7 +43,7 @@ void* joiner(void* arg) {
...
@@ -43,7 +43,7 @@ void* joiner(void* arg) {
LOG
(
FATAL
)
<<
"fail to join thread_"
<<
th
-
(
bthread_t
*
)
arg
;
LOG
(
FATAL
)
<<
"fail to join thread_"
<<
th
-
(
bthread_t
*
)
arg
;
}
}
long
elp
=
butil
::
gettimeofday_us
()
-
t1
;
long
elp
=
butil
::
gettimeofday_us
()
-
t1
;
EXPECT_LE
(
labs
(
elp
-
(
th
-
(
bthread_t
*
)
arg
+
1
)
*
100000L
),
1
0
000L
)
EXPECT_LE
(
labs
(
elp
-
(
th
-
(
bthread_t
*
)
arg
+
1
)
*
100000L
),
1
5
000L
)
<<
"timeout when joining thread_"
<<
th
-
(
bthread_t
*
)
arg
;
<<
"timeout when joining thread_"
<<
th
-
(
bthread_t
*
)
arg
;
LOG
(
INFO
)
<<
"Joined thread "
<<
*
th
<<
" at "
<<
elp
<<
"us ["
LOG
(
INFO
)
<<
"Joined thread "
<<
*
th
<<
" at "
<<
elp
<<
"us ["
<<
bthread_self
()
<<
"]"
;
<<
bthread_self
()
<<
"]"
;
...
@@ -208,7 +208,7 @@ TEST(ButexTest, wait_without_stop) {
...
@@ -208,7 +208,7 @@ TEST(ButexTest, wait_without_stop) {
ASSERT_EQ
(
0
,
bthread_join
(
th
,
NULL
));
ASSERT_EQ
(
0
,
bthread_join
(
th
,
NULL
));
tm
.
stop
();
tm
.
stop
();
ASSERT_LT
(
labs
(
tm
.
m_elapsed
()
-
WAIT_MSEC
),
2
0
);
ASSERT_LT
(
labs
(
tm
.
m_elapsed
()
-
WAIT_MSEC
),
4
0
);
}
}
bthread
::
butex_destroy
(
butex
);
bthread
::
butex_destroy
(
butex
);
}
}
...
@@ -232,7 +232,7 @@ TEST(ButexTest, stop_after_running) {
...
@@ -232,7 +232,7 @@ TEST(ButexTest, stop_after_running) {
ASSERT_EQ
(
0
,
bthread_join
(
th
,
NULL
));
ASSERT_EQ
(
0
,
bthread_join
(
th
,
NULL
));
tm
.
stop
();
tm
.
stop
();
ASSERT_LT
(
labs
(
tm
.
m_elapsed
()
-
SLEEP_MSEC
),
10
);
ASSERT_LT
(
labs
(
tm
.
m_elapsed
()
-
SLEEP_MSEC
),
25
);
// ASSERT_TRUE(bthread::get_task_control()->
// ASSERT_TRUE(bthread::get_task_control()->
// timer_thread()._idset.empty());
// timer_thread()._idset.empty());
ASSERT_EQ
(
EINVAL
,
bthread_stop
(
th
));
ASSERT_EQ
(
EINVAL
,
bthread_stop
(
th
));
...
...
test/bthread_fd_unittest.cpp
View file @
7c3f109e
...
@@ -385,7 +385,7 @@ TEST(FDTest, timeout) {
...
@@ -385,7 +385,7 @@ TEST(FDTest, timeout) {
ASSERT_EQ
(
0
,
pthread_join
(
th
,
NULL
));
ASSERT_EQ
(
0
,
pthread_join
(
th
,
NULL
));
ASSERT_EQ
(
0
,
bthread_join
(
bth
,
NULL
));
ASSERT_EQ
(
0
,
bthread_join
(
bth
,
NULL
));
tm
.
stop
();
tm
.
stop
();
ASSERT_LT
(
tm
.
m_elapsed
(),
6
0
);
ASSERT_LT
(
tm
.
m_elapsed
(),
8
0
);
ASSERT_EQ
(
0
,
bthread_close
(
fds
[
0
]));
ASSERT_EQ
(
0
,
bthread_close
(
fds
[
0
]));
ASSERT_EQ
(
0
,
bthread_close
(
fds
[
1
]));
ASSERT_EQ
(
0
,
bthread_close
(
fds
[
1
]));
}
}
...
...
test/bthread_timer_thread_unittest.cpp
View file @
7c3f109e
...
@@ -68,7 +68,7 @@ public:
...
@@ -68,7 +68,7 @@ public:
{
{
ASSERT_TRUE
(
!
_run_times
.
empty
());
ASSERT_TRUE
(
!
_run_times
.
empty
());
long
diff
=
timespec_diff_us
(
_run_times
[
0
],
expect_run_time
);
long
diff
=
timespec_diff_us
(
_run_times
[
0
],
expect_run_time
);
EXPECT_LE
(
labs
(
diff
),
1
0000
);
EXPECT_LE
(
labs
(
diff
),
5
0000
);
}
}
void
expect_not_run
()
{
void
expect_not_run
()
{
...
...
test/string_number_conversions_unittest.cc
View file @
7c3f109e
...
@@ -739,8 +739,9 @@ TEST(StringNumberConversionsTest, StringToDouble) {
...
@@ -739,8 +739,9 @@ TEST(StringNumberConversionsTest, StringToDouble) {
double
output
;
double
output
;
errno
=
1
;
errno
=
1
;
EXPECT_EQ
(
cases
[
i
].
success
,
StringToDouble
(
cases
[
i
].
input
,
&
output
));
EXPECT_EQ
(
cases
[
i
].
success
,
StringToDouble
(
cases
[
i
].
input
,
&
output
));
if
(
cases
[
i
].
success
)
if
(
cases
[
i
].
success
)
{
EXPECT_EQ
(
1
,
errno
)
<<
i
;
// confirm that errno is unchanged.
EXPECT_EQ
(
1
,
errno
)
<<
i
;
// confirm that errno is unchanged.
}
EXPECT_DOUBLE_EQ
(
cases
[
i
].
output
,
output
);
EXPECT_DOUBLE_EQ
(
cases
[
i
].
output
,
output
);
}
}
...
...
test/string_split_unittest.cc
View file @
7c3f109e
...
@@ -322,10 +322,12 @@ TEST(StringSplitTest, SplitStringAlongWhitespace) {
...
@@ -322,10 +322,12 @@ TEST(StringSplitTest, SplitStringAlongWhitespace) {
std
::
vector
<
std
::
string
>
results
;
std
::
vector
<
std
::
string
>
results
;
SplitStringAlongWhitespace
(
data
[
i
].
input
,
&
results
);
SplitStringAlongWhitespace
(
data
[
i
].
input
,
&
results
);
ASSERT_EQ
(
data
[
i
].
expected_result_count
,
results
.
size
());
ASSERT_EQ
(
data
[
i
].
expected_result_count
,
results
.
size
());
if
(
data
[
i
].
expected_result_count
>
0
)
if
(
data
[
i
].
expected_result_count
>
0
)
{
ASSERT_EQ
(
data
[
i
].
output1
,
results
[
0
]);
ASSERT_EQ
(
data
[
i
].
output1
,
results
[
0
]);
if
(
data
[
i
].
expected_result_count
>
1
)
}
if
(
data
[
i
].
expected_result_count
>
1
)
{
ASSERT_EQ
(
data
[
i
].
output2
,
results
[
1
]);
ASSERT_EQ
(
data
[
i
].
output2
,
results
[
1
]);
}
}
}
}
}
...
...
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