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
a264483a
Commit
a264483a
authored
Apr 16, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-enable one case in BuiltinServiceTest.pprof
parent
57d69fd1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
33 deletions
+2
-33
process_util.cc
src/butil/process_util.cc
+2
-2
brpc_builtin_service_unittest.cpp
test/brpc_builtin_service_unittest.cpp
+0
-2
popen_unittest.cpp
test/popen_unittest.cpp
+0
-29
No files found.
src/butil/process_util.cc
View file @
a264483a
...
...
@@ -70,8 +70,8 @@ ssize_t ReadCommandLine(char* buf, size_t len, bool with_args) {
return
nr
;
}
else
{
for
(
ssize_t
i
=
0
;
i
<
nr
;
++
i
)
{
// The
result in macos is
ended with '\n'
if
(
buf
[
i
]
==
'\0'
||
buf
[
i
]
==
'\n'
)
{
// The
command in macos is separated with space and
ended with '\n'
if
(
buf
[
i
]
==
'\0'
||
buf
[
i
]
==
'\n'
||
buf
[
i
]
==
' '
)
{
return
i
;
}
}
...
...
test/brpc_builtin_service_unittest.cpp
View file @
a264483a
...
...
@@ -664,7 +664,6 @@ TEST_F(BuiltinServiceTest, pprof) {
EXPECT_FALSE
(
cntl
.
Failed
());
CheckContent
(
cntl
,
"num_symbols"
);
}
#if defined(OS_LINUX)
{
ClosureChecker
done
;
brpc
::
Controller
cntl
;
...
...
@@ -672,7 +671,6 @@ TEST_F(BuiltinServiceTest, pprof) {
EXPECT_FALSE
(
cntl
.
Failed
());
CheckContent
(
cntl
,
"brpc_builtin_service_unittest"
);
}
#endif
}
TEST_F
(
BuiltinServiceTest
,
dir
)
{
...
...
test/popen_unittest.cpp
View file @
a264483a
...
...
@@ -36,11 +36,7 @@ TEST(PopenTest, posix_popen) {
ASSERT_EQ
(
errno
,
ECHILD
);
ASSERT_TRUE
(
butil
::
StringPiece
(
oss
.
str
()).
ends_with
(
"was killed by signal 9"
));
oss
.
str
(
""
);
#if !defined(OS_LINUX)
rc
=
butil
::
read_command_output_through_popen
(
oss
,
"kill -15 $$"
);
#else
rc
=
butil
::
read_command_output_through_clone
(
oss
,
"kill -15 $$"
);
#endif
ASSERT_EQ
(
-
1
,
rc
);
ASSERT_EQ
(
errno
,
ECHILD
);
ASSERT_TRUE
(
butil
::
StringPiece
(
oss
.
str
()).
ends_with
(
"was killed by signal 15"
));
...
...
@@ -48,11 +44,7 @@ TEST(PopenTest, posix_popen) {
// TODO(zhujiashun): Fix this in macos
/*
oss.str("");
#if !defined(OS_LINUX)
ASSERT_EQ(0, butil::read_command_output_through_popen(oss, "for i in `seq 1 100000`; do echo -n '=' ; done"));
#else
ASSERT_EQ(0, butil::read_command_output_through_clone(oss, "for i in `seq 1 100000`; do echo -n '=' ; done"));
#endif
ASSERT_EQ(100000u, oss.str().length());
std::string expected;
expected.resize(100000, '=');
...
...
@@ -64,54 +56,33 @@ TEST(PopenTest, posix_popen) {
TEST
(
PopenTest
,
clone
)
{
std
::
ostringstream
oss
;
#if !defined(OS_LINUX)
int
rc
=
butil
::
read_command_output_through_popen
(
oss
,
"echo
\"
Hello World
\"
"
);
#else
int
rc
=
butil
::
read_command_output_through_clone
(
oss
,
"echo
\"
Hello World
\"
"
);
#endif
ASSERT_EQ
(
0
,
rc
)
<<
berror
(
errno
);
ASSERT_EQ
(
"Hello World
\n
"
,
oss
.
str
());
oss
.
str
(
""
);
#if !defined(OS_LINUX)
rc
=
butil
::
read_command_output_through_popen
(
oss
,
"exit 1"
);
#else
rc
=
butil
::
read_command_output_through_clone
(
oss
,
"exit 1"
);
#endif
ASSERT_EQ
(
1
,
rc
)
<<
berror
(
errno
);
ASSERT_TRUE
(
oss
.
str
().
empty
())
<<
oss
.
str
();
oss
.
str
(
""
);
#if !defined(OS_LINUX)
rc
=
butil
::
read_command_output_through_popen
(
oss
,
"kill -9 $$"
);
#else
rc
=
butil
::
read_command_output_through_clone
(
oss
,
"kill -9 $$"
);
#endif
ASSERT_EQ
(
-
1
,
rc
);
ASSERT_EQ
(
errno
,
ECHILD
);
ASSERT_TRUE
(
butil
::
StringPiece
(
oss
.
str
()).
ends_with
(
"was killed by signal 9"
));
oss
.
str
(
""
);
#if !defined(OS_LINUX)
rc
=
butil
::
read_command_output_through_popen
(
oss
,
"kill -15 $$"
);
#else
rc
=
butil
::
read_command_output_through_clone
(
oss
,
"kill -15 $$"
);
#endif
ASSERT_EQ
(
-
1
,
rc
);
ASSERT_EQ
(
errno
,
ECHILD
);
ASSERT_TRUE
(
butil
::
StringPiece
(
oss
.
str
()).
ends_with
(
"was killed by signal 15"
));
oss
.
str
(
""
);
#if !defined(OS_LINUX)
ASSERT_EQ
(
0
,
butil
::
read_command_output_through_popen
(
oss
,
"for i in `seq 1 100000`; do echo -n '=' ; done"
));
#else
ASSERT_EQ
(
0
,
butil
::
read_command_output_through_clone
(
oss
,
"for i in `seq 1 100000`; do echo -n '=' ; done"
));
#endif
ASSERT_EQ
(
100000u
,
oss
.
str
().
length
());
std
::
string
expected
;
expected
.
resize
(
100000
,
'='
);
ASSERT_EQ
(
expected
,
oss
.
str
());
}
struct
CounterArg
{
volatile
int64_t
counter
;
volatile
bool
stop
;
...
...
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