Skip to content

Conversation

@tmoida
Copy link
Contributor

@tmoida tmoida commented Jan 2, 2026

Expanded audio testing from 2 to 10 test cases in the pre-merge CI pipeline to improve validation coverage across different audio formats and configurations.

Changes:

  • AudioRecord: Added support for 10 recording configurations
  • AudioPlayback: Added support for 20 playback configurations
  • meta-ar-ci-premerge.yaml: Updated to run 7 playback + 3 record tests

AudioRecord enhancements:

  • Implemented config discovery mode with 10 predefined test configurations
  • Added --config-name and --config-filter CLI options for flexible test selection
  • Updated documentation with configuration table and usage examples
  • Modified YAML to support new config parameters (defaults to record_config1)

AudioPlayback enhancements:

  • Implemented clip discovery mode with 20 predefined test configurations
  • Added --clip-name and --clip-filter CLI options for flexible test selection
  • Updated documentation with configuration table and usage examples
  • Modified YAML to support new clip parameters (defaults to Config1)

Pre-merge CI updates:

  • 7 playback tests: Config1, Config7, Config13, Config15, Config18, Config20, Config5
  • 3 record tests: record_config1, record_config7, record_config10
  • Uses pre-staged clips at /home/AudioClips/ for faster execution
  • 10-second recording duration for efficient CI runtime

Test coverage now includes:

  • Sample rates: 8KHz to 384KHz
  • Bit depths: 8-bit to 32-bit
  • Channel configs: Mono, Stereo, 5.1, 7.1 surround

Expanded audio testing from 2 to 10 test cases in the pre-merge CI pipeline
to improve validation coverage across different audio formats and configurations.

Changes:
- AudioRecord: Added support for 10 recording configurations
- AudioPlayback: Added support for 20 playback configurations
- meta-ar-ci-premerge.yaml: Updated to run 7 playback + 3 record tests

AudioRecord enhancements:
* Implemented config discovery mode with 10 predefined test configurations
* Added --config-name and --config-filter CLI options for flexible test selection
* Updated documentation with configuration table and usage examples
* Modified YAML to support new config parameters (defaults to record_config1)

AudioPlayback enhancements:
* Implemented clip discovery mode with 20 predefined test configurations
* Added --clip-name and --clip-filter CLI options for flexible test selection
* Updated documentation with configuration table and usage examples
* Modified YAML to support new clip parameters (defaults to Config1)

Pre-merge CI updates:
* 7 playback tests: Config1, Config7, Config13, Config15, Config18, Config20, Config5
* 3 record tests: record_config1, record_config7, record_config10
* Uses pre-staged clips at /home/AudioClips/ for faster execution
* 10-second recording duration for efficient CI runtime

Test coverage now includes:
- Sample rates: 8KHz to 384KHz
- Bit depths: 8-bit to 32-bit
- Channel configs: Mono, Stereo, 5.1, 7.1 surround

Signed-off-by: Teja Swaroop Moida <tmoida@qti.qualcomm.com>
# Discover all audio clip files in the clips directory
# Returns: space-separated list of clip filenames (basenames only)
# Exit codes: 0=success, 1=directory not found or no clips
discover_audio_clips() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your header says it returns space-separated basenames, but it actually prints one basename per line.
That’s not inherently wrong, but many callers then do:

available_clips="$(discover_audio_clips 2>&1)" for clip in $available_clips; do ...

either update comment (“newline-separated list”), or output a single line.

clip_filter="$2"

# Discover all available clips
available_clips="$(discover_audio_clips 2>&1)" || {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either change discover_audio_clips to only print clips on stdout and log on stderr. Or don’t use 2>&1 here.

# Count total clips first
idx=0
for clip in $available_clips; do
idx=$((idx + 1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arithmetic expansion $((...)) is not POSIX for all /bin/sh
Use expr or awk, or better, avoid manual counting and use set -- $available_clips; idx=$# (POSIX).

clips_dir="${AUDIO_CLIPS_BASE_DIR:-AudioClips}"

# If name already looks like a filename, try direct path
if printf '%s' "$name" | grep -q '\.wav$'; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep -F -q -- "$search_name"
Same issue exists in apply_clip_filter where grep -q "$pattern" treats pattern as regex. If you intend substring matching, use grep -F.

# Extract components using sed
rate="$(printf '%s' "$filename" | sed -n 's/.*_\([0-9.]\+KHz\)_.*/\1/p')"
bits="$(printf '%s' "$filename" | sed -n 's/.*_\([0-9]\+b\)_.*/\1/p')"
channels="$(printf '%s' "$filename" | sed -n 's/.*_\([0-9]\+ch\)\.wav$/\1/p')"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heavy sed for rate, bits and channels. Tighten patterns to match exact 4-field structure from end:
RATE..._BITS_CHANNELS.wav anchored near the end.

clip_path="$clips_dir/$clip_file"

# Validate clip file
if ! validate_clip_file "$clip_path"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make Config mapping explicit and stable (Config1 → specific descriptive testcase name / specific filename pattern), not “Nth entry”.
Or define a fixed list inside audio_common.sh for the 20 configs.
Otherwise, Config5 might test a different format on a different system/release, defeating CI intent.

if [ "$rc" -eq 0 ]; then
log_pass "[$case_name] loop $i OK (rc=0, ${last_elapsed}s)"
ok_runs=$((ok_runs + 1))
elif [ "$rc" -eq 124 ] && [ "$dur_s" -gt 0 ] 2>/dev/null && [ "$last_elapsed" -ge "$min_ok" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compute expected duration for the clip or remove timeout-pass heuristic for clip mode. If clips are 30s, you can set dur_s=30 and min_ok to a sane threshold.

fi

# Check not empty
size="$(stat -c '%s' "$clip_path" 2>/dev/null || wc -c < "$clip_path" 2>/dev/null)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stat -c '%s' (GNU stat). Your fallback to wc -c < file helps, but you still call GNU stat first in many places. either use wc -c consistently (simple and portable)
or centralize “file_size_bytes()” helper with robust fallbacks.

--formats "wav"
--durations "short|short medium|short medium long"
--formats "wav" # DEPRECATED: Use clip discovery instead
--durations "short|short medium" # DEPRECATED: Use clip discovery instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment says deprecated when these are being used?


# Collect evidence once at end (not per clip)
if [ "$DMESG_SCAN" -eq 1 ]; then
scan_audio_dmesg "$LOGDIR"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scans dmesg once per config(inside config loop). That can be heavy for 10 configs and makes attribution unclear. Scan once at the end of the suite (and optionally on first failure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants