Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Timeout rescheduling test #12942

Merged
merged 2 commits into from
May 15, 2020
Merged

Conversation

kjbracey
Copy link
Contributor

@kjbracey kjbracey commented May 7, 2020

Summary of changes

The Timeout drift test uses rescheduling inside a callback, but it is currently disabled due to lack of stability. Rescheduling using relative timeouts inside the callback is a bad technique as it leads to drift, so I understand the test being disabled. It is better to use Ticker for a periodic callback or to use Timeout::attach_absolute.

Add a simpler test that just ensures the callback is called repeatedly - this test would detect issue #12940, and should not have stability problems.

Convert Timeout test to Chrono

Now tests only the Chrono attach(duration) method, not the deprecated attach and attach_us calls.

Impact of changes

Migration actions required

Documentation


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

Reviewers


The `Timeout` drift test uses rescheduling inside a callback, but it is
currently disabled due to lack of stability. Rescheduling using relative
timeouts inside the callback is a bad technique as it leads to drift, so
I understand the test being disabled. It is better to use `Ticker` for a
periodic callback or to use `Timeout::attach_absolute`.

Add a simpler test that just ensures the callback is called repeatedly -
this test would detect issue ARMmbed#12940, and should not have stability
problems.
Now tests only the Chrono `attach(duration)` method, not the deprecated
`attach` and `attach_us` calls.
@ciarmcom ciarmcom requested review from a team May 7, 2020 15:00
@ciarmcom
Copy link
Member

ciarmcom commented May 7, 2020

@kjbracey-arm, thank you for your changes.
@ARMmbed/mbed-os-test @ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

@jeromecoutant
Copy link
Collaborator

Tests FAILED on top of master
Tests OK on top of #12941

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second commit contains not only updating to new types but also removal of drifting old unreliable tests? Shouldn't it be a separate commit to remove and then update to chrono? The diff is not that simple to review as it is.

@0xc0170
Copy link
Contributor

0xc0170 commented May 8, 2020

Thanks @jeromecoutant for testing

@kjbracey
Copy link
Contributor Author

kjbracey commented May 8, 2020

The second commit contains not only updating to new types but also removal of drifting old unreliable tests? Shouldn't it be a separate commit to remove and then update to chrono? The diff is not that simple to review as it is.

The second commit is just switching from testing deprecated APIs to testing Chrono APIs. Not changing which functionality is tested.

The unreliable drifting test is still there with the ifdef.

Can make them separate PRs if you like.

@0xc0170
Copy link
Contributor

0xc0170 commented May 8, 2020

understood, do not use AttachTester in tests (as stated in the commit), I could not see it in the diff firstly.

@mergify mergify bot added needs: CI and removed needs: review labels May 8, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented May 8, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented May 8, 2020

Test run: SUCCESS

Summary: 4 of 4 test jobs passed
Build number : 1
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented May 12, 2020

@ARMmbed/mbed-os-core Please review

@adbridge
Copy link
Contributor

Again does this actually need to go into 6.0 or can it go into the next release?

@kjbracey
Copy link
Contributor Author

No urgency at all. It's just an accompanying test for #12941, which didn't make it due to the rush to get that fix in.

@adbridge
Copy link
Contributor

As this has passed the CI we might as well take it in

@adbridge adbridge merged commit 90a8fef into ARMmbed:master May 15, 2020
@kjbracey kjbracey deleted the chrono-timeout-test branch May 20, 2020 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants