From 476b5647a49375b0736cc3d1b1368b2f00b508a8 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 11:13:50 +0100 Subject: [PATCH 1/9] add log filtering for run-first-frame-is-sid-test --- ci/run-first-frame-is-sid-test.sh | 81 +++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 15 deletions(-) diff --git a/ci/run-first-frame-is-sid-test.sh b/ci/run-first-frame-is-sid-test.sh index 33405205c0..8205697c44 100755 --- a/ci/run-first-frame-is-sid-test.sh +++ b/ci/run-first-frame-is-sid-test.sh @@ -4,6 +4,53 @@ set -euxo pipefail +collect_failed_logs() { + local console_output="$1" + local log_dir="${2:-logs}" + local output_dir="${3:-failed_logs}" + local temp_failures=$(mktemp) + + if [ ! -f "$console_output" ]; then + echo "Error: Console output file '$console_output' not found" >&2 + rm -f "$temp_failures" + return 1 + fi + + mkdir -p "$output_dir" + + # Extract filenames from failed enc/dec chains from the console log + grep -iE '(encoding|decoding).*failed|failed.*(encoding|decoding)' "$console_output" | + grep -oE '[^[:space:]]+\.(192|wav|pcm)' | + while IFS= read -r filepath; do + # need basename wihtou suffix only for matching + filename=$(basename "$filepath") + filename_no_ext="${filename%.*}" + echo "$filename_no_ext" + done | sort -u >"$temp_failures" + + # Copy matching log files to output directory + if [ -s "$temp_failures" ]; then + echo "Copying log files for failed tasks to $output_dir..." + local count=0 + while IFS= read -r basename_pattern; do + # Find log files starting with this basename + while IFS= read -r logfile; do + cp -v "$logfile" "$output_dir/" + ((count++)) + done < <(find "$log_dir" -type f -name "${basename_pattern}*") + done <"$temp_failures" + + echo "Done. Copied $count log file(s)." + else + echo "No failures detected in $console_output" + fi + + # Cleanup + rm -f "$temp_failures" + + return 0 +} + # build encoder without sanitizers for faster runtime make clean make -j IVAS_cod @@ -31,17 +78,14 @@ exit_code_msan_no_stereo=0 exit_code_msan_stereo=0 echo "-------------- 1. Encoder + Msan decoder -------------- " echo "-------------- 1.1 all DTX modes except stereo -------------- " -scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_no_stereo -U 0:20 $common_args || exit_code_msan_no_stereo=$? +scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_no_stereo -U 0:20 $common_args 2>&1 | tee "console_log_msan.txt" || exit_code_msan_no_stereo=$? echo "-------------- 1.2 stereo DTX modes -------------- " -scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_stereo -U 40:60 $common_args || exit_code_msan_stereo=$? -# archive encoder logs separately -mkdir logs_enc logs_dec_msan -mv CLANG1/logs/*.enc.txt logs_enc/ -mv CLANG1/logs/*.dec*.txt logs_dec_msan/ +scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_stereo -U 40:60 $common_args 2>&1 | tee -a "console_log_msan.txt" || exit_code_msan_stereo=$? # sanity check: ensure that we have DTX frames in the cut bitstreams +# only need to do this once here as encoder is not run again after this grep_exit_code=0 -grep -r "Extracted 0 frames!" logs_enc/ || grep_exit_code=$? +grep -r "Extracted 0 frames!" CLANG1/logs/ || grep_exit_code=$? if [ $grep_exit_code -ne 1 ]; then echo "Some bitstreams did not contain any SID frame!" echo -e "Check the input signals and/or the VAD performance!\n" @@ -49,22 +93,29 @@ if [ $grep_exit_code -ne 1 ]; then exit 1 fi -# ASAN and USAN can be done in one go and decoder only +# everything went as expected, not collect logs for msan +collect_failed_logs console_log_msan.txt CLANG1/logs logs/msan + +# ASAN and USAN can be done decoder only # copy encoder output from CLANG1 dir mkdir CLANG2 CLANG3 cp -r CLANG1/enc CLANG2/enc cp -r CLANG1/enc CLANG3/enc -# In this run, we can do all the dtx modes together - we only run the decoder, so no cutting of input files needed +# In the next runs, we can do all the dtx modes together - we only run the decoder, so no cutting of input files needed # the script does no put the cut length into the bitstream name, so the decoder can find the existing bitstreams this way modes_all=$(scripts/runIvasCodec.py -l | grep dtx) -exit_code_asan_usan=0 -echo "-------------- 2. Asan + Usan decoder (all in one go) -------------- " -scripts/IvasBuildAndRunChecks.py --checks CLANG2 CLANG3 --decoder_only -m $modes_all $common_args || exit_code_asan_usan=$? -mv CLANG2/logs logs_dec_asan -mv CLANG3/logs logs_dec_usan +exit_code_asan=0 +echo "-------------- 2. Asan decoder -------------- " +scripts/IvasBuildAndRunChecks.py --checks CLANG2 --decoder_only -m $modes_all $common_args 2>&1 | tee "console_log_asan.txt" || exit_code_asan=$? +collect_failed_logs console_log_asan.txt CLANG2/logs logs/asan + +exit_code_usan=0 +echo "-------------- 3. Usan decoder -------------- " +scripts/IvasBuildAndRunChecks.py --checks CLANG3 --decoder_only -m $modes_all $common_args 2>&1 | tee "console_log_usan.txt" || exit_code_usan=$? +collect_failed_logs console_log_usan.txt CLANG3/logs logs/usan -if [ $exit_code_msan_no_stereo -ne 0 ] || [ $exit_code_msan_stereo -ne 0 ] || [ $exit_code_asan_usan -ne 0 ]; then +if [ $exit_code_msan_no_stereo -ne 0 ] || [ $exit_code_msan_stereo -ne 0 ] || [ $exit_code_asan -ne 0 ] || [ $exit_code_usan -ne 0 ]; then echo "There was either a crash or a sanitizer error encountered when decoding a bitstream that starts with an SID. Check the artifacts for the logfiles." exit 1 fi -- GitLab From b6f830f495377d26eb7f1ce6f1eea0dbe2d6f45a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 11:19:44 +0100 Subject: [PATCH 2/9] collect logs at the end for more visibility in console log --- ci/run-first-frame-is-sid-test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/run-first-frame-is-sid-test.sh b/ci/run-first-frame-is-sid-test.sh index 8205697c44..045a08851e 100755 --- a/ci/run-first-frame-is-sid-test.sh +++ b/ci/run-first-frame-is-sid-test.sh @@ -93,9 +93,6 @@ if [ $grep_exit_code -ne 1 ]; then exit 1 fi -# everything went as expected, not collect logs for msan -collect_failed_logs console_log_msan.txt CLANG1/logs logs/msan - # ASAN and USAN can be done decoder only # copy encoder output from CLANG1 dir mkdir CLANG2 CLANG3 @@ -108,11 +105,14 @@ modes_all=$(scripts/runIvasCodec.py -l | grep dtx) exit_code_asan=0 echo "-------------- 2. Asan decoder -------------- " scripts/IvasBuildAndRunChecks.py --checks CLANG2 --decoder_only -m $modes_all $common_args 2>&1 | tee "console_log_asan.txt" || exit_code_asan=$? -collect_failed_logs console_log_asan.txt CLANG2/logs logs/asan exit_code_usan=0 echo "-------------- 3. Usan decoder -------------- " scripts/IvasBuildAndRunChecks.py --checks CLANG3 --decoder_only -m $modes_all $common_args 2>&1 | tee "console_log_usan.txt" || exit_code_usan=$? + +# everything went as expected, now collect logs +collect_failed_logs console_log_msan.txt CLANG1/logs logs/msan +collect_failed_logs console_log_asan.txt CLANG2/logs logs/asan collect_failed_logs console_log_usan.txt CLANG3/logs logs/usan if [ $exit_code_msan_no_stereo -ne 0 ] || [ $exit_code_msan_stereo -ne 0 ] || [ $exit_code_asan -ne 0 ] || [ $exit_code_usan -ne 0 ]; then -- GitLab From 3f488aaaac135bfa4f24861df236c2addcb5cc62 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 11:20:46 +0100 Subject: [PATCH 3/9] change CI ref --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 81e3d0a3d6..8c40d04694 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ variables: # note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this # see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information - IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF main + IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF cleanup-first-frame-is-sid-test # If you need to set some config variable only in a local branch, then add an overwrite here # One example is DISABLE_HRTF - this will be set on a branch which is about to be merged and will be removed in a subsequent second MR # this is more easily done directly here in the child repo -- GitLab From 6b3fa521ff8270adb8982cd969cde15c76fb29c8 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 11:28:57 +0100 Subject: [PATCH 4/9] fix for non-zero return from grep --- ci/run-first-frame-is-sid-test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/run-first-frame-is-sid-test.sh b/ci/run-first-frame-is-sid-test.sh index 045a08851e..2c33ffafaa 100755 --- a/ci/run-first-frame-is-sid-test.sh +++ b/ci/run-first-frame-is-sid-test.sh @@ -19,6 +19,8 @@ collect_failed_logs() { mkdir -p "$output_dir" # Extract filenames from failed enc/dec chains from the console log + # turn off fail on non-zero exit code to not fail on grep not matching any line (which is the case if everything is ok) + set +e grep -iE '(encoding|decoding).*failed|failed.*(encoding|decoding)' "$console_output" | grep -oE '[^[:space:]]+\.(192|wav|pcm)' | while IFS= read -r filepath; do @@ -27,6 +29,7 @@ collect_failed_logs() { filename_no_ext="${filename%.*}" echo "$filename_no_ext" done | sort -u >"$temp_failures" + set -e # Copy matching log files to output directory if [ -s "$temp_failures" ]; then -- GitLab From d15626b91205ba24a9e2eb0c1776ca01396f0c31 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 11:40:50 +0100 Subject: [PATCH 5/9] some additional printouts --- ci/run-first-frame-is-sid-test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/run-first-frame-is-sid-test.sh b/ci/run-first-frame-is-sid-test.sh index 2c33ffafaa..a66a1a534b 100755 --- a/ci/run-first-frame-is-sid-test.sh +++ b/ci/run-first-frame-is-sid-test.sh @@ -2,7 +2,7 @@ ### This test assures that for all DTX modes, decoding a bitstream that starts with an SID frame does not crash the decoder or cause a sanitizer error -set -euxo pipefail +set -euo pipefail collect_failed_logs() { local console_output="$1" @@ -113,12 +113,18 @@ exit_code_usan=0 echo "-------------- 3. Usan decoder -------------- " scripts/IvasBuildAndRunChecks.py --checks CLANG3 --decoder_only -m $modes_all $common_args 2>&1 | tee "console_log_usan.txt" || exit_code_usan=$? +echo "-------------- 4. Collect logs -------------- " + # everything went as expected, now collect logs collect_failed_logs console_log_msan.txt CLANG1/logs logs/msan collect_failed_logs console_log_asan.txt CLANG2/logs logs/asan collect_failed_logs console_log_usan.txt CLANG3/logs logs/usan +echo "-------------- 5. Check for errors -------------- " if [ $exit_code_msan_no_stereo -ne 0 ] || [ $exit_code_msan_stereo -ne 0 ] || [ $exit_code_asan -ne 0 ] || [ $exit_code_usan -ne 0 ]; then echo "There was either a crash or a sanitizer error encountered when decoding a bitstream that starts with an SID. Check the artifacts for the logfiles." exit 1 fi + +echo "No errors occured." +exit 0 -- GitLab From f3c5500f2dee90f7fb7c457100635ad277b983ba Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 11:41:53 +0100 Subject: [PATCH 6/9] [revert-me] add intentional assert on stereo SID receive for testing the first-frame-is-sid-test logging --- lib_dec/ivas_init_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 6048cd7fa4..b051c9689a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -479,6 +479,7 @@ ivas_error ivas_dec_get_format( { case SID_DFT_STEREO: st_ivas->element_mode_init = IVAS_CPE_DFT; + assert( 0 ); break; case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; -- GitLab From 5ebcd35033eac93d575ed027a299f86bd922bb5f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 13:13:21 +0100 Subject: [PATCH 7/9] remove faulty counting of copied log files --- ci/run-first-frame-is-sid-test.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ci/run-first-frame-is-sid-test.sh b/ci/run-first-frame-is-sid-test.sh index a66a1a534b..13934eb23a 100755 --- a/ci/run-first-frame-is-sid-test.sh +++ b/ci/run-first-frame-is-sid-test.sh @@ -34,16 +34,14 @@ collect_failed_logs() { # Copy matching log files to output directory if [ -s "$temp_failures" ]; then echo "Copying log files for failed tasks to $output_dir..." - local count=0 while IFS= read -r basename_pattern; do # Find log files starting with this basename while IFS= read -r logfile; do cp -v "$logfile" "$output_dir/" - ((count++)) done < <(find "$log_dir" -type f -name "${basename_pattern}*") done <"$temp_failures" - echo "Done. Copied $count log file(s)." + echo "Done." else echo "No failures detected in $console_output" fi -- GitLab From 55a752bb2092683b4ddd3599a04813dc451f92de Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 13:18:11 +0100 Subject: [PATCH 8/9] Revert "[revert-me] add intentional assert on stereo SID receive" This reverts commit f3c5500f2dee90f7fb7c457100635ad277b983ba. --- lib_dec/ivas_init_dec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b051c9689a..6048cd7fa4 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -479,7 +479,6 @@ ivas_error ivas_dec_get_format( { case SID_DFT_STEREO: st_ivas->element_mode_init = IVAS_CPE_DFT; - assert( 0 ); break; case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; -- GitLab From 697236d499cb4319a95cfc3e2fdcab57d50ce415 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Feb 2026 13:19:33 +0100 Subject: [PATCH 9/9] Revert "change CI ref" This reverts commit 3f488aaaac135bfa4f24861df236c2addcb5cc62. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8c40d04694..81e3d0a3d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ variables: # note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this # see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information - IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF cleanup-first-frame-is-sid-test + IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF main # If you need to set some config variable only in a local branch, then add an overwrite here # One example is DISABLE_HRTF - this will be set on a branch which is about to be merged and will be removed in a subsequent second MR # this is more easily done directly here in the child repo -- GitLab