test: timer: Add a 32 bit wraparound test
Add a test which catches a timer running longer than the nanosecond resolution of 32 bits. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
b523982920
commit
74fb6ec3dc
1 changed files with 13 additions and 0 deletions
|
@ -81,6 +81,19 @@ protected:
|
|||
return TestFail;
|
||||
}
|
||||
|
||||
/*
|
||||
* 32 bit wrap test
|
||||
* Nanosecond resolution in a 32 bit value wraps at 4.294967
|
||||
* seconds (0xFFFFFFFF / 1000000)
|
||||
*/
|
||||
timer.start(4295);
|
||||
dispatcher->processEvents();
|
||||
|
||||
if (timer.isRunning() || timer.jitter() > 50) {
|
||||
cout << "Timer expiration test failed" << endl;
|
||||
return TestFail;
|
||||
}
|
||||
|
||||
/* Timer restart. */
|
||||
timer.start(500);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue