-
Notifications
You must be signed in to change notification settings - Fork 46
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
Explicitly invoke start_test() in every test-case/*.sh #1187
Conversation
Long overdue. Zero code change. Signed-off-by: Marc Herbert <[email protected]>
Stop unconditionally imposing start_test() to everything sourcing lib.sh This makes it possible to source lib.sh without running anything which can be useful for debugging. For now this should be a no-op for all tests except two files in `tools/` which were never really "tests" in the first place: - tools/kmod/sof_remove.sh - tools/sof-kernel-log-check.sh In these, start_test() never made sense it never really run thanks the (awkward) "is_subtest()" escape. There are other tests where start_test() should not be invoked either, most notably test-case/verify-kernel-boot-log.sh in order to fix thesofproject#1112 but this is a huge commit already; one change at a time. Signed-off-by: Marc Herbert <[email protected]>
9d02ef8
to
a82935b
Compare
This is the one-before-last, big step towards fixing: ... and friends. Known headset capture issue thesofproject/sof#9018 in LNL https://sof-ci.01.org/softestpr/PR1187/build383/devicetest/index.html, everything else green. One single suspend/resume failure in CAVS https://sof-ci.01.org/softestpr/PR1187/build381/devicetest/index.html, everything else green. MTL all green https://sof-ci.01.org/softestpr/PR1187/build382/devicetest/index.html stable-v2.2 all green https://sof-ci.01.org/softestpr/PR1187/build384/devicetest/index.html All the shellcheck warnings in https://github.com/thesofproject/sof-test/actions/runs/8915588945/job/24485498298?pr=1187 are unrelated |
# 3. Register the func_exit_handler() EXIT trap that collects logs, kills | ||
# loggers and prints test results. | ||
# | ||
# 4. Waits for the FW to be successfully booted (can be disabled) |
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.
How can it be disabled?
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_POLL_FW_LOADING
30 lines below, it's not that long of a function (as no function should be)
Also documented in config.sh
# | ||
# 4. Waits for the FW to be successfully booted (can be disabled) | ||
# | ||
# |
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.
nitpick: one blank line should be enough?
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.
agree it's nitpick
@@ -73,6 +73,8 @@ frequency=${OPT_VAL['F']} | |||
sigmak=${OPT_VAL['k']} | |||
frames=${OPT_VAL['n']} | |||
|
|||
start_test | |||
|
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.
In commit message, what is the meaning of the opening sentence in relation to moving the start_test from lib.sh to test cases?
Stop unconditionally imposing start_test() to everything sourcing lib.sh
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'm not sure I understand the question...
Now it's explicit, so each test has a choice to call start_test
or not. That's all this PR is about.
When start_test
was in lib.sh
, tests had no choice but to run start_test
start_test
started as a small thing so running it unconditionally was a "small bug" but it has kept growing.
@@ -41,6 +41,8 @@ loop_cnt=${OPT_VAL['l']} | |||
func_pipeline_export "$tplg" "eq:any" | |||
sofcard=${SOFCARD:-0} | |||
|
|||
start_test |
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 the start_test
used to run at line 21?
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.
Yes this is a minor change: start_test
is now running after
option parsing. It was confusing to "start" a test and run the exit handler, etc. when no testing had started yet because a wrong option was passed.
@@ -57,6 +57,7 @@ loop_cnt=${OPT_VAL['l']} | |||
out_dir=${OPT_VAL['o']} | |||
file_prefix=${OPT_VAL['f']} | |||
|
|||
start_test |
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.
All of this churn is to keep the systemctl_show_pulseaudio
in tools/kmod/sof_remove.sh instead of just dropping it from the sof_remove.sh along with sourcing the case-lib/lib.sh and be done?
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, the main benefit for sof_remove.sh is the ability to run it more than once. It used to fail when the firmware wasn't running. Also avoids some confusing logs: sof_remove.sh
is not a "test"
There will be a much bigger and much more important bug fix not related to sof_remove.sh, see commit message.
Also restores the ability to source lib.sh interactively, also mentioned in the commit message
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.
instead of just dropping it from the sof_remove.sh along with sourcing the case-lib/lib.sh
The (non-mandatory) pulseaudio check is debatable. Including lib.sh
is much less so. There's no reason to copy/paste routines when it can easily be avoided.
Anyway the most important and urgent benefit of this design fix is preparing the fix for #1036 and #1112. The same design fix just happens to help with some other scripts like sof_remove.sh.
@@ -18,6 +18,11 @@ set -e | |||
# shellcheck source=case-lib/lib.sh | |||
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh | |||
|
|||
start_test | |||
# TODO: replace start_test with this: |
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 TODO will be next PR?
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.
Yes immediately after this one. I want at least one run of daily tests between the two.
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.
Initially start_test from lib.sh was making sense. but now it doesn't cover every case.
Explicit invoking start_test() is making sense now.
Thanks @fredoh9 ! |
2 commits, main one:
Stop unconditionally imposing start_test() to everything sourcing lib.sh
This makes it possible to source lib.sh without running anything which
can be useful for debugging.
For now this should be a no-op for all tests except two files in
tools/
whichwere never really "tests" in the first place:
In these, start_test() never made sense it never really run thanks the
(awkward) "is_subtest()" escape.
There are other tests where start_test() should not be invoked either,
most notably test-case/verify-kernel-boot-log.sh in order to fix
#1112 but this is a huge
commit already; one change at a time.