-
Notifications
You must be signed in to change notification settings - Fork 3k
Reconcile mbed trace and greentea #9954
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
Reconcile mbed trace and greentea #9954
Conversation
@ithinuel, thank you for your changes. |
This is a step in the wrong direction vis-a-vis my abstraction issue #6674. Also, from my investigations on that I concluded that If it's very few places needing IRQ output, maybe they could be changed... My ideal would be for the whole thing to be reworked to use just Since that issue was originally filed, a couple of improvements to FileHandle/UARTSerial have been made which mean it may be more feasible: #9797 (can now suspend buffered input, which would be necessary for some power tests) |
The idea behind this is to make the serial output usable and reliable when mixing test's payload (greentea's tokens), unity's assert messages, mbed_traces and general printf output as found in a lot of tests in mbed. As mentioned in the PR desc this might not be the best solution and I would be glad to update this PR accordingly. The general issue I face here is that outputs aren't synchronized.
Not being able to read traces while developing/validating a feature/driver in mbed is really painful. Outputting from an interrupt (using printfs etc) sounds fundamentally wrong to me so the use of mutexes is perfectly fine. A mutex is (arguably) the most "OS friendly" approach. Ideally all the sources should be able to and should do agree on "who's taking the hand on the output ?" and wait until the output is actually available. PS: |
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.
Test cases serve a second purpose on being our example applications, and therefore I’m very much against of them relying some undocumented Greentea internals.
I
@SeppoTakalo Thanks for your review. |
Indeed - you need some sort of other wrapper for all your output. In icetea, (If this was POSIX, you could use
I agree, but it appears that Greentea is very specifically using unlocked RawSerial to support that, from the history. I don't know if it's true that the interrupt output has been eliminated, but if so, then I would very strongly want to press forward with #6674 and eliminate Or, alternatively, you could keep it as your "locking wrapper", but it should just be based on calling stdout, not an underlying RawSerial. |
@ithinuel By undocumented I meant It is an internal object of Greentea framework, and therefore should not be touched by application. Test cases should only rely on documented application APIs and test framework APIs. |
alternatively, would that be ok to have greentea, unity & the tests to use mbed_trace to generate the output ? |
@ithinuel How can this be progressed? Are you still waiting for feedback, per your last comment? |
@cmonr Indeed, more feedback would be greatly appreciated. |
@ithinuel : note this now also requires a re-base. |
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 needs further discussion. Agree with above points, we should continue in #6674 and this can be closed now.
@NirSonnenschein @0xc0170 I would update/rebase once a consensus is found. #6674 is not much about synchronisation of the various output sources though. A thing that would be a good start is to define if it's not already defined and actually apply the decision for :
|
@kjbracey-arm Do you have an opinion on this ? |
Let's move to the issue and close this, it's not going anywhere at the moment. It can be reopened with further updates/comments. |
@0xc0170
|
@ithinuel I've always been in the embedded realm but my short stint with android forever scarred my view of embedded development. Would a logcat like interface and Log type class potentially provide a path to bringing this all together? I'm not the one to architect it but, |
From what I understood this was more or less the intent of The resulting design expected to solve this issue may imply a lot of changes in a lot of libraries.
This would allow to have a coherent/synchronised output while minimising the risk of breaking existing code. @0xc0170 @kjbracey-arm I'm aware of GH limitation's on the number of comments on a PR. Should we open a tracking issue for resolving this topic and/or use some other procedure ? |
Indeed.
They don't need to be aware of each other, necessarily. Except that if you are using one physical output for two logical channels, there is an issue. If the serial is receiving both greentea output and logging, then something is needed to stop them becoming totally garbled. Icetea deals with this by ensuring it initialises mbed_trace with a mutex, and uses the same mutex in its Programs should in general work fine with tracing disabled, as should tests, but occasionally some tests end up wanting to check for internal state there's no API to access, in which case they "cheat" by getting the tests to look for specific trace output. I'd say that is a cheat, but it's not frowned on that hard. The CLI interface must work interactively fine without trace enabled - so you have to make sure that a command like "route print" sends its output to stdout, not to mbed_trace!
mbed_trace is definitely a higher-level than printf. It's a portable application-level helper that may or may not send output to
I'm not. Are we about to hit it?
Sure. |
@kjbracey-arm I faced it on #6782 (comment) We can continue this discussion in #11202. |
Description
This PR fixes the broken output of netsocket tests when mbed_trace is enabled.
Without this fix both outputs get intermingled and hardly readable by humans (for the traces) and by machines (as greentea's tokens also get messed up).
Note:
There might be a better solution than adding
greentea_serial->
before each printf. If so please let me know and I will update this PR accordingly.Pull request type
Reviewers
Release Notes