Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
0ec3160d
Commit
0ec3160d
authored
Apr 19, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support streaming tests in point_to_point_fixture
parent
148243da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
libcaf_test/caf/test/io_dsl.hpp
libcaf_test/caf/test/io_dsl.hpp
+30
-5
No files found.
libcaf_test/caf/test/io_dsl.hpp
View file @
0ec3160d
...
@@ -157,7 +157,7 @@ public:
...
@@ -157,7 +157,7 @@ public:
// Convenience function for transmitting all "network" traffic.
// Convenience function for transmitting all "network" traffic.
void
network_traffic
()
{
void
network_traffic
()
{
r
un_exhaustively
([](
planet_type
*
x
)
{
r
epeat
([](
planet_type
*
x
)
{
return
x
->
mpx
.
try_exec_runnable
()
||
x
->
mpx
.
read_data
();
return
x
->
mpx
.
try_exec_runnable
()
||
x
->
mpx
.
read_data
();
});
});
}
}
...
@@ -165,10 +165,24 @@ public:
...
@@ -165,10 +165,24 @@ public:
// Convenience function for transmitting all "network" traffic and running
// Convenience function for transmitting all "network" traffic and running
// all executables on earth and mars.
// all executables on earth and mars.
void
exec_all
()
{
void
exec_all
()
{
run_exhaustively
(
[](
planet_type
*
x
)
{
auto
advance
=
[](
planet_type
*
x
)
{
return
x
->
mpx
.
try_exec_runnable
()
||
x
->
mpx
.
read_data
()
return
x
->
mpx
.
try_exec_runnable
()
||
x
->
mpx
.
read_data
()
||
x
->
sched
.
try_run_once
();
||
x
->
sched
.
try_run_once
();
});
};
auto
trigger_timeouts
=
[](
planet_type
*
x
)
{
auto
&
sched
=
x
->
sched
;
sched
.
clock
().
current_time
+=
x
->
credit_round_interval
;
sched
.
dispatch
();
};
for
(;;)
{
// Exhaust all messages in the system.
repeat
(
advance
);
// Try to "revive" the system by dispatching timeouts.
once_for_each
(
trigger_timeouts
);
// Stop if the timeouts didn't cause new activity.
if
(
!
on_any
(
advance
))
return
;
}
}
}
void
prepare_connection
(
planet_type
&
server
,
planet_type
&
client
,
void
prepare_connection
(
planet_type
&
server
,
planet_type
&
client
,
...
@@ -179,11 +193,22 @@ public:
...
@@ -179,11 +193,22 @@ public:
private:
private:
template
<
class
F
>
template
<
class
F
>
void
run_exhaustivel
y
(
F
f
)
{
bool
on_an
y
(
F
f
)
{
planet_type
*
planets
[]
=
{
&
earth
,
&
mars
};
planet_type
*
planets
[]
=
{
&
earth
,
&
mars
};
while
(
std
::
any_of
(
std
::
begin
(
planets
),
std
::
end
(
planets
),
f
))
return
std
::
any_of
(
std
::
begin
(
planets
),
std
::
end
(
planets
),
f
);
}
template
<
class
F
>
void
repeat
(
F
f
)
{
while
(
on_any
(
f
))
;
// rince and repeat
;
// rince and repeat
}
}
template
<
class
F
>
void
once_for_each
(
F
f
)
{
planet_type
*
planets
[]
=
{
&
earth
,
&
mars
};
std
::
for_each
(
std
::
begin
(
planets
),
std
::
end
(
planets
),
f
);
}
};
};
/// Binds `test_coordinator_fixture<Config>` to `point_to_point_fixture`.
/// Binds `test_coordinator_fixture<Config>` to `point_to_point_fixture`.
...
...
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