Skip to content

Rtostimer tests #4947

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 3 commits into from
Oct 19, 2017
Merged

Rtostimer tests #4947

merged 3 commits into from
Oct 19, 2017

Conversation

fkjagodzinski
Copy link
Member

Description

RTOS RtosTimer:

  • added unit tests,
  • reworked API docs based on CMSIS-RTOS2 API docs.

Status

READY

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 21, 2017

retest uvisor

1 similar comment
@0xc0170
Copy link
Contributor

0xc0170 commented Aug 22, 2017

retest uvisor

@fkjagodzinski
Copy link
Member Author

cc @bulislaw

osStatus stat = timer.stop();
TEST_ASSERT_EQUAL(osErrorResource, stat);

int32_t slots = sem.wait(0);
Copy link
Member

Choose a reason for hiding this comment

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

Why do we do that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since Semaphore has its own tests this assert is actually redundant. I'll fix that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

osStatus stat = timer.stop();
TEST_ASSERT_EQUAL(osErrorResource, stat);

int32_t slots = sem.wait(0);
Copy link
Member

Choose a reason for hiding this comment

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

Why? We should assume in this tests semaphores work fine (they have their own tests).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

* Then timer stops
* and elapsed time matches given delay
*/
void test_correct_delay()
Copy link
Member

Choose a reason for hiding this comment

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

What's the difference between this and test_oneshot_not_restarted

Copy link
Member Author

Choose a reason for hiding this comment

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

Since other test cases already check the accuracy of delays I removed this one.

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

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

@0xc0170 could you have a look

@bulislaw
Copy link
Member

/morph test

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 1118

Build failed!

@bulislaw
Copy link
Member

/morph test

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 1137

Test failed!


using namespace utest::v1;

#define THREAD_STACK_SIZE 512
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not used anywhere, neither creating multiple threads. Is the line 22 above also valid?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. I'll remove that.


sem.wait(0);
stat = timer.start(TEST_DELAY_MS);
uint32_t t1 = us_ticker_read();
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recomend using Timer class instead of us ticker read to capture the duration (C++ classes should provide all its needed)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll update time measurement with Timers.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 4, 2017

@fkjagodzinski Any update?

@theotherjimmy
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 1354

Test failed!

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 22, 2017

@fkjagodzinski please look at failures, related to this changeset

@fkjagodzinski
Copy link
Member Author

I suppose the ci/morph-test is failing because of -DMBED_TRAP_ERRORS_ENABLED=1.

Tests need to check osStatus returned by RtosTimer::stop() and RtosTimer::start(), e.g. here. Since these methods call EvrRtxTimerError this leads to test failure when compiled with --profile=debug.

What is the preferred solution? Is it possible to use another profile for these tests?

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 22, 2017

What is the preferred solution? Is it possible to use another profile for these tests?

One way could be to separate that failure to another test unit that would catch it via host script - that would pass if it catches the failure via serial. We got some tests like that already , can't recall from top of my head any now.

@c1728p9 or @pan- Any other suggestions?

@c1728p9
Copy link
Contributor

c1728p9 commented Sep 22, 2017

I would recommend adding an installable hook/callback into either error or EvrRtx*Error and assert that it is called in the test if the API is misused.

Redefine error() as noop to fix tests being aborted when compiled
with -DMBED_TRAP_ERRORS_ENABLED=1.
@fkjagodzinski
Copy link
Member Author

Pushed a fix that overrides error(). I'm not entirely sure if this is a correct approach though.

* which aborts test program.
*/
#if defined(MBED_TRAP_ERRORS_ENABLED) && MBED_TRAP_ERRORS_ENABLED
void error(const char* format, ...) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we validate in the function that causes an error it actually happens by setting some flag here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't that going too deep into internals? The RtosTimer API does not say anything about calling error().

Copy link
Member

Choose a reason for hiding this comment

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

True, you're right.

@theotherjimmy
Copy link
Contributor

@c1728p9 @bulislaw Are you happy with the current version of this patch?

@mbed-ci
Copy link

mbed-ci commented Oct 9, 2017

Build : SUCCESS

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

@mbed-ci
Copy link

mbed-ci commented Oct 13, 2017

Build : SUCCESS

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

Triggering tests

/test mbed-os

@mbed-ci
Copy link

mbed-ci commented Oct 13, 2017

@mbed-ci
Copy link

mbed-ci commented Oct 16, 2017

@fkjagodzinski
Copy link
Member Author

Unless anyone has any comments, the PR is ready. I don't have any more updates to push.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 17, 2017

Unless anyone has any comments, the PR is ready. I don't have any more updates to push.

We will rerun uvisor CI once their fix lands,m then this should be ready for integration

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 18, 2017

/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Oct 18, 2017

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Oct 18, 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