mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
Fix GetTimeOfDayClock_test for race condition. #87
This commit is contained in:
parent
0b823bb6f2
commit
93b683540d
@ -6,8 +6,6 @@
|
||||
#include "trick/Clock.hh"
|
||||
#include "trick/clock_proto.h"
|
||||
#include "trick/GetTimeOfDayClock.hh"
|
||||
#include "trick/TPROCTEClock.hh"
|
||||
#include "trick/BC635Clock.hh"
|
||||
#include "trick/JobData.hh"
|
||||
|
||||
namespace Trick {
|
||||
|
@ -116,7 +116,13 @@ TEST_F(GetTimeOfDayClockTest, ClockSpin) {
|
||||
tim_curr = timclk->wall_clock_time();
|
||||
|
||||
dClk.clock_spin(tim_curr + spin_time);
|
||||
EXPECT_EQ((timclk->wall_clock_time() - tim_curr), spin_time);
|
||||
|
||||
// I think we have to account for a race condition between
|
||||
// wall_clock_time() and the execution time of this test code. (J.Penn)
|
||||
// We know that the time difference must be at least as long as the spin_time.
|
||||
EXPECT_GE((timclk->wall_clock_time() - tim_curr), spin_time);
|
||||
// But, it can't be much longer. Allow 2 micro-seconds to allow for code execution time.
|
||||
EXPECT_LE((timclk->wall_clock_time() - tim_curr), spin_time+2);
|
||||
|
||||
delete timclk;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user