Function tplg support#1360
Conversation
SOF can now load multiple topology files, pipeline
library and support modules need updates to handle colon or
comma separated TPLG paths, avoid testing the same physical PCM
device more than once, and dont crash when optional options are unset.
pipeline.sh:
- Add func_tplg_parse_and_validate():
* Normalises colon/comma separators; trims whitespace
* Filters topologies per NO_HDMI_MODE / NO_BT_MODE / NO_DMIC_MODE
* Resolves each path with func_lib_get_tplg_path(); skips missing
files with a warning, aborts only when nothing is left
* Exports TPLG_FILES (comma-joined for sof-tplgreader.py) and
TPLG_COUNT
- Update func_pipeline_export():
* Calls func_tplg_parse_and_validate() instead of single-file lookup
* Passes TPLG_FILES to sof-tplgreader.py (native multi-file support)
* Captures stdout+stderr; logs and die()s on non-zero exit
* Post-eval deduplication by hw:X,Y 'dev' field - renumbers
surviving pipelines contiguously and logs removed duplicates
* Sorts surviving pipelines by numeric 'id' for consistent ordering
- Fix func_pipeline_parse_value(): add 'return 0' on out-of-range
access to prevent spurious 'set -e' failures in callers
hijack.sh:
- Add audio-process cleanup at top of func_exit_handler():
kills leftover aplay/arecord (alsa) or tinyplay/tinycap (tinyalsa)
on test abort, preventing EBUSY errors in subsequent tests
Uses pgrep + pkill + 0.5 s sleep; all guarded with '|| true'
lib.sh:
- Fix logger_disabled(): guard OPT_VAL['s'] with ':-1' default so
tests that dont declare -s option no longer crash with error
'unary operator expected' error from the empty integer comparison
Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
Both tests now accept colon or comma-separated list of topology paths by -t / TPLG, consistent with new func_tplg_parse_and_validate() convention introduced in case-lib/pipeline.sh. verify-tplg-binary.sh: - Normalise separator to colon, split into array, iterate per file - Call func_lib_get_tplg_path() per entry; dlogw + skip on missing file instead of die() (optional topologies on headless systems) - Print md5sum and sof-tplgreader.py output per topology - Run tplgtool2.py per file; include filename in die() message - Remove now-redundant main() wrapper - Print a summary line after all files pass verify-pcm-list.sh: - Use func_tplg_parse_and_validate() to resolve all topologies; carry NO_HDMI_MODE / NO_BT_MODE / NO_DMIC_MODE automatically - Build sof-tplgreader.py -f filter string from active NO_* variables, mirroring func_pipeline_export() filter logic, so pipeline list compared against /proc/asound/pcm is consistent - Pass comma joined TPLG_FILES to sof-tplgreader.py - Deduplication: with TPLG_COUNT > 1 use awk 'NF && !seen[$0]++' remove exact duplicate lines while preserving original order; dont deduplicate by id alone PCM legitimately has both playback and capture entry sharing same id Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
…e topologies
Three execution-class test cases updated to handle multi-topology
TPLG input and avoid testing same physical PCM device more than once.
simultaneous-playback-capture.sh:
- Accepts colon/comma-separated TPLG by func_tplg_parse_and_validate()
- Rewrite 'both' pipeline detection:
* Parse sof-tplgreader.py output for 'id=X;...type=(playback|capture)'
* Track seen 'id:type' pairs to skip exact duplicates from multiple
topology files (same id+type in two files)
* Accumulate id_has_playback[] and id_has_capture[] separately
* Collect only IDs present in both maps. true 'both' pipelines,
even when playback and capture come from different topology files
- Updated description and OPT_DESC to document multi-file usage
volume-basic-test.sh:
- Call func_tplg_parse_and_validate(); iterate TPLG_FILES split on ','
- Append topo_vol_kcontrols.py output per topology to temp array
(errors suppressed with '2>/dev/null || true' for optional files)
- Deduplicate with 'sort -u' before assigning to pgalist; controls
that appear in multiple topology files are tested only once
multiple-pipeline.sh:
- Declare global associative array USED_PCMS before main loop
- In func_run_pipeline_with_type(): check USED_PCMS[$dev]; skip with
log message if already tested; otherwise mark and proceed
- Reset USED_PCMS=() at start of each loop iteration so every
full pass starts with clean slate
Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
…ut handling Two independent fixes: Logger selection when multiple sof-logger binaries exist in PATH: - Move 'loggerBin=$(type -p sof-logger)' before the md5 check so default is always available - Replace die() with dlogw() when different-checksum binaries are found; test can still run with clearly chosen binary - Prefer distro-managed system binary (/usr/bin/sof-logger, then /bin/sof-logger) over locally-built /usr/local copy; log the chosen path at dlogw level - Falls back to the original 'type -p' result if neither system path exists Timeout exit code handling: - Introduce helper timeout_status_ok(): returns 0 for exit codes 124 (standard 'timeout' expiry) and 125 (some wrapper/edge-case paths) - Replace hardcoded 'test -eq 124' checks (DMA logger, mtrace, etrace) with calls to timeout_status_ok(); prevents spurious 'unexpected exit status' failures on systems where timeout returns 125 Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
Update the script to support multi topology input. Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
Drop setup block and keep initialization only in main() to avoid running start_test, log collection, and ALSA setup twice. add PTLH_RVP_NOCODEC, NVL_RVP_NOCODEC, NVLS_RVP_NOCODEC and WCL_RVP_NOCODEC to NOCODEC reset-volume handling branch Signed-off-by: Junkier, Mateusz <mateusz.junkier@intel.com>
fix wrong alsa volume levels Signed-off-by: Junkier, Mateusz <mateusz.junkier@intel.com>
c248882 to
40189c7
Compare
marc-hb
left a comment
There was a problem hiding this comment.
Discarding stderr in test code is really the "anti-pattern", an entire cattery dies every time :-(
-
If everything goes well, there should be no leftover processes and this cleanup code will not even run so no need to discard anything.
-
If there are leftover processes, then a problem happened somewhere and the entire purpose of test code is to find and show problems, not hide them.
Moreover, test logs are always big and ugly and painful to read anyway, so discarding one needle from that haystack is never going to make them look good.
| if pgrep aplay >/dev/null 2>&1 || pgrep arecord >/dev/null 2>&1; then | ||
| dlogi "Cleaning up leftover aplay/arecord processes" | ||
| pkill -9 aplay 2>/dev/null || true | ||
| pkill -9 arecord 2>/dev/null || true |
There was a problem hiding this comment.
| pkill -9 arecord 2>/dev/null || true | |
| pkill -9 arecord || true |
|
|
||
| dlogi "Starting func_exit_handler($exit_status)" | ||
|
|
||
| # Cleanup audio processes (aplay/arecord/tinyplay/tinycap) that may be left running |
There was a problem hiding this comment.
Déjà vu...I feel like there are a couple instances of such cleanup functions around already? Sorry if not.
| # This prevents "Device or resource busy" errors in subsequent tests | ||
| case "$SOF_ALSA_TOOL" in | ||
| 'alsa') | ||
| if pgrep aplay >/dev/null 2>&1 || pgrep arecord >/dev/null 2>&1; then |
There was a problem hiding this comment.
| if pgrep aplay >/dev/null 2>&1 || pgrep arecord >/dev/null 2>&1; then | |
| if pgrep aplay >/dev/null || pgrep arecord >/dev/null ; then |
This commits adds multi-topology support for function tplg feature for SDW. Tests can accept colon- or comma-separated lists of topology files, and fixes several issues.
Test cases: