Commit 12f3e947 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'ci/adapt-first-frame-is-sid-test-for-basop' into 'main'

[CI] adapt first frame is sid test for basop

See merge request !2431
parents f9ca9221 5bd97c8c
Loading
Loading
Loading
Loading
Loading
+35 −26
Original line number Diff line number Diff line
#! /usr/bin/bash

### 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

# build encoder without sanitizers for faster runtime
make clean
make -j IVAS_cod
mv IVAS_cod IVAS_cod_nosan

# run all modes and cut bitstream to start with an SID. Use mono output to limit runtime, test is only about decoding the first frame
modes_no_sba=$(scripts/runIvasCodec.py -l | grep dtx | grep -vE "stereo|FOA|HOA" )
modes_hoa=$(scripts/runIvasCodec.py -l | grep dtx | grep -E "HOA")
modes_foa=$(scripts/runIvasCodec.py -l | grep dtx | grep "FOA")
modes_stereo=$(scripts/runIvasCodec.py -l | grep dtx | grep "stereo")
# collect DTX modes to run
# stereo modes are run separately from the rest
# reason: the stv signal does not trigger DTX for the highest stereo bitrates. We use the ltv signal cut to a different length than the other signal
modes_no_stereo=$(scripts/runIvasCodec.py -l | grep dtx | grep -v stereo)
modes_stereo=$(scripts/runIvasCodec.py -l | grep dtx | grep stereo)

# config vars
testcase_timeout=20
bitstream_cut_length=5
common_args="-z console -p scripts/config/ci_linux_sidstart_test.json -s --oc mono --timeout $testcase_timeout --bs_length $bitstream_cut_length"
common_args="-z console -p scripts/config/ci_linux_sidstart_test.json -s --oc mono --bs_length $bitstream_cut_length"

# first encoder + MSAN decoder
# hack to use the encoder with no sanitizers
@@ -24,38 +27,44 @@ make IVAS_dec -j CLANG=1
cp IVAS_dec CLANG1/IVAS_dec
cp IVAS_cod_nosan CLANG1/IVAS_cod

exit_code_msan=0
exit_code_msan_no_stereo=0
exit_code_msan_stereo=0
echo "-------------- 1. Encoder + Msan decoder -------------- "
echo "-------------- 1.1 all DTX modes except SBA and stereo -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_no_sba -U 0:20 $common_args || exit_code_msan=$?
echo "-------------- 1.2 HOA2 + HOA3 DTX modes -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_hoa -U 70:80 $common_args || exit_code_msan=$?
echo "-------------- 1.3 FOA DTX modes -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_foa -U 75:110 $common_args || exit_code_msan=$?
echo "-------------- 1.4 stereo DTX modes -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG1 -m $modes_stereo -U 40:60 $common_args || exit_code_msan=$?
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=$?
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/

# sanity check: ensure that we have DTX frames in the cut bitstreams
grep_exit_code=0
grep -r "Extracted 0 frames!" logs_enc/ || 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"
  echo "$grep_result"
  exit 1
fi

# ASAN and USAN can be done in one go and 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
# 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 -------------- "
echo "-------------- 2.1 all DTX modes except SBA and stereo -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG2 CLANG3 --decoder_only -m $modes_no_sba -U 0:20 $common_args || exit_code_asan_usan=$?
echo "-------------- 2.2 HOA2 + HOA3 DTX modes -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG2 CLANG3 --decoder_only -m $modes_hoa -U 70:80 $common_args || exit_code_asan_usan=$?
echo "-------------- 2.3 FOA DTX modes -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG2 CLANG3 --decoder_only -m $modes_foa -U 75:110 $common_args || exit_code_asan_usan=$?
echo "-------------- 2.4 stereo DTX modes -------------- "
scripts/IvasBuildAndRunChecks.py --checks CLANG2 CLANG3 --decoder_only -m $modes_stereo -U 40:60 $common_args || exit_code_asan_usan=$?
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

if [ $exit_code_msan -ne 0 ] || [ $exit_code_asan_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
if [ $exit_code_msan_no_stereo -ne 0 ] || [ $exit_code_msan_stereo -ne 0 ] || [ $exit_code_asan_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
+3 −3
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@
    "inpaths": {
        "MONO": "/usr/local/testv/stv48n.wav",
        "STEREO": "/usr/local/ltv/ltv48_STEREO.wav",
        "FOA": "/usr/local/ltv/ltv48_FOA.wav",
        "HOA2": "/usr/local/ltv/ltv48_HOA2.wav",
        "HOA3": "/usr/local/ltv/ltv48_HOA3.wav",
        "FOA": "/usr/local/testv/stvFOA48n.wav",
        "HOA2": "/usr/local/testv/stv2OA48n.wav",
        "HOA3": "/usr/local/testv/stv3OA48n.wav",
        "SBA": "/usr/local/ltv/ltv48_HOA3.wav",
        "MASA1TC": "/usr/local/ltv/ltv48_MASA1TC.wav",
        "MASA2TC": "/usr/local/ltv/ltv48_MASA2TC.wav",