-
Notifications
You must be signed in to change notification settings - Fork 3k
Reduce test overhead in preperation for CMSIS 5 #4317
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
Conversation
57a926f
to
552d7ff
Compare
Reduce RAM consumption so all tests can still be built when using CMSIS/RTX5. Also reduce clutter by removing the per target stack size defines in the tests.
552d7ff
to
6a0fcd3
Compare
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
Looks like |
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.
Ah that seems to be connected with some other explicit or implicit changes to sizes that makes it 'just fit' on feature_cmisis5 branch.
@bulislaw @0xc0170 I'm trying to reproduce the issue but running the test locally on the NRF52_DK raise another issue: it timeouts in the test If I run manually each test (skipping utest init part) with a debugger, then I got the same error as the one in the CI, the counter under test in the case |
Maybe it's a wast of time to do it if it's not an obvious fix, as it's part of bigger PR... |
@bulislaw The issue is related to the configuration of RTX on those targets, they supports 6 concurrent tasks while the case |
Ok, but that changes with RTX5. We can try temporarily bumping supported task number? |
Definitely, I suspect this failure was hidden for a long time (it depends a lot on thread scheduling....), it has to be addressed but it might be better to do it with the new version of RTX. |
Affected boards: NRF51_DK, NRF52_DK, Beetle. This change is temporary and will be overwritten by RTX update. It's necessary for the boards to pass updated tests.
/morph test-nightly |
We can do that, update the test to consider this number? |
It changes with RTX5, no much point addressing it now. For new RTX there's no global mem carveout for threads, it's purely down to available memory, on creation it's either success or fail. |
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.
I think these changes are ok. Generally it's nice to have the some of those debug printf
calls in the tests so if something goes wrong you have an idea of how far the test got. However, if it improves memory usage then that seems like a necessary trade off.
#else | ||
#define STACK_SIZE DEFAULT_STACK_SIZE | ||
#endif | ||
#define TEST_STACK_SIZE 768 |
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.
👍
@geky There's a few equeue test changes here you may be interested in. |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
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.
Don't remove all the printfs from the block device tests! That makes the test debatably useless since it gives the user no direction if it fails.
Until we have a better way to decide which tests fit on which platforms we should just filter out the storage tests (maybe an ifdef MBED_STORAGE_TESTS at the top like these?
It looks like we're also losing a bunch of useful information from the other tests. We shouldn't lose information. Perhaps we should have some flag for if we want more logging?
if (TEST_DEBUG) {
printf("this thing happened\n");
}
If we want a more long-term solution, should we consider running tests in develop or release mode? Then we could adopt the debug
function that is actually intended for this purpose.
@@ -54,8 +37,7 @@ void send_thread () { | |||
int main (void) { | |||
GREENTEA_SETUP(20, "default_auto"); | |||
|
|||
Thread thread(osPriorityNormal, STACK_SIZE); | |||
thread.start(send_thread); | |||
Thread thread(send_thread, NULL, osPriorityNormal, STACK_SIZE); |
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.
Isn't this style of starting threads deprecated?
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 is... I'm sure it's some merge weirdness. I'll revert that back to what it was.
for (int i = 0; i < 16; i++) { | ||
printf("%02x", read_block[i]); | ||
} | ||
printf("...\n"); |
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.
Uhm, wait a sec, these are used for determining the types of errors that occur during block read/write. Since this is the main test used for porting new block devices this is rather important.
Is pulling in printf and math really too much to run in CI?
If that's the case we really need to reconsider what sort of devices we are expecting to support storage. This test doesn't even have a filesystem yet!
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.
Let me see if I can revert that, as I manage to shave some memory somewhere else, it may not be necessary. On the side note, this sort of prints in test shouldn't be necessary. We should be asserting things we care about in a way that when they fail we will know what failed from assert not from a print.
Is anyone else getting red flags from how much we are having to reduce the tests? They have been quite clunky in some places, but surely there are applications that depend on us that are just as clunky. |
@geky It does raise red flags. Are these tests unusually huge? in that case maybe we should pair them down to more functional/unit test style. Are these test just not fitting because mbed OS is large? We should re-consider how much flash we take up... |
@@ -7,6 +7,7 @@ | |||
|
|||
using namespace utest::v1; | |||
|
|||
#define TEST_EQUEUE_SIZE 1024 |
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.
@bridadan pointed this out to me. Looks great and matches the way we're handling stacks here 👍
//std::for_each(floats_str, floats_str + TABLE_SIZE(floats_str), printString()); | ||
//printf("stl_transform::floats_transform: "); | ||
//std::for_each(floats_transform, floats_transform + TABLE_SIZE(floats_transform), printFloat()); | ||
//printf("\n"); | ||
|
||
TEST_ASSERT_TRUE(std::equal(floats_transform, floats_transform + TABLE_SIZE(floats_transform), floats)); | ||
} | ||
|
||
void test_case_stl_sort_greater() { |
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.
I hope I'm not repeating a discussion, but have we considered if it's worthwhile to keep these stl tests?
You could spend a lifetime trying to add coverage to the stl....
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.
We could remove them, shall be done via separate PR
@bulislaw could you review these test changes and see if the removal of all the printfs are necessary and if not update the PR? |
Revert removal of printfs. Make the block device size smaller.
/morph test-nightly |
I think that our testing should use printf, we should have asserts that actually tell us what's going wrong. Anyway, I reverted removing printfs and made the heap device smaller for small targets. Also we have issues with small platforms like nrf51_dk which when you take the soft devices, 4k main stack, 1k ISR stack there's no that much memory left for all the threads (with stacks) or heap block devices. |
@bulislaw |
Maybe we should consider of using it by default. |
it is, if you use greentea (I believe api is in the client) that one uses rawserial (the default greentea console). Not sure now if this also is true for utest macros, but I believe yes. |
@0xc0170 greentea and utest use |
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.
@geky I dont see here any removal of logging that should be kept in files (any crucial that a user could benefit from), I overlooked some? To the proposal, yes we should have logging in tests that should be disabled by default.
Thus this LGTM
//std::for_each(floats_str, floats_str + TABLE_SIZE(floats_str), printString()); | ||
//printf("stl_transform::floats_transform: "); | ||
//std::for_each(floats_transform, floats_transform + TABLE_SIZE(floats_transform), printFloat()); | ||
//printf("\n"); | ||
|
||
TEST_ASSERT_TRUE(std::equal(floats_transform, floats_transform + TABLE_SIZE(floats_transform), floats)); | ||
} | ||
|
||
void test_case_stl_sort_greater() { |
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.
We could remove them, shall be done via separate PR
@0xc0170, yeah bulislaw reverted my main complaints. There's just the deprecated thread constructor and I'm happy It sounds from discussions we should use a configurable logging function for tests that is normally compiled out (would the I still think printfs/logging is important in tests. Consider the block device logs where we assert on errors in a 512 byte block write:
Unless you want to shove some sort of neural net into the poor microcontroller, I'm not sure how you could make these sort of predictions better than a human. |
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.
Ah, you beat me too it XD
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@0xc0170 can we merge this please. |
Reduce RAM consumption so all tests can still be built when using CMSIS/RTX5. Also reduce clutter by removing the per target stack size defines in the tests.