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

Update references to time values to use chrono #14941

Merged
merged 2 commits into from
Jul 30, 2021

Conversation

hazzlim
Copy link
Contributor

@hazzlim hazzlim commented Jul 21, 2021

Summary of changes

Reworked connectivity and drivers greentea tests to replace deprecated API calls with new APIs that accept std::chrono values, and updated references to time values in these tests to use std::chrono values.

This PR is picking up from #14453.

Impact of changes

Migration actions required

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] 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)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[x] Tests / results supplied as part of this PR

Verified that tests touched by this PR build with CLI 1 and CLI 2, and run with success in all cases on target board K66F. In particular, ticker tests now pass which were previously failing in CI following #14453.


Reviewers

@adbridge @kjbracey-arm @ARMmbed/mbed-os-core

Ticker test contains definition of variable total_ticks, which is unused
in the file since removal of function wait_and_print() in commit
aaa15bc
@hazzlim hazzlim added this to Awaiting review (3) in Mbed Core Jul 21, 2021
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Jul 21, 2021
@ciarmcom ciarmcom requested review from adbridge and a team July 21, 2021 13:00
@ciarmcom
Copy link
Member

@hazzlim, thank you for your changes.
@adbridge @ARMmbed/mbed-os-maintainers please review.

drivers/tests/TESTS/mbed_drivers/lp_ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/lp_ticker/main.cpp Outdated Show resolved Hide resolved

TEST_ASSERT_UINT32_WITHIN(TOLERANCE_US, MULTI_TICKER_TIME_MS * 1000, time_diff);
TEST_ASSERT_DURATION_WITHIN(TOLERANCE, MULTI_TICKER_TIME, time_diff);
Copy link
Contributor

Choose a reason for hiding this comment

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

See previous comment

Copy link
Contributor Author

@hazzlim hazzlim Jul 23, 2021

Choose a reason for hiding this comment

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

Could you clarify this comment? As TOLERANCE here is not a function like macro as TOLERANCE_US is above , it's just a constant value of 1000us.

Mbed Core automation moved this from Awaiting review (3) to Review in progress (4) Jul 23, 2021
@hazzlim hazzlim force-pushed the update-tests-to-use-chrono branch from 0a701cc to d772834 Compare July 23, 2021 16:54
@mergify mergify bot dismissed adbridge’s stale review July 23, 2021 16:54

Pull request has been modified.

@hazzlim hazzlim requested a review from adbridge July 26, 2021 09:01
drivers/tests/TESTS/mbed_drivers/lp_ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/lp_ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/lp_ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/lp_ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/ticker/main.cpp Outdated Show resolved Hide resolved
drivers/tests/TESTS/mbed_drivers/ticker/main.cpp Outdated Show resolved Hide resolved
References to time should do so using std::chrono. We reworked tests in
connectivity and drivers to use std::chrono and new APIs in order to
remove deprecation warnings resulting from deprecated API calls.
This required addition of  a macro for test assertions using std::chrono
values.

As host test "timing_drift_auto" expects time values represented as an
integral number of microseconds, we explicitly provide this in place
using "microseconds{TICKER_TIME}.count()" in the relevant ticker tests.
We recognise this is ugly, but thought it best to descriptively convert
from std::chrono to the host test's required representation.

Co-authored-by: Hari Limaye <[email protected]>
@hazzlim hazzlim force-pushed the update-tests-to-use-chrono branch from d772834 to 86c2d70 Compare July 29, 2021 13:09
@mergify mergify bot dismissed rwalton-arm’s stale review July 29, 2021 13:09

Pull request has been modified.

@hazzlim
Copy link
Contributor Author

hazzlim commented Jul 29, 2021

@rwalton-arm thank you for your review, I have addressed all comments and rebased

@rwalton-arm
Copy link
Contributor

@rwalton-arm thank you for your review, I have addressed all comments and rebased

Thanks. All looks good to me!

Mbed Core automation moved this from Review in progress (4) to Reviewer approved & awaiting CI & merge (3) Jul 29, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Jul 29, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented Jul 29, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 merged commit 3318720 into ARMmbed:master Jul 30, 2021
Mbed Core automation moved this from Reviewer approved & awaiting CI & merge (3) to Done Jul 30, 2021
@mergify mergify bot removed the ready for merge label Jul 30, 2021
@Patater Patater moved this from Done to Reported in Mbed Core Aug 6, 2021
@mbedmain mbedmain added release-version: 6.14.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Mbed Core
  
Reported
Development

Successfully merging this pull request may close these issues.

None yet

8 participants