-
Notifications
You must be signed in to change notification settings - Fork 3k
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
RTOS threads test: Handle out of memory cases #7744
Conversation
@c1728p9 Mind taking a look before we start CI? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit concerning to skip tests because the device doesn't have enough memory to run them. If the TMPM3H6 doesn't have enough memory to run tests should it be enabled for mbed 5? What is the impact of leaving this target out?
|
||
// Don't fail test due to lack of memory. Call function directly instead | ||
if (!child || !dummy) { | ||
increment(counter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this isn't actually getting called on a new thread doesn't this defeat the purpose of this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This continues our discussion from below, under the assumption we want to allow low memory boards to still pass the test. If we don't have enough memory to launch a new thread, but still need this test to pass under these conditions (which is what this condition checks), then the only way to make this test pass is to manually call the increment function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidsaada Can you please take a look at my comment?
@@ -174,6 +196,10 @@ void test_single_thread() | |||
template <int N, void (*F)(counter_t *)> | |||
void test_parallel_threads() | |||
{ | |||
char *dummy = new (std::nothrow) char[PARALLEL_THREAD_STACK_SIZE * N]; | |||
delete[] dummy; | |||
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory to run test"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidsaada This doesnt seem right. We are trying to allocate the space and then deleting it right away, and then comparing it using the macro. It will always skip the test. Unless I am missing something here. Can you please check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The delete[]
command has no effect on the value of dummy
variable. The test will be skipped only if memory allocation fails. I could switch these two lines, but it won't change anything.
I have no problem leaving this (or any other low memory) target out of our CI or from mbed-os. This PR was based on the assumption that these boards were included in our CI. Under this assumption, one would need these tests to pass. Diluting the tests to reduce memory consumption is a lose-lose attitude, as it harms the test quality on the one hand, and may not be sufficient for even lower memory boards when these are added. Now, we could have this board specifically black listed in the test code (e.g. have an |
This looks good for me. It is better to run tests in boards which have enough memory than leave out the test. We will run more boards in continuous integration in future. |
Hi @davidsaada, I agree, something like a black list is preferable to modifying each test case. Even that is not ideal though. I would like to see some minimum requirements for Mbed 5 devices and then require that tests fit in that. Otherwise there will be pressure to keep shrinking/bypassing tests to fit on even smaller devices. I proposed a minimum requirement of 2K for heap and 2K for data in #5285 but even that caused too many devices to fail. I'm not sure how usable these smaller devices are with Mbed 5 if they can't pass our already space optimized tests. It seems wrong to allow a device which doesn't have enough space to create a second thread (with an already minimized stack size) to be Mbed 5 enabled. |
@c1728p9 It sounds like you're amicable to this PR for now. Would you mind OKing or dismissing your review? @c1728p9 @aashishc1988 @davidsaada @OPpuolitaival Does it make sense to create a new issue/internal ticket to track down and enable minimum testing requirements? |
I'm leaving how to proceed with this PR up to @davidsaada
Sure does. We also had some internal discussions about it (following this PR and ones alike). Guess a new issue may be a good place to discuss it. |
@davidsaada @c1728p9 Could one of y'all open an issue (if one isn't already), and link it here? In the meanwhile, we'll get this PR on its way. /morph build |
Opened #7845 to follow up on our discussion regarding low resource boards. |
Build : SUCCESSBuild number : 2853 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2484 |
Test : FAILUREBuild number : 2613 |
Test needs to be rerun. Failure is on a single board (NRF51_DK) on two other tests. |
/morph test |
1 similar comment
/morph test |
Test : SUCCESSBuild number : 2625 |
👍 Would be useful to have the minimum req. @c1728p9 You happy with this as it is ? |
Going to merge since discussion will be moved to referenced issue. |
Description
The RTOS threads test crashes if it fails to allocate memory on low memory boards. Fix this problem.
Resolves #7535
Pull request type