Skip to content

Add Low Power Timer test. #5074

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

Merged
merged 1 commit into from
Oct 13, 2017
Merged

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Sep 12, 2017

Description

Add test for Low Power Timer. This test is created based on regular Timer test.

Status

READY

Migrations

NO

@mprse
Copy link
Contributor Author

mprse commented Sep 12, 2017

@bulislaw @0xc0170 Review request.

TEST_ASSERT_UINT64_WITHIN(DELTA_US, 10000, lp_timer.read_high_resolution_us());

/* Reset the timer - previous measured time should be lost now. */
lp_timer.reset();
Copy link
Member

Choose a reason for hiding this comment

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

Shall we validate the reset here? Rather than start the timer again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intention of this test case is to show that reset() function works - i.e. clears time already counted by the timer. Verification if timer counts time between starts and stops is provided in test_lptimer_time_accumulation test function.

* When read of timer elapsed time is requested.
* Then result is always 0.
*/
void test_lptimer_creation()
Copy link
Member

Choose a reason for hiding this comment

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

I would add another tests showing that stop actually works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Verification if stop() works correctly is provided in test_lptimer_time_accumulation() test function. This test case proves that timer counts time only between start and stop. Additional delay is provided when timer is stopped and it has been verified that this time is not counted by the timer.

/* This test verifies if calling start() for already
* started low power timer does nothing.
*
* Timer is already started.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Given...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be corrected, to the following form:
"Given timer is already started."
Also other test cases descriptions need to be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

* delays.
* Then the results are valid (within acceptable range).
*/
void test_lptimer_time_measurement()
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this function an template and add multiple test cases instead of duplicate the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be corrected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@theotherjimmy
Copy link
Contributor

@bulislaw Did you find the responses to your questions suitable?

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 27, 2017

bump

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 28, 2017

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1420

Build failed!

@mprse
Copy link
Contributor Author

mprse commented Sep 28, 2017

Result: FAILURE
Your command has finished executing! Here's what you wrote!
/morph test

I have checked build log on several platforms and it looks like building fails on platforms where low power timer is not available.

@mprse mprse closed this Sep 28, 2017
@sg- sg- removed the needs: CI label Sep 28, 2017
@mprse mprse reopened this Sep 28, 2017
@theotherjimmy
Copy link
Contributor

@mprse Are you planning on fixing this failure?

@mprse
Copy link
Contributor Author

mprse commented Oct 2, 2017

@theotherjimmy Added guard for boards which do not support low power timers.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 9, 2017

/morph test-nightly

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1557

Example Build failed!

@mbed-ci
Copy link

mbed-ci commented Oct 10, 2017

@studavekar
Copy link
Contributor

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2017

Build : SUCCESS

Build number : 94
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5074/

Triggering tests

/test mbed-os

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2017

@mprse
Copy link
Contributor Author

mprse commented Oct 11, 2017

Test : FAILURE

Added missing delta value, provided minor fixes (comment, style).

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2017

Build : SUCCESS

Build number : 120
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5074/

Triggering tests

/test mbed-os

@mbed-ci
Copy link

mbed-ci commented Oct 12, 2017

@mbed-ci
Copy link

mbed-ci commented Oct 12, 2017

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.

8 participants