diff --git a/ci/smoke_test.sh b/ci/smoke_test.sh index b710beab4eba4c58c807ee73cccadfcbba618323..41b34db51da715fb08fd72974daa7b52a3c5d6ee 100755 --- a/ci/smoke_test.sh +++ b/ci/smoke_test.sh @@ -57,8 +57,20 @@ cfg=./scripts/config/ci_linux.json dly_profile=./scripts/dly_error_profiles/dly_error_profile_10.dat if [ $BUILD -eq 1 ];then - make clean - make all -j + # Enable memory macros to find unbalanced memory allocations/deallocations + # Does not implement full memory analysis + make clean + + # Replace free -> free_, malloc -> malloc_, calloc -> calloc_ + ./scripts/prepare_mem_dryrun.py + + # Enable WMOPS and disable DEBUGGING + sed -i.bak -e "s/\/\*\s*\(#define\s*WMOPS\)\s*\*\//\1/g" lib_com/options.h + sed -i.bak -e "s/\/\/\s*\(#define\s*WMOPS\)/\1/g" lib_com/options.h +# sed -i.bak -e "s/\s*\(#define\s*DEBUGGING\)/\/\*\1*\//g" lib_com/options.h + + make all -j + fi ./scripts/runIvasCodec.py -p $cfg -U 1 $WORKERS | tee smoke_test_output.txt @@ -66,4 +78,4 @@ fi modes_with_no_ext_out=$(./scripts/runIvasCodec.py -l | grep -v MASA | grep -v ISM) ./scripts/runIvasCodec.py -m $modes_with_no_ext_out -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile | tee smoke_test_output_jbm_noEXT.txt -./scripts/runIvasCodec.py -C MASA ISM1 ISM2 ISM3 ISM4 -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt \ No newline at end of file +./scripts/runIvasCodec.py -C MASA ISM1 ISM2 ISM3 ISM4 -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt diff --git a/lib_com/options.h b/lib_com/options.h index b974000782006a643ef24a5efd5322c2dfad3027..54c20247d2f63e7cf11ce47b8ab614b263181888 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,6 +153,7 @@ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ #define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ #define FIX_293_EXT_RENDERER_CLI /* FhG: Fix bugs in external renderer CLI */ +#define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/jbm_jb4_inputbuffer.c b/lib_dec/jbm_jb4_inputbuffer.c index f8a3d09b523dff9503ba4f4af99c63763a0fd9b4..9f2e3f032a3a2cf813fe1997a89d2ed2f1c0741e 100644 --- a/lib_dec/jbm_jb4_inputbuffer.c +++ b/lib_dec/jbm_jb4_inputbuffer.c @@ -45,6 +45,9 @@ #include "debug.h" #endif #include "jbm_jb4_inputbuffer.h" +#ifdef FIX_268 +#include "wmc_auto.h" +#endif #define WMC_TOOL_SKIP diff --git a/scripts/prepare_mem_dryrun.py b/scripts/prepare_mem_dryrun.py new file mode 100644 index 0000000000000000000000000000000000000000..21f5b8114592067bdb0b9d04d00fa9bb20c22227 --- /dev/null +++ b/scripts/prepare_mem_dryrun.py @@ -0,0 +1,29 @@ +#!/bin/python3 + +import re, os, fnmatch + +sub = ['free','malloc','calloc'] +dirs = ['./lib_com','./lib_enc','./lib_dec','./lib_rend'] +suffix = '*.c' + +skip = 0 + +for d in dirs: + print(d) + for path, ds, files in os.walk(d): + for filename in fnmatch.filter(files, suffix): + fileIn = os.path.join(path, filename) + with open(fileIn, 'r') as f_in: + lines = f_in.readlines() + with open(fileIn, 'w') as f_out: + for line in lines: + if re.search(r'#define\W+WMC_TOOL_SKIP', line): + skip = 1 + elif re.search(r'#undef\W+WMC_TOOL_SKIP', line): + skip = 0 + else: + if not skip: + for s in sub: + line = re.sub(r'\b%s\b' % (s), '%s' % (s+'_'), line) + f_out.write(line) + diff --git a/scripts/strsub_wmc_skip.py b/scripts/strsub_wmc_skip.py new file mode 100644 index 0000000000000000000000000000000000000000..4c4bfab64bcbc354ff9d8ed90ac5cc03f69900d2 --- /dev/null +++ b/scripts/strsub_wmc_skip.py @@ -0,0 +1,28 @@ +#!/bin/python3 + +import argparse +import re + +parser = argparse.ArgumentParser(description='Substitute strings in files, skipping blocks in WMC_TOOL_SKIP') +parser.add_argument('input',type=str,help='C source file') +parser.add_argument('target',type=str,help='Target string to replace') +parser.add_argument('dest',type=str,help='Destination string to insert') +args = parser.parse_args() +fileIn = args.input +target = args.target +dest = args.dest + +skip = 0 + +with open(fileIn, 'r') as f_in: + lines = f_in.readlines() +with open(fileIn, 'w') as f_out: + for line in lines: + if re.search(r'#define\W+WMC_TOOL_SKIP', line): + skip = 1 + elif re.search(r'#undef\W+WMC_TOOL_SKIP', line): + skip = 0 + else: + if not skip: + line = re.sub(r'\b%s\b' % (target), '%s' % (dest), line) + f_out.write(line) \ No newline at end of file