-
Notifications
You must be signed in to change notification settings - Fork 18
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
mbedtls|busybox: fix measuring test duration (trunner API change approach) #284
Conversation
9cb3aaf
to
54f39f7
Compare
switching to draft until |
0569db4
to
6790609
Compare
busybox/busybox.py
Outdated
@@ -26,21 +26,23 @@ def harness(dut: Dut, ctx: TestContext, result: TestResult): | |||
parsed = dut.match.groupdict() | |||
|
|||
if idx == 2: | |||
msg.append("\t\t" + parsed["line"]) | |||
continue | |||
line_msg = parsed["line"] + " " |
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 don't really know how the full output from the succesful/failed tescases looks like. Maybe we can put sample output as a mulitiline variable / comment after imports (to be used for pytest harness unit test in the near future hopefully).
From your code I suspect the output might be:
FAIL: test-name-1
why-failed-line-1
why-failed-line-2
msg-for-test-2
msg-for-test-2
PASS: test-name-2
If so - we can't assign message lines to the testcases in any sensible way (your code would append all 4 lines to test-name-1
, but that's ok if the input is really like that) - but we should mention in comment that the messages might be invalid in that case.
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.
After checking, the output can appear in several ways. It might be produced during the test. In the event of a failure, lines can be printed both during the test when something fails and after the test. However, when printing strictly informational messages, they are preceded by ======================
to distinguish them.
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've checked the busybox testsuite and it seems seems to be true only for newstyle tests (oldstyle tests don't print ===
nor messages before the test result - see mkdir
for example). I don't see how to distinguish them in harness, maybe we should patch busybox testsuite framework instead?
6790609
to
2857ef5
Compare
2857ef5
to
d0d2298
Compare
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.
Tested some of the most vulnerable cases and it seems to work really good (both mbedtls and busybox). Let's wait for phoenix-rtos/phoenix-rtos-ports#69 merge
d0d2298
to
3779256
Compare
004691d
to
3dc6192
Compare
busybox/busybox.py
Outdated
from trunner.types import TestResult, TestSubResult, Status | ||
from trunner.types import TestResult, Status | ||
|
||
# Example of parsed outputs: |
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.
use multiline string , right now I don't know if the input has spaces in front or not, eg:
EXAMPLE_INPUT = """
test-msg-line-1
test-msg-line-2
FAIL: test-name-1
fail-msg-line-1
fail-msg-line-2
---Testcase test-name-2 starting---
test-msg-line-1
test-msg-line-2
PASS: test-name-2
---Testcase test-name-3 starting---
SKIPPED: test-name-3
"""
this would also make it easier to write unit tests (use variable as an input).
Also - test names should be in '
?
3dc6192
to
616609d
Compare
616609d
to
5af9e03
Compare
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.
Thanks for the latest improvements. Just 2 things more
busybox/busybox.py
Outdated
EXAMPLE_INPUT = """ | ||
---Testcase 'busybox as unknown name' starting--- | ||
echo -ne '' >input | ||
echo -ne '' | ./unknown 2>&1 | ||
PASS: busybox as unknown name | ||
---Testcase 'date-@-works' starting--- | ||
FAIL: date-@-works |
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 that it would be better to place it in a comment.
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.
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.
Please keep it as a multiline variable (reasoning provided previously).
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.
Oh, right. Ok, I was worried about some potential issues (flake and so on) when we don't use those variables in fact.
f793544
to
f2592cb
Compare
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.
@mateusz-bloch please add JIRA ID to the first two commits and I'd like to merge it :)
- remove add_subresult_obj() as it's misleading (doesn't add by reference, just by value - make add_subresult() return the subresult object which can be updated at a later time Fixes: phoenix-rtos/phoenix-rtos-project#877 JIRA: CI-384
The subtest result was incorrectly "finished" (added to result) one line after the result (so actually computed the time of the next test). Use simplified API to add optional test message to the correct subtest Fixes: phoenix-rtos/phoenix-rtos-project#877 JIRA: CI-384
f2592cb
to
40885da
Compare
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.
LGTM
40885da
to
61d9f82
Compare
The subtest result was incorrectly finished (added to result) one line after the result (so actually computed the time of the next test). JIRA: CI-384
JIRA: CI-384
61d9f82
to
eaf18cf
Compare
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.
One case from busybox test suite was not handled, thanks for adding it @mateusz-bloch. Looks good to me
Description
mbedtls: fix measuring test duration
The subtest result was incorrectly "finished" (added to result) one line after
the result (so actually computed the time of the next test).
Use simplified API to add optional test message to the correct subtest
trunner: make subresult API more robust
just by value
later time
Motivation and Context
phoenix-rtos/phoenix-rtos-project#877
Types of changes
How Has This Been Tested?
Checklist:
Special treatment