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
9f61b4c8
Commit
9f61b4c8
authored
Sep 19, 2017
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix warnings/errors of UT in fedora 26
parent
0ae9fe7c
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
32 additions
and
94 deletions
+32
-94
addressbook.proto
test/addressbook.proto
+2
-0
addressbook1.proto
test/addressbook1.proto
+1
-0
addressbook_encode_decode.proto
test/addressbook_encode_decode.proto
+1
-0
addressbook_map.proto
test/addressbook_map.proto
+1
-0
brpc_channel_unittest.cpp
test/brpc_channel_unittest.cpp
+1
-1
brpc_esp_protocol_unittest.cpp
test/brpc_esp_protocol_unittest.cpp
+0
-5
brpc_http_rpc_protocol_unittest.cpp
test/brpc_http_rpc_protocol_unittest.cpp
+0
-5
brpc_hulu_pbrpc_protocol_unittest.cpp
test/brpc_hulu_pbrpc_protocol_unittest.cpp
+0
-5
brpc_mongo_protocol_unittest.cpp
test/brpc_mongo_protocol_unittest.cpp
+0
-5
brpc_nova_pbrpc_protocol_unittest.cpp
test/brpc_nova_pbrpc_protocol_unittest.cpp
+0
-5
brpc_public_pbrpc_protocol_unittest.cpp
test/brpc_public_pbrpc_protocol_unittest.cpp
+0
-5
brpc_socket_map_unittest.cpp
test/brpc_socket_map_unittest.cpp
+6
-11
brpc_sofa_pbrpc_protocol_unittest.cpp
test/brpc_sofa_pbrpc_protocol_unittest.cpp
+0
-5
brpc_uri_unittest.cpp
test/brpc_uri_unittest.cpp
+1
-4
bthread_butex_unittest.cpp
test/bthread_butex_unittest.cpp
+1
-1
bthread_cond_unittest.cpp
test/bthread_cond_unittest.cpp
+2
-11
bthread_execution_queue_unittest.cpp
test/bthread_execution_queue_unittest.cpp
+0
-2
bthread_ping_pong_unittest.cpp
test/bthread_ping_pong_unittest.cpp
+1
-1
bthread_unittest.cpp
test/bthread_unittest.cpp
+0
-11
bvar_variable_unittest.cpp
test/bvar_variable_unittest.cpp
+7
-4
flat_map_unittest.cpp
test/flat_map_unittest.cpp
+0
-9
iobuf_unittest.cpp
test/iobuf_unittest.cpp
+1
-1
message.proto
test/message.proto
+1
-0
repeated.proto
test/repeated.proto
+1
-0
security_unittest.cc
test/security_unittest.cc
+5
-3
No files found.
test/addressbook.proto
View file @
9f61b4c8
syntax
=
"proto2"
;
package
addressbook
;
message
Person
{
required
string
name
=
1
;
...
...
test/addressbook1.proto
View file @
9f61b4c8
syntax
=
"proto2"
;
message
Ext
{
optional
fixed32
age
=
2
;
required
bytes
databyte
=
3
;
...
...
test/addressbook_encode_decode.proto
View file @
9f61b4c8
syntax
=
"proto2"
;
message
ExtEncDec
{
optional
fixed32
Aa_ge_Z040_
=
2
;
optional
bytes
databyte_Z040_std_Z058__Z058_string_Z041_
=
3
;
...
...
test/addressbook_map.proto
View file @
9f61b4c8
syntax
=
"proto2"
;
message
AddressNoMap
{
required
string
addr
=
1
;
}
...
...
test/brpc_channel_unittest.cpp
View file @
9f61b4c8
...
...
@@ -43,7 +43,6 @@ void SendRpcResponse(int64_t correlation_id, Controller* cntl,
}
// policy
}
// brpc
namespace
{
int
main
(
int
argc
,
char
*
argv
[])
{
brpc
::
FLAGS_idle_timeout_second
=
0
;
brpc
::
FLAGS_max_connection_pool_size
=
0
;
...
...
@@ -52,6 +51,7 @@ int main(int argc, char* argv[]) {
return
RUN_ALL_TESTS
();
}
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
...
...
test/brpc_esp_protocol_unittest.cpp
View file @
9f61b4c8
...
...
@@ -27,11 +27,6 @@ int main(int argc, char* argv[]) {
}
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
static
const
std
::
string
EXP_REQUEST
=
"hello"
;
static
const
std
::
string
EXP_RESPONSE
=
"world"
;
...
...
test/brpc_http_rpc_protocol_unittest.cpp
View file @
9f61b4c8
...
...
@@ -40,11 +40,6 @@ int main(int argc, char* argv[]) {
}
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
static
const
std
::
string
EXP_REQUEST
=
"hello"
;
static
const
std
::
string
EXP_RESPONSE
=
"world"
;
...
...
test/brpc_hulu_pbrpc_protocol_unittest.cpp
View file @
9f61b4c8
...
...
@@ -28,11 +28,6 @@ int main(int argc, char* argv[]) {
}
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
static
const
std
::
string
EXP_REQUEST
=
"hello"
;
static
const
std
::
string
EXP_RESPONSE
=
"world"
;
...
...
test/brpc_mongo_protocol_unittest.cpp
View file @
9f61b4c8
...
...
@@ -29,11 +29,6 @@ int main(int argc, char* argv[]) {
}
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
static
const
std
::
string
EXP_REQUEST
=
"hello"
;
static
const
std
::
string
EXP_RESPONSE
=
"world"
;
...
...
test/brpc_nova_pbrpc_protocol_unittest.cpp
View file @
9f61b4c8
...
...
@@ -21,11 +21,6 @@
#include "echo.pb.h"
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
static
const
std
::
string
EXP_REQUEST
=
"hello"
;
static
const
std
::
string
EXP_RESPONSE
=
"world"
;
...
...
test/brpc_public_pbrpc_protocol_unittest.cpp
View file @
9f61b4c8
...
...
@@ -28,11 +28,6 @@ int main(int argc, char* argv[]) {
}
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
static
const
std
::
string
EXP_REQUEST
=
"hello"
;
static
const
std
::
string
EXP_RESPONSE
=
"world"
;
...
...
test/brpc_socket_map_unittest.cpp
View file @
9f61b4c8
...
...
@@ -18,17 +18,6 @@ DECLARE_int32(max_connection_pool_size);
namespace
{
butil
::
EndPoint
g_endpoint
;
int
main
(
int
argc
,
char
*
argv
[])
{
butil
::
str2endpoint
(
"127.0.0.1:12345"
,
&
g_endpoint
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
void
*
worker
(
void
*
)
{
const
int
ROUND
=
2
;
...
...
@@ -136,3 +125,9 @@ TEST_F(SocketMapTest, max_pool_size) {
}
}
}
//namespace
int
main
(
int
argc
,
char
*
argv
[])
{
butil
::
str2endpoint
(
"127.0.0.1:12345"
,
&
g_endpoint
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
test/brpc_sofa_pbrpc_protocol_unittest.cpp
View file @
9f61b4c8
...
...
@@ -28,11 +28,6 @@ int main(int argc, char* argv[]) {
}
namespace
{
void
*
RunClosure
(
void
*
arg
)
{
google
::
protobuf
::
Closure
*
done
=
(
google
::
protobuf
::
Closure
*
)
arg
;
done
->
Run
();
return
NULL
;
}
static
const
std
::
string
EXP_REQUEST
=
"hello"
;
static
const
std
::
string
EXP_RESPONSE
=
"world"
;
...
...
test/brpc_uri_unittest.cpp
View file @
9f61b4c8
...
...
@@ -456,10 +456,7 @@ TEST(URITest, query_remover_no_modify) {
++
qr
;
++
qr
;
ASSERT_FALSE
(
qr
);
ASSERT_EQ
(
qr
.
modified_query
(),
"key1=value1&key2=value2&key3=value3"
);
// if the query string is not modified, the returned value
// should be a reference to the original string
ASSERT_EQ
(
qr
.
modified_query
().
data
(),
query
.
data
());
ASSERT_EQ
(
qr
.
modified_query
(),
query
);
}
TEST
(
URITest
,
query_remover_key_value_not_changed_after_modified_query
)
{
...
...
test/bthread_butex_unittest.cpp
View file @
9f61b4c8
...
...
@@ -43,7 +43,7 @@ void* joiner(void* arg) {
LOG
(
FATAL
)
<<
"fail to join thread_"
<<
th
-
(
bthread_t
*
)
arg
;
}
long
elp
=
butil
::
gettimeofday_us
()
-
t1
;
EXPECT_LE
(
labs
(
elp
-
(
th
-
(
bthread_t
*
)
arg
+
1
)
*
100000L
),
5
000L
)
EXPECT_LE
(
labs
(
elp
-
(
th
-
(
bthread_t
*
)
arg
+
1
)
*
100000L
),
10
000L
)
<<
"timeout when joining thread_"
<<
th
-
(
bthread_t
*
)
arg
;
LOG
(
INFO
)
<<
"Joined thread "
<<
*
th
<<
" at "
<<
elp
<<
"us ["
<<
bthread_self
()
<<
"]"
;
...
...
test/bthread_cond_unittest.cpp
View file @
9f61b4c8
...
...
@@ -25,15 +25,6 @@ std::vector<long> wake_time;
volatile
bool
stop
=
false
;
const
long
SIGNAL_INTERVAL_US
=
10000
;
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
std
::
vector
<
bthread_t
>&
wake_tid
)
{
for
(
size_t
i
=
0
;
i
<
wake_tid
.
size
();
++
i
)
{
os
<<
i
<<
":"
<<
wake_tid
[
i
]
<<
' '
;
}
return
os
;
}
void
*
signaler
(
void
*
void_arg
)
{
Arg
*
a
=
(
Arg
*
)
void_arg
;
signal_start_time
=
butil
::
gettimeofday_us
();
...
...
@@ -105,7 +96,7 @@ TEST(CondTest, sanity) {
long
delta
=
wake_time
[
i
]
-
last_time
-
SIGNAL_INTERVAL_US
;
EXPECT_GT
(
wake_time
[
i
],
last_time
);
square_sum
+=
delta
*
delta
;
EXPECT_LT
(
abs
(
delta
),
2000L
)
<<
"error["
<<
i
<<
"]="
<<
delta
<<
"="
EXPECT_LT
(
l
abs
(
delta
),
2000L
)
<<
"error["
<<
i
<<
"]="
<<
delta
<<
"="
<<
wake_time
[
i
]
<<
" - "
<<
last_time
;
}
printf
(
"Average error is %fus
\n
"
,
sqrt
(
square_sum
/
std
::
max
(
nbeforestop
,
1UL
)));
...
...
@@ -118,7 +109,7 @@ TEST(CondTest, sanity) {
EXPECT_EQ
(
NW
,
count
.
size
());
for
(
size_t
i
=
0
;
i
<
NW
;
++
i
)
{
}
size_t
avg_count
=
wake_tid
.
size
()
/
count
.
size
(
);
int
avg_count
=
(
int
)(
wake_tid
.
size
()
/
count
.
size
()
);
for
(
std
::
map
<
bthread_t
,
int
>::
iterator
it
=
count
.
begin
();
it
!=
count
.
end
();
++
it
)
{
ASSERT_LE
(
abs
(
it
->
second
-
avg_count
),
1
)
...
...
test/bthread_execution_queue_unittest.cpp
View file @
9f61b4c8
...
...
@@ -70,8 +70,6 @@ TEST_F(ExecutionQueueTest, single_thread) {
ASSERT_TRUE
(
stopped
);
}
const
static
int
OPS_PER_THREAD
=
1000000
;
struct
PushArg
{
bthread
::
ExecutionQueueId
<
LongIntTask
>
id
;
butil
::
atomic
<
int64_t
>
total_num
;
...
...
test/bthread_ping_pong_unittest.cpp
View file @
9f61b4c8
...
...
@@ -160,7 +160,7 @@ TEST(PingPongTest, ping_pong) {
if
(
!
FLAGS_use_futex
&&
!
FLAGS_use_butex
)
{
// send the seed data.
char
seed
=
255
;
unsigned
char
seed
=
255
;
ASSERT_EQ
(
1L
,
write
(
pipe1
[
1
],
&
seed
,
1
));
}
else
if
(
FLAGS_use_futex
)
{
++*
arg1
->
wait_addr
;
...
...
test/bthread_unittest.cpp
View file @
9f61b4c8
...
...
@@ -239,17 +239,6 @@ TEST_F(BthreadTest, bthread_join) {
ASSERT_EQ
(
0
,
bthread_start_urgent
(
&
th
,
NULL
,
join_self
,
NULL
));
}
void
*
small_func
(
void
*
)
{
LOG
(
INFO
)
<<
"hello"
;
return
NULL
;
}
void
*
small_but_sleep_awhile_func
(
void
*
)
{
LOG
(
INFO
)
<<
"hello2"
;
bthread_usleep
(
1000
);
return
NULL
;
}
void
*
change_errno
(
void
*
arg
)
{
errno
=
(
intptr_t
)
arg
;
return
NULL
;
...
...
test/bvar_variable_unittest.cpp
View file @
9f61b4c8
...
...
@@ -21,8 +21,12 @@ namespace bvar {
DECLARE_bool
(
bvar_log_dumpped
);
}
namespace
{
// overloading for operator<< does not work for gflags>=2.1
template
<
typename
T
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
std
::
vector
<
T
>&
vec
)
{
std
::
string
vec2string
(
const
std
::
vector
<
T
>&
vec
)
{
std
::
ostringstream
os
;
os
<<
'['
;
if
(
!
vec
.
empty
())
{
os
<<
vec
[
0
];
...
...
@@ -31,10 +35,9 @@ std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
}
}
os
<<
']'
;
return
os
;
return
os
.
str
()
;
}
namespace
{
class
VariableTest
:
public
testing
::
Test
{
protected
:
void
SetUp
()
{
...
...
@@ -307,7 +310,7 @@ TEST_F(VariableTest, latency_recorder) {
std
::
vector
<
std
::
string
>
names
;
bvar
::
Variable
::
list_exposed
(
&
names
);
std
::
sort
(
names
.
begin
(),
names
.
end
());
ASSERT_EQ
(
11UL
,
names
.
size
())
<<
names
;
ASSERT_EQ
(
11UL
,
names
.
size
())
<<
vec2string
(
names
)
;
ASSERT_EQ
(
"foo_bar_count"
,
names
[
0
]);
ASSERT_EQ
(
"foo_bar_latency"
,
names
[
1
]);
ASSERT_EQ
(
"foo_bar_latency_50"
,
names
[
2
]);
...
...
test/flat_map_unittest.cpp
View file @
9f61b4c8
...
...
@@ -176,15 +176,6 @@ TEST_F(FlatMapTest, seek_by_string_piece) {
ASSERT_TRUE
(
m
.
seek
(
k3
)
==
NULL
);
}
inline
int
my_strcaseequal
(
const
char
*
s1
,
const
char
*
s2
,
size_t
n
)
{
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
if
(
butil
::
ascii_tolower
(
s1
[
i
])
!=
butil
::
ascii_tolower
(
s2
[
i
]))
{
return
-
1
;
}
}
return
0
;
}
TEST_F
(
FlatMapTest
,
to_lower
)
{
for
(
int
c
=
-
128
;
c
<
128
;
++
c
)
{
ASSERT_EQ
((
char
)
::
tolower
(
c
),
butil
::
ascii_tolower
(
c
))
<<
"c="
<<
c
;
...
...
test/iobuf_unittest.cpp
View file @
9f61b4c8
...
...
@@ -1324,7 +1324,7 @@ void* cut_into_fd(void* arg) {
butil
::
IOBuf
out
;
out
.
append
(
&
to_write
,
sizeof
(
int
));
CHECK_EQ
(
out
.
pcut_into_file_descriptor
(
fd
,
offset
+
sizeof
(
int
)
*
i
),
sizeof
(
int
));
(
ssize_t
)
sizeof
(
int
));
}
return
NULL
;
}
...
...
test/message.proto
View file @
9f61b4c8
syntax
=
"proto2"
;
package
gss
.
message
;
//------------------------------------gss_src_req_t---------------------------------
...
...
test/repeated.proto
View file @
9f61b4c8
syntax
=
"proto2"
;
message
Dummy
{}
message
RepeatedMessage
{
...
...
test/security_unittest.cc
View file @
9f61b4c8
...
...
@@ -155,6 +155,11 @@ TEST(SecurityTest, TCMALLOC_TEST(MemoryAllocationRestrictionsNewArray)) {
#define DISABLE_ON_IOS_AND_WIN_AND_TSAN(function) function
#endif
// FIXME(gejun): following logic of the case, it definitely should crash, I don't
// know why it's judged as failure.
#if defined(FixedNewOverflow)
// There are platforms where these tests are known to fail. We would like to
// be able to easily check the status on the bots, but marking tests as
// FAILS_ is too clunky.
...
...
@@ -173,9 +178,6 @@ void OverflowTestsSoftExpectTrue(bool overflow_detected) {
}
}
// FIXME(gejun): following logic of the case, it definitely should crash, I don't
// know why it's judged as failure.
#if defined(FixedNewOverflow)
// Test array[TooBig][X] and array[X][TooBig] allocations for int overflows.
// IOS doesn't honor nothrow, so disable the test there.
// Crashes on Windows Dbg builds, disable there as well.
...
...
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