Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
018879aa
Commit
018879aa
authored
9 years ago
by
Vijay Pai
Browse files
Options
Downloads
Patches
Plain Diff
Set up poll overrides
parent
cf4daebe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/cpp/end2end/async_end2end_test.cc
+10
-7
10 additions, 7 deletions
test/cpp/end2end/async_end2end_test.cc
with
10 additions
and
7 deletions
test/cpp/end2end/async_end2end_test.cc
+
10
−
7
View file @
018879aa
...
...
@@ -67,10 +67,10 @@ namespace {
void
*
tag
(
int
i
)
{
return
(
void
*
)(
intptr_t
)
i
;
}
#ifdef GPR_POSIX_SOCKET
static
int
assert_
non_blocking_poll
(
struct
pollfd
*
pfds
,
nfds_t
nfds
,
static
int
non_blocking_poll
(
struct
pollfd
*
pfds
,
nfds_t
nfds
,
int
timeout
)
{
GPR_ASSERT
(
timeout
==
0
);
return
poll
(
pfds
,
nfds
,
timeout
);
/* ignore timeout and always use timeout 0 */
return
poll
(
pfds
,
nfds
,
0
);
}
class
PollOverride
{
...
...
@@ -89,7 +89,7 @@ class PollOverride {
class
PollingOverrider
:
public
PollOverride
{
public:
explicit
PollingOverrider
(
bool
allow_blocking
)
:
PollOverride
(
allow_blocking
?
poll
:
assert_
non_blocking_poll
)
{}
:
PollOverride
(
allow_blocking
?
poll
:
non_blocking_poll
)
{}
};
#else
class
PollingOverrider
{
...
...
@@ -180,9 +180,11 @@ class Verifier {
class
AsyncEnd2endTest
:
public
::
testing
::
TestWithParam
<
bool
>
{
protected:
AsyncEnd2endTest
()
:
poll_override_
(
GetParam
())
{}
AsyncEnd2endTest
()
{}
void
SetUp
()
GRPC_OVERRIDE
{
poll_overrider_
.
reset
(
new
PollingOverrider
(
!
GetParam
()));
int
port
=
grpc_pick_unused_port_or_die
();
server_address_
<<
"localhost:"
<<
port
;
...
...
@@ -202,6 +204,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> {
cq_
->
Shutdown
();
while
(
cq_
->
Next
(
&
ignored_tag
,
&
ignored_ok
))
;
poll_overrider_
.
reset
();
}
void
ResetStub
()
{
...
...
@@ -250,7 +253,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> {
grpc
::
testing
::
EchoTestService
::
AsyncService
service_
;
std
::
ostringstream
server_address_
;
PollingOverrider
poll_override_
;
std
::
unique_ptr
<
PollingOverrider
>
poll_override
r
_
;
};
TEST_P
(
AsyncEnd2endTest
,
SimpleRpc
)
{
...
...
@@ -1089,7 +1092,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
Verifier
(
GetParam
()).
Expect
(
7
,
true
).
Verify
(
cq_
.
get
());
// This is expected to fail in all cases i.e for all values of
// server_try_cancel. This is beca
s
ue at this point, either there are no
// server_try_cancel. This is becau
s
e at this point, either there are no
// more msgs from the client (because client called WritesDone) or the RPC
// is cancelled on the server
srv_stream
.
Read
(
&
recv_request
,
tag
(
8
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment