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
f8c188a7
Commit
f8c188a7
authored
Feb 10, 2020
by
jamesge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix several warnings under MAC
parent
74310245
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
18 deletions
+18
-18
brpc_http_rpc_protocol_unittest.cpp
test/brpc_http_rpc_protocol_unittest.cpp
+2
-2
brpc_uri_unittest.cpp
test/brpc_uri_unittest.cpp
+3
-3
endpoint_unittest.cpp
test/endpoint_unittest.cpp
+1
-1
iobuf_unittest.cpp
test/iobuf_unittest.cpp
+5
-5
object_pool_unittest.cpp
test/object_pool_unittest.cpp
+6
-6
recordio_unittest.cpp
test/recordio_unittest.cpp
+1
-1
No files found.
test/brpc_http_rpc_protocol_unittest.cpp
View file @
f8c188a7
...
...
@@ -1292,7 +1292,7 @@ TEST_F(HttpTest, http2_header_after_data) {
}
{
brpc
::
HPacker
::
Header
header
(
"content-length"
,
butil
::
string_printf
(
"%
"
PRIu64
,
data_buf
.
size
()));
butil
::
string_printf
(
"%
llu"
,
(
unsigned
long
long
)
data_buf
.
size
()));
hpacker
.
Encode
(
&
header1_appender
,
header
,
options
);
}
{
...
...
@@ -1436,7 +1436,7 @@ TEST_F(HttpTest, http2_handle_goaway_streams) {
SerializeFrameHead
(
goawaybuf
,
8
,
brpc
::
policy
::
H2_FRAME_GOAWAY
,
0
,
0
);
SaveUint32
(
goawaybuf
+
brpc
::
policy
::
FRAME_HEAD_SIZE
,
0
);
SaveUint32
(
goawaybuf
+
brpc
::
policy
::
FRAME_HEAD_SIZE
+
4
,
0
);
ASSERT_EQ
(
brpc
::
policy
::
FRAME_HEAD_SIZE
+
8
,
::
write
(
servfd
,
goawaybuf
,
brpc
::
policy
::
FRAME_HEAD_SIZE
+
8
));
ASSERT_EQ
(
(
ssize_t
)
brpc
::
policy
::
FRAME_HEAD_SIZE
+
8
,
::
write
(
servfd
,
goawaybuf
,
brpc
::
policy
::
FRAME_HEAD_SIZE
+
8
));
// After receving GOAWAY, the callbacks in client should be run correctly.
for
(
int
i
=
0
;
i
<
req_size
;
i
++
)
{
...
...
test/brpc_uri_unittest.cpp
View file @
f8c188a7
...
...
@@ -64,7 +64,7 @@ TEST(URITest, only_host) {
ASSERT_EQ
(
""
,
uri
.
path
());
ASSERT_EQ
(
""
,
uri
.
user_info
());
ASSERT_EQ
(
""
,
uri
.
fragment
());
ASSERT_EQ
(
2
,
uri
.
QueryCount
());
ASSERT_EQ
(
2
u
,
uri
.
QueryCount
());
ASSERT_TRUE
(
uri
.
GetQuery
(
"wd"
));
ASSERT_EQ
(
*
uri
.
GetQuery
(
"wd"
),
"uri2"
);
ASSERT_TRUE
(
uri
.
GetQuery
(
"nonkey"
));
...
...
@@ -77,7 +77,7 @@ TEST(URITest, only_host) {
ASSERT_EQ
(
""
,
uri
.
path
());
ASSERT_EQ
(
""
,
uri
.
user_info
());
ASSERT_EQ
(
""
,
uri
.
fragment
());
ASSERT_EQ
(
0
,
uri
.
QueryCount
());
ASSERT_EQ
(
0
u
,
uri
.
QueryCount
());
ASSERT_EQ
(
0
,
uri
.
SetHttpURL
(
" www.baidu4.com "
));
ASSERT_EQ
(
""
,
uri
.
scheme
());
...
...
@@ -86,7 +86,7 @@ TEST(URITest, only_host) {
ASSERT_EQ
(
""
,
uri
.
path
());
ASSERT_EQ
(
""
,
uri
.
user_info
());
ASSERT_EQ
(
""
,
uri
.
fragment
());
ASSERT_EQ
(
0
,
uri
.
QueryCount
());
ASSERT_EQ
(
0
u
,
uri
.
QueryCount
());
}
TEST
(
URITest
,
no_scheme
)
{
...
...
test/endpoint_unittest.cpp
View file @
f8c188a7
...
...
@@ -145,7 +145,7 @@ TEST(EndPointTest, flat_map) {
butil
::
BucketInfo
info
=
m
.
bucket_info
();
LOG
(
INFO
)
<<
"bucket info max long="
<<
info
.
longest_length
<<
" avg="
<<
info
.
average_length
<<
std
::
endl
;
ASSERT_LT
(
info
.
longest_length
,
32
)
<<
"detect hash collision and it's too large."
;
ASSERT_LT
(
info
.
longest_length
,
32
ul
)
<<
"detect hash collision and it's too large."
;
}
}
// end of namespace
test/iobuf_unittest.cpp
View file @
f8c188a7
...
...
@@ -1369,7 +1369,7 @@ TEST_F(IOBufTest, cut_into_fd_with_offset_multithreaded) {
for
(
int
i
=
0
;
i
<
number_per_thread
*
(
int
)
ARRAY_SIZE
(
threads
);
++
i
)
{
off_t
offset
=
i
*
sizeof
(
int
);
butil
::
IOPortal
in
;
ASSERT_EQ
(
sizeof
(
int
),
in
.
pappend_from_file_descriptor
(
fd
,
offset
,
sizeof
(
int
)));
ASSERT_EQ
(
(
ssize_t
)
sizeof
(
int
),
in
.
pappend_from_file_descriptor
(
fd
,
offset
,
sizeof
(
int
)));
int
j
;
ASSERT_EQ
(
sizeof
(
j
),
in
.
cutn
(
&
j
,
sizeof
(
j
)));
ASSERT_EQ
(
i
,
j
);
...
...
@@ -1586,7 +1586,7 @@ static void my_free(void* m) {
TEST_F
(
IOBufTest
,
append_user_data_and_consume
)
{
butil
::
IOBuf
b0
;
const
int
REP
=
16
;
const
in
t
len
=
REP
*
256
;
const
size_
t
len
=
REP
*
256
;
char
*
data
=
(
char
*
)
malloc
(
len
);
for
(
int
i
=
0
;
i
<
256
;
++
i
)
{
for
(
int
j
=
0
;
j
<
REP
;
++
j
)
{
...
...
@@ -1616,7 +1616,7 @@ TEST_F(IOBufTest, append_user_data_and_consume) {
TEST_F
(
IOBufTest
,
append_user_data_and_share
)
{
butil
::
IOBuf
b0
;
const
int
REP
=
16
;
const
in
t
len
=
REP
*
256
;
const
size_
t
len
=
REP
*
256
;
char
*
data
=
(
char
*
)
malloc
(
len
);
for
(
int
i
=
0
;
i
<
256
;
++
i
)
{
for
(
int
j
=
0
;
j
<
REP
;
++
j
)
{
...
...
@@ -1633,7 +1633,7 @@ TEST_F(IOBufTest, append_user_data_and_share) {
{
butil
::
IOBuf
bufs
[
256
];
for
(
int
i
=
0
;
i
<
256
;
++
i
)
{
ASSERT_EQ
(
REP
,
b0
.
cutn
(
&
bufs
[
i
],
REP
));
ASSERT_EQ
(
(
size_t
)
REP
,
b0
.
cutn
(
&
bufs
[
i
],
REP
));
ASSERT_EQ
(
len
-
(
i
+
1
)
*
REP
,
b0
.
size
());
if
(
i
!=
255
)
{
ASSERT_EQ
(
1UL
,
b0
.
_ref_num
());
...
...
@@ -1647,7 +1647,7 @@ TEST_F(IOBufTest, append_user_data_and_share) {
ASSERT_EQ
(
NULL
,
my_free_params
);
for
(
int
i
=
0
;
i
<
256
;
++
i
)
{
std
::
string
out
=
bufs
[
i
].
to_string
();
ASSERT_EQ
(
REP
,
out
.
size
());
ASSERT_EQ
(
(
size_t
)
REP
,
out
.
size
());
for
(
int
j
=
0
;
j
<
REP
;
++
j
)
{
ASSERT_EQ
((
char
)
i
,
out
[
j
]);
}
...
...
test/object_pool_unittest.cpp
View file @
f8c188a7
...
...
@@ -189,7 +189,7 @@ TEST_F(ObjectPoolTest, get_int) {
*
(
new
int
)
=
i
;
}
tm
.
stop
();
printf
(
"new a int takes %
lu
ns
\n
"
,
tm
.
n_elapsed
()
/
N
);
printf
(
"new a int takes %
"
PRId64
"
ns
\n
"
,
tm
.
n_elapsed
()
/
N
);
std
::
cout
<<
describe_objects
<
int
>
()
<<
std
::
endl
;
clear_objects
<
int
>
();
...
...
@@ -220,7 +220,7 @@ TEST_F(ObjectPoolTest, get_perf) {
get_object
<
SilentObj
>
();
}
tm1
.
stop
();
printf
(
"get a SilentObj takes %
lu
ns
\n
"
,
tm1
.
n_elapsed
()
/
N
);
printf
(
"get a SilentObj takes %
"
PRId64
"
ns
\n
"
,
tm1
.
n_elapsed
()
/
N
);
//clear_objects<SilentObj>(); // free all blocks
tm2
.
start
();
...
...
@@ -228,7 +228,7 @@ TEST_F(ObjectPoolTest, get_perf) {
new_list
.
push_back
(
new
SilentObj
);
}
tm2
.
stop
();
printf
(
"new a SilentObj takes %
lu
ns
\n
"
,
tm2
.
n_elapsed
()
/
N
);
printf
(
"new a SilentObj takes %
"
PRId64
"
ns
\n
"
,
tm2
.
n_elapsed
()
/
N
);
for
(
size_t
i
=
0
;
i
<
new_list
.
size
();
++
i
)
{
delete
new_list
[
i
];
}
...
...
@@ -254,7 +254,7 @@ void* get_and_return_int(void*) {
return_object
(
get_object
<
D
>
());
tm0
.
stop
();
printf
(
"[%lu] warmup=%
lu
\n
"
,
pthread_self
(),
tm0
.
n_elapsed
());
printf
(
"[%lu] warmup=%
"
PRId64
"
\n
"
,
(
size_t
)
pthread_self
(),
tm0
.
n_elapsed
());
for
(
int
j
=
0
;
j
<
5
;
++
j
)
{
v
.
clear
();
...
...
@@ -281,7 +281,7 @@ void* get_and_return_int(void*) {
}
printf
(
"[%lu:%d] get<D>=%.1f return<D>=%.1f
\n
"
,
pthread_self
(),
j
,
tm1
.
n_elapsed
()
/
(
double
)
N
,
(
size_t
)
pthread_self
(),
j
,
tm1
.
n_elapsed
()
/
(
double
)
N
,
tm2
.
n_elapsed
()
/
(
double
)
N
);
}
return
NULL
;
...
...
@@ -317,7 +317,7 @@ void* new_and_delete_int(void*) {
tm2
.
stop
();
printf
(
"[%lu:%d] new<D>=%.1f delete<D>=%.1f
\n
"
,
pthread_self
(),
j
,
tm1
.
n_elapsed
()
/
(
double
)
N
,
(
size_t
)
pthread_self
(),
j
,
tm1
.
n_elapsed
()
/
(
double
)
N
,
tm2
.
n_elapsed
()
/
(
double
)
N
);
}
...
...
test/recordio_unittest.cpp
View file @
f8c188a7
...
...
@@ -318,7 +318,7 @@ TEST(RecordIOTest, write_read_random) {
}
ASSERT_EQ
((
int
)
butil
::
RecordReader
::
END_OF_READER
,
rr
.
last_error
());
ASSERT_EQ
(
j
,
name_value_list
.
size
());
ASSERT_LE
(
str
.
size
()
-
rr
.
offset
(),
3
);
ASSERT_LE
(
str
.
size
()
-
rr
.
offset
(),
3
u
);
}
}
// namespace
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