Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
ee52a28f
Commit
ee52a28f
authored
Sep 24, 2015
by
Marcin Siodelski
Browse files
[master] Merge branch 'trac4039'
parents
4c736f8a
ef31a8bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcpsrv/tests/timer_mgr_unittest.cc
View file @
ee52a28f
...
...
@@ -350,10 +350,10 @@ TEST_F(TimerMgrTest, cancel) {
// actually called.
TEST_F
(
TimerMgrTest
,
scheduleTimers
)
{
// Register two timers: 'timer1' and 'timer2'. The first timer will
// be executed at the
1
ms interval. The second one at the
5
ms
// be executed at the
50
ms interval. The second one at the
100
ms
// interval.
ASSERT_NO_FATAL_FAILURE
(
registerTimer
(
"timer1"
,
1
));
ASSERT_NO_FATAL_FAILURE
(
registerTimer
(
"timer2"
,
5
));
ASSERT_NO_FATAL_FAILURE
(
registerTimer
(
"timer1"
,
50
));
ASSERT_NO_FATAL_FAILURE
(
registerTimer
(
"timer2"
,
100
));
// Kick in the timers.
ASSERT_NO_THROW
(
timer_mgr_
->
setup
(
"timer1"
));
...
...
@@ -362,25 +362,25 @@ TEST_F(TimerMgrTest, scheduleTimers) {
// We can start the worker thread before we even kick in the timers.
ASSERT_NO_THROW
(
timer_mgr_
->
startThread
());
// Run IfaceMgr::receive6() in the loop for
5
00ms. This function
// Run IfaceMgr::receive6() in the loop for
10
00ms. This function
// will read data from the watch sockets created when the timers
// were registered. The data is delivered to the watch sockets
// at the interval of the timers, which should break the blocking
// call to receive6(). As a result, the callbacks associated
// with the watch sockets should be called.
doWait
(
5
00
);
doWait
(
10
00
);
// Stop the worker thread, which would halt the execution of
// the timers.
ASSERT_NO_THROW
(
timer_mgr_
->
stopThread
(
true
));
// We have been running the timer for
5
00ms at the interval of
//
1
ms. The maximum number of callbacks is
50
0. However, the
// We have been running the timer for
10
00ms at the interval of
//
50
ms. The maximum number of callbacks is
2
0. However, the
// callback itself takes time. Stoping the thread takes time.
// So, the real number differs significantly. We don't know
// exactly how many have been executed. It should be more
// than 10 for sure. But we really made up the numbers here.
EXPECT_GT
(
calls_count_
[
"timer1"
],
25
);
EXPECT_GT
(
calls_count_
[
"timer1"
],
10
);
// For the second timer it should be more than 5.
EXPECT_GT
(
calls_count_
[
"timer2"
],
5
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment