Skip to content

Conversation

@nordic-krch
Copy link
Contributor

Fixes test which did not take into account that counter may
wrap (nrf51 has 16bit timers) and was setting alarm to wrong
value. Error was not seen on platforms with higher top value.

Fixes #24369.

Signed-off-by: Krzysztof Chruscinski krzysztof.chruscinski@nordicsemi.no

Fixes test which did not take into account that counter may
wrap (nrf51 has 16bit timers) and was setting alarm to wrong
value. Error was not seen on platforms with higher top value.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>

k_busy_wait(us/2 + i);

alarm_cfg.ticks = alarm_cfg.ticks + 2*alarm_cfg.ticks;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

test was suppose to set some alarm in the future (it is cancelled anyway) and for non wrapping (within test) counters this formula was ok but it was actually wrong and initial intention was that it is 2*ticks (2 ms from now).

Copy link
Member

Choose a reason for hiding this comment

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

and initial intention was that it is 2*ticks (2 ms from now).

The commit message would be a better place for such additional explanation.

@zephyrbot zephyrbot added the area: Tests Issues related to a particular existing or missing test label Apr 15, 2020
@mbolivar-nordic
Copy link
Contributor

The test is still failing for me. https://gist.github.com/mbolivar-nordic/8410c20dda61345b67e806d340aa6c0c

Copy link
Contributor

@mbolivar-nordic mbolivar-nordic left a comment

Choose a reason for hiding this comment

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

-1 since this is not a fix in my testing

@nordic-krch
Copy link
Contributor Author

-1 since this is not a fix in my testing

That test was spurious as it was failing only when alarm expired when counter wrapped. That was revealing a bug in the test - validation that alarm came not earlier than requested. Fixed.

Copy link
Contributor

@mbolivar-nordic mbolivar-nordic left a comment

Choose a reason for hiding this comment

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

Test is passing now so I'm happy, thanks! A couple of non-blocking style things.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why static? Just curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

puts variable in flash and not on stack.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we really so close to blowing the stack on this simple test case? I'm not objecting to it, it just looked weird.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to include processing_limit_us in the output here too, I think.

Test is checking if alarm handler is executed at request time or later.
However, validation did not take into account wrapping of the counter.
Fixed by taking into account case where counter wraps.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
@nordic-krch
Copy link
Contributor Author

i'm getting counter test failures on mps2_an385. However, locally those tests are passing. @nashif do you know who maintains counter for mps_an385?

@carlescufi
Copy link
Member

@nordic-krch there seems to be a regression in this PR: https://app.shippable.com/github/zephyrproject-rtos/zephyr/runs/69627/3/console

I have re-run CI but the failure re-appeared so this is not a false positive.

@nordic-krch
Copy link
Contributor Author

@carlescufi yes, on CI is it consistent but on my setup it is not. This test is passing on my machine and changes do not touch failing test so i think it is also failing on master.

@nordic-krch
Copy link
Contributor Author

created bug report for failing test: #24635

@nordic-krch
Copy link
Contributor Author

@carlescufi can you merge? We accidentally got green build. Root cause is known. #22904 should eventually fix it.

@carlescufi carlescufi merged commit 1a4cd71 into zephyrproject-rtos:master Apr 23, 2020
ABOSTM added a commit to ABOSTM/zephyr that referenced this pull request May 18, 2020
Since introduction of zephyrproject-rtos#24374 this test fails on STM32 boards.
Due to 1Hz frequency of RTC used, the 'diff' could be 0.
But then 'counter_us_to_ticks(dev, processing_limit_us)' is also 0.
We should allow the equality in the assert.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
carlescufi pushed a commit that referenced this pull request May 18, 2020
Since introduction of #24374 this test fails on STM32 boards.
Due to 1Hz frequency of RTC used, the 'diff' could be 0.
But then 'counter_us_to_ticks(dev, processing_limit_us)' is also 0.
We should allow the equality in the assert.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
krip-tip pushed a commit to krip-tip/zephyr-local that referenced this pull request May 30, 2020
Since introduction of zephyrproject-rtos#24374 this test fails on STM32 boards.
Due to 1Hz frequency of RTC used, the 'diff' could be 0.
But then 'counter_us_to_ticks(dev, processing_limit_us)' is also 0.
We should allow the equality in the assert.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Counter area: Debugging area: Tests Issues related to a particular existing or missing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests/drivers/counter/counter_basic_api failure on nRF51-DK

6 participants