-
Notifications
You must be signed in to change notification settings - Fork 59
logger: disable sof-logger for zephyr #681
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
4cd89f6 to
d19612a
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.
Can you please add one more is_zephyr() function? I mean logger_disabled() invokes is_zephyr() like this:
is_zephyr()
{
grep something.*zephyr somefile
}
logger_disabled()
{
if is_zephyr; then
return 0
else ...Can you please give an example of this /etc/sof/manifest.txt file and a link to what code creates and deploys it?
This /etc/sof/manifest.txt file may be good enough for CI in the very short term but I don't think it will work for most developers. I compile with and without Zephyr many times every day and I also use sof-test yet my /etc/sof/ has been empty since forever.
@andyross , @kv2019i , @lyakh : any other, simple, automatable and reliable way to tell the difference between plain SOF versus SOF+Zephyr?
PS: I've been using a .tarball-version hack that shows up in dmesg but this won't work for CI
case-lib/lib.sh
Outdated
| manifest=/etc/sof/manifest.txt | ||
| FIRMWARE_TYPE=$(grep "firmwaretype" < "$manifest" | awk -F ':' '{print $2}' | sed -e 's/^[ ]*//g;s/\"//g') | ||
| # disable sof-logger for Zephyr built firmware | ||
| if [ "$FIRMWARE_TYPE" == "zephyr" ]; then |
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 above seems a bit long and over complicated, could this be shorten into something like this:
if grep `firmwaretype.*zephyr` /etc/sof/manifest.txt; thenJust a really simplified example: you may want a slightly more complex regular expression.
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.
Good point, I will refine my patch.
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 didn't know manifest.txt was actually a manifest.json. The standard, command-line parser for JSON is jq, please drop awk, grep etc. and use jq:
apt-get install jq
jq '.version.firmwaretype' manifest.txt
=> "zephyr"
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.
Updated. Thanks!
case-lib/lib.sh
Outdated
| { | ||
| # get the firmware type | ||
| manifest=/etc/sof/manifest.txt | ||
| FIRMWARE_TYPE=$(grep "firmwaretype" < "$manifest" | awk -F ':' '{print $2}' | sed -e 's/^[ ]*//g;s/\"//g') |
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.
No need for the <.
No need for the grep, awk can already do grep (and many other things): awk -F ':' '/firmwaretype/ {print $2 }'
Regular expressions with only special characters are time-consuming to read and deserve a comment, for instance # remove whitespace.
7a6a8e9 to
436e2bd
Compare
|
@marc-hb wrote:
Not very good ones. The compiler string has "zephyr", but that's not reliable (plain SOF could be built with zephyr toolchain, or zephyr can be built with something else). The FW binary has a string "ZEPHYR FATAL" that you can test with "test -n " This comes from zephyr/kernel/fatal.c , so while it's a bit adhoc, it's likely to be a pretty reliable in practise. We have code in test-case/verify-firmware-presence.sh to parse the fw file, so this is a possibility. |
kv2019i
left 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.
I tested the patch on a system with Zephyr firmware and it did work as expected. We should make the manifest-based configuration a bit cleaner so it makes sense for standalone usage of sof-test, but otherwise this looks good.
marc-hb
left 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.
I suggest we merge this with the manifest.txt first to get CI started and then try to find a better test later. Only the is_zephyr() function will have to change.
| return 0 | ||
| else | ||
| return 1 | ||
| fi |
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.
Style nit/personal preference:
if is_zephyr || [[ ${OPT_VAL['s']} -ne 1 ]]; then
return 0
fi
return 1
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.
Concise and reasonable. Updated
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.
Actually, this can probably be just:
logger_disabled()
{
is_zephyr || [[ ${OPT_VAL['s']} -ne 1 ]
}since zephyr doesnot support sof-logger, so add a function to disable logger trace for zephyr during the test. Signed-off-by: Zhang Keqiao <keqiao.zhang@intel.com>
@marc-hb @keqiaozhang For CI devices, $manifest must exist, otherwise, the deployment failed, so the test is not started. Edit: If we just want to test if the FW is zephyr, a grep is enough, we can eliminate the dependency on jq. If we do want to parse json with jq, I think a function |
marc-hb
left 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.
LGTM but probably not for some others yet.
For personal device, this file may not exist. so I think we should regard '$manifest not exist' as 'zephyr not exist',
I think the majority of people who reviewed this PR use Zephyr without a manifest.txt and at least one had a good idea that he will submit immediately after this PR is merged :-)
Edit: If we just want to test if the FW is zephyr, a grep is enough, we can eliminate the dependency on jq
jq is awesome, it's a great dependency and in this case it makes the manifest-based test very reliable. Now if the manifest.txt test goes away soon then I agree the jq dependency will be very short lived in this case...
kv2019i
left 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.
Fair enough @marc-hb , let's go with this.
|
why does zephyr not support sof-logger? without FW logs, how can we debug the SOF issues? |
|
We could make sof-logger compatible with Zephyr but the plan is to migrate to https://docs.zephyrproject.org/latest/reference/logging/ For now logging is provided by one of these: zephyrproject-rtos/zephyr#35186 |
fredoh9
left 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.
didn't know sof-logger is not supported for Zephyr
|
3 approvals, 8 days in review, no formal "request changes", simple and easy to maintain change: merging. Some very good suggestions and objections: please submit incremental changes. |
|
SKIP check-sof-logger if is_zephyr #724 |
|
#809 just enabled sof-logger with Zephyr. Seems to work fine. |
since zephyr doesnot support sof-logger, so add a function
to disable logger trace for zephyr during the test.
Signed-off-by: Zhang Keqiao keqiao.zhang@intel.com