Skip to content

Extends test set for Thread signals #5123

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
Nov 20, 2017

Conversation

maciejbocianski
Copy link
Contributor

Description

New test suite for Thread signals

Status

READY

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 19, 2017

cc @bulislaw @c1728p9

#define SIGNAL_SET_VALUE 0x01
const int SIGNALS_TO_EMIT = 100;
const int SIGNAL_HANDLE_DELEY = 25;
#define TEST_STACK_SIZE 384 /* 512B stack on GCC_ARM compiler cause out of memory on some 16kB RAM boards */
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an old comment?


void run_set_clear(void)
{
// 1.1
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this comment mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

X. - indicates subtest number
X.1, X.2, ... - indicates subtest flow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment added

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.

Could you make sure the tests are small, actual unit tests. And that the description are clear and accurate please.

When call @a signal_clr with specified signals
Then the specified signals are cleared
*/
void test_set_clear(void)
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 not have such long tests? I think having to number and subnumber the flows means it's too complicated. Could we redesign it? Maybe split it up in separate test cases and use templates.

GREENTEA_SETUP(20, "default_auto");
/** Test signal_wait with no signals and 0 timeout

Given a thread
Copy link
Member

Choose a reason for hiding this comment

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

Can you rewrite the description to be a bit more grammatically correct please.

When wait for all signals for 1[ms] timeout
Then the @a signal_wait return with osEventTimeout
*/
void test_wait_timeout(void)
Copy link
Member

Choose a reason for hiding this comment

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

I can clearly see two test cases here (template?).


/** Test signal_set (in no wait state) and signal_wait

Given a thread with no signal wait state
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what that does reading the description.


Given a thread in signal wait state
Copy link
Member

Choose a reason for hiding this comment

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

I thin that should be rewritten to closer match the test case, something like:
Given two threads A and B
When thread A waits for a signal
and thread B calls @A signal_set
Then thread A wakes up and receives correct signal

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 28, 2017

@maciejbocianski please look at the latest review comments

@maciejbocianski
Copy link
Contributor Author

@0xc0170 @bulislaw done

}

template <int32_t signals>
void run_wiat_clear(void)
Copy link
Member

Choose a reason for hiding this comment

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

typo wiat -> wait

void run_signal_wait(void)
{
osEvent ev = Thread::signal_wait(signals, timeout);
ret_status = ev.status;
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we assert correct status here? But we pass it back to main thread?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assumed that asserting in main function will make it easier to analyze the tests

Copy link
Member

Choose a reason for hiding this comment

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

I think it works both ways, with 'where did that value came from' factor. @0xc0170 any preferences from your side?

Copy link
Contributor

Choose a reason for hiding this comment

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

My preference would be the failure as soon as it happens (in this scope in this case)

}

template <int32_t signals, uint32_t timeout>
void run_signal_wait2(void)
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 the names a bit more readable? eg signal_release_wait_release or something more abstract even

/** Test signal_clr with no signals specified

Given two threads A and B running, B with all signals already set
When execute @a signal_clr(0) with no signals specified
Copy link
Member

Choose a reason for hiding this comment

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

When thread A calls -> and similar for all of the descriptions


/** Test if any signals are set on just created thread

Given one thread running
Copy link
Member

Choose a reason for hiding this comment

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

is running or one running thread -> and something similar for other descriptions

result = true;
break;
}
/** Test signal_wait on thread with no signals already set - signals set one by one in loop
Copy link
Member

Choose a reason for hiding this comment

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

Could the first line for all test document, on a high level, what the tests asserts? Something like "Validate that set signals accumulate and cause signal wait to return"

Case("Test signal_wait with 1[ms] timeout and all signals set", test_wait_timeout<ALL_SIGNALS, 1>),
Case("Test signal_wait on thread with all signals already set", test_wait_all_already_set),
Case("Test signal_wait on thread with no signals already set", test_wait_all),
Case("Test signal_wait on thread with no signals already set - signals set one by one in loop", test_wait_all_loop)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could also validate that:

  • we can set a signal then clear or wait and then set it again
  • what happens when we set the same signal twice

sem_a.release();
}

void run_loop_wiat_clear(void)
Copy link
Member

Choose a reason for hiding this comment

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

wiat -> wait

}

template <int32_t signals1, int32_t signals2>
void run_double_wiat_clear(void)
Copy link
Member

Choose a reason for hiding this comment

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

wiat -> wait

When execute @a signal_clr(0) with no signals specified
Then thread B @a signal_clr status should be ALL_SIGNALS indicating that thread B state is unchanged
*/
void test_clear_0(void)
Copy link
Member

Choose a reason for hiding this comment

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

I don't like 0 in names, can we have some more readable names please

@maciejbocianski maciejbocianski force-pushed the signal_tests branch 2 times, most recently from de8f98d to 1b3b1ce Compare October 2, 2017 12:45
@theotherjimmy
Copy link
Contributor

@bulislaw Could you review again?

@mbed-ci
Copy link

mbed-ci commented Oct 16, 2017

Build : SUCCESS

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

Skipping test trigger, missing label 'NEED CI'

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 19, 2017

/morph test

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 19, 2017

/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Oct 19, 2017

@maciejbocianski maciejbocianski force-pushed the signal_tests branch 2 times, most recently from 27d73ae to 37e6eee Compare October 24, 2017 13:22
@adbridge
Copy link
Contributor

Failing test:
tests-mbedmicro-rtos-mbed-signals Validate that call signal_set with prohibited signal doesn't change thread signals

@bulislaw
Copy link
Member

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 27, 2017

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Oct 27, 2017

@maciejbocianski
Copy link
Contributor Author

@mprse could you look on lptimer fail in test tests-mbed_drivers-lp_timer

>>> Running case #2: 'Test: LowPowerTimer - measure time accumulation.'...
[CONN][RXD] :184::FAIL: Values Not Within Delta 1 Expected 1060 Was 1058

@maciejbocianski
Copy link
Contributor Author

could we rerun morph ?

@mprse
Copy link
Contributor

mprse commented Nov 3, 2017

@mprse could you look on lptimer fail in test tests-mbed_drivers-lp_timer

Patch for ticker test can be found here: #5403.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 13, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 13, 2017

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 13, 2017

@studavekar
Copy link
Contributor

/morph test

@mbed-ci
Copy link

mbed-ci commented Nov 13, 2017

@maciejbocianski
Copy link
Contributor Author

maciejbocianski commented Nov 17, 2017

Patch for ticker test can be found here: #5403.

#5403 was merged, can proceed

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 17, 2017

Lets retest

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 17, 2017

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 17, 2017

@mbed-ci
Copy link

mbed-ci commented Nov 17, 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.

9 participants