Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

common-io: Refactoring Timer test cases #1887

Merged

Conversation

osloapps-max
Copy link
Contributor

Description

  • Refactored flash test cases to use TEST_PROTECT sections to guard against cascading failures.
  • Updated the thresholds used in AFWP_IotTimer_Running and AFWP_IotTimer_Stop. This as the worst case scenario could be an 2ms offset (+-1ms per vTaskDelay). Also added the factor "5" as this was missing.
  • Updated return value checks for iot_timer_delay() to also check for IOT_TIMER_NOT_RUNNING based on API description.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • My code is Linted.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -49,7 +49,7 @@
/* Globals values which can be overwritten by the test
* framework invoking these tests */
/*-----------------------------------------------------------*/
extern IotTimerHandle_t gIotTimerHandle;
IotTimerHandle_t gIotTimerHandle;
Copy link

Choose a reason for hiding this comment

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

Please keep it extern - in the case where application already uses the timer - you can still open the handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vjjunnut Is this a valid use case in the test system? Are you running tests in parallel to applications that already allocate the timer?

Choose a reason for hiding this comment

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

Test application can use the time in logging which uses these APIs - so in those cases, timer is already initialized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Much like in the Flash use-case, I don't really see how this was intended to work in the scenario you describe.

Most of the tests close the handle, the majority of the tests to not reset the handle to NULL when doing this. This means that any logging depending on this handle would get screwed as soon as the first test finish.

Strictly speaking, depending on the module you aim to test while testing it sound like it could cause headache further down the line. Maybe an alternative timer should be used for the logging purpose in this case, is that an alternative?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@qiutongs Any thought on this?

testIotTIMER_DEFAULT_DELAY_US );

/* Expect either "Not running" or "Success" */
if( lRetVal != IOT_TIMER_NOT_RUNNING )
Copy link

Choose a reason for hiding this comment

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

You need to add the iot_timer_delay after starting the timer so that semaphoreTake can be unblocked. Since we are updating the test to check for NOT_RUNNING, lets also fix the test to do the delay after starting the timer and expect the semaphore take to succeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vjjunnut II have asked this question to @lundinc2 before to what the expected behavior for calling a delay after start is. My understanding is that setting a delay before start will still result in the delay being perform from the point of "start" which means the semaphore will be unblocked as we do start the timer.

The expected behavior of "delay" being called after the timer has been started is unclear. I would imagine that it would start the "delay counter" right away but this was not what the tests implied at first which is why I have not altered the test sequence, just added a check for possible return values as these are clearly defined in the API.

Choose a reason for hiding this comment

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

The test had a bug. We can sync up internally and get back.

@dcgaws dcgaws requested a review from cobusve April 13, 2020 20:40
@qiutongs
Copy link
Contributor

qiutongs commented May 8, 2020

Sorry for the delay. I am engaging lab126 for providing the comment.

qiutongs
qiutongs previously approved these changes May 11, 2020
cobusve
cobusve previously approved these changes May 11, 2020
@qiutongs
Copy link
Contributor

/bot run checks

1 similar comment
@qiutongs
Copy link
Contributor

/bot run checks

@qiutongs
Copy link
Contributor

There is a build failure that is not related to your PR. But it needs to rebase to the latest master. Sorry for that inconvenience.

Do you mind giving me writing access to your fork? I am help rebase it.
https://github.com/osloapps-max/amazon-freertos

@qiutongs qiutongs dismissed stale reviews from cobusve and themself via bce696f May 14, 2020 00:36
@qiutongs qiutongs force-pushed the fix/common-io-timer-test-refactoring branch from 1ea7589 to bce696f Compare May 14, 2020 00:36
@qiutongs
Copy link
Contributor

/bot run checks

@qiutongs qiutongs merged commit a3e5c1e into aws:master May 14, 2020
alfred2g pushed a commit to alfred2g/amazon-freertos that referenced this pull request May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants