-
Notifications
You must be signed in to change notification settings - Fork 51
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
tests: fix bug: lack of option sof-logger in tests #1251
base: main
Are you sure you want to change the base?
tests: fix bug: lack of option sof-logger in tests #1251
Conversation
Duplicating the same Have you considered using Also, maybe that code could be moved to
This is missing quotes BTW, it should be:
|
@arikgreen any update for review comments ? |
Yes, you right duplicate same code isn't good technic. Maybe it is a right time to fix it and move the code to the lib.sh. |
sorry for late but I was sick for last week. |
Fix for: ``` /home/ubuntu/sof-test/test-case/../case-lib/lib.sh: line 955: [: -eq: unary operator expected ``` Signed-off-by: Artur Wilczak <[email protected]>
3256720
to
2cd5085
Compare
@marc-hb I decided implement a better quick fix |
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 I think there's a less subtle way.
Also, the PR description is now completely out of date with the commit message (that's because of the unusual "force-push" way SOF uses GitHub zephyrproject-rtos/zephyr#39194 - I digress)
@@ -952,7 +952,7 @@ is_ipc4() | |||
logger_disabled() | |||
{ | |||
# Disable logging when available... | |||
if [ ${OPT_VAL['s']} -eq 0 ]; then | |||
if [[ ${OPT_VAL['s']} -eq 0 ]]; 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.
That difference between [ ]
and [[ ]]
is too subtle IMHO, I think most people won't know it. You could just do this instead: Wrong suggestion, see below.
if [[ ${OPT_VAL['s']} -eq 0 ]]; then | |
if [ "${OPT_VAL['s']}" = 0 ]; 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 should be correct but please test it:
if [[ ${OPT_VAL['s']} -eq 0 ]]; then | |
if [ -n "${OPT_VAL['s']}" ] && [ "${OPT_VAL['s']}" -eq 0 ]; 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.
Actually, your [[ ]]
solution and my =
solution are both wrong.
-
All tests that support the
-s
flag haveOPT_VAL['s']
equals to1
by default. Because the default is to collect logs when you don't pass-s
(sorry for the double and triple negations, not all of them sof-test's fault) -
Tests that do NOT support
-s
flag and haveOPT_VAL['s']
undefined must of course consistently default to collecting logs too.
So, undefined OPT_VAL['s']
must be equivalent to OPT_VAL['s'] = 1
: both must collect logs by default. The current code emits an ugly -eq
warning but it is functionally correct.
Both the [[ ]]
solution and my =
solution make undefined equivalent to 0
, which stops collecting logs and hides errors in tests that do not support -s
. It would unfortunately not be the first time:
- Stop ignoring various logger failures #373
- Check for a valid trace for ALL tests #297
- https://github.com/thesofproject/sof-test/issues?q=label%3A%22False%20Pass%20%2F%20green%20failure%22
How did you test this?
Add option -s (sof-logger) to tests for fix issue
sof-test/case-lib/lib.sh: line 955: [: -eq: unary operator expected
before fix: run
after fix: run