Merge lp:~sil2100/unity/tests_glib_timeout_modifications into lp:unity
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Marco Trevisan (Treviño) | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2936 | ||||
Proposed branch: | lp:~sil2100/unity/tests_glib_timeout_modifications | ||||
Merge into: | lp:unity | ||||
Diff against target: |
71 lines (+12/-21) 1 file modified
tests/test_glib_source.cpp (+12/-21) |
||||
To merge this branch: | bzr merge lp:~sil2100/unity/tests_glib_timeout_modifications | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
PS Jenkins bot | continuous-integration | Pending | |
Review via email: mp+135883@code.launchpad.net |
Commit message
Change some test_glib_source unit tests. Those tests are measuring times of execution of timeouts, which is not really suitable for unit testing. Those tests are also failing sometimes on ARM machines, as the timeouts are longer than expected. We're dropping time measurement from these tests, only testing if the timeouts actually happen, because that seems enough.
Description of the change
Change for comment.
- Problem:
3 tests from the test_glib_
- Fix:
Remove time measurement in the glib::Timeout failing test functions. Instead, all that we need is actually just making sure that the one-shot and multiple-shots just work (i.e. the callbacks are executed). We don't really care if the timeouts happen a bit later, since we can't do anything about that really if the hardware has issues.
- Tests:
N/A
The MultipleShotsRun test doesn't look very useful now as it waits until the callback count is 6, then checks that it is 6. Also, what happens if the callback count never increments? The other test changes look appropriate.
Perhaps it should test that callback count is within a given range, but I'm unsure of the appropriate tolerance. Just a suggestion: meout, MultipleShotsRun) call_count = 0; ckContinue) ; :WaitForTimeout MSec(650) ; TRUE(timeout. IsRunning( )); TRUE(callback_ called) ; GE(callback_ call_count, 5); LT(callback_ call_count, 7);
TEST(TestGLibTi
{
callback_called = false;
callback_
{
Timeout timeout(100, &OnSourceCallba
Utils:
EXPECT_
}
EXPECT_
EXPECT_
EXPECT_
}