linux - valgrind : Opening several suppression files at once -
i have script executes unit tests using valgrind. script became big, because have maybe 10 suppression files (one per library), , possible have add more suppressions files.
now instead of having line :
memcheck_options="--tool=memcheck -q -v --num-callers=24 --leak-check=full --show-below-main=no --undef-value-errors=yes --leak-resolution=high --show-reachable=yes --error-limit=no --xml=yes --suppressions=$suppression_files_dir/suppression_stdlib.supp --suppressions=$suppression_files_dir/suppression_cg.supp --suppressions=$suppression_files_dir/suppression_glut.supp --suppressions=$suppression_files_dir/suppression_xlib.supp --suppressions=$suppression_files_dir/suppression_glibc.supp --suppressions=$suppression_files_dir/suppression_glib.supp --suppressions=$suppression_files_dir/suppression_qt.supp --suppressions=$suppression_files_dir/suppression_sdl.supp --suppressions=$suppression_files_dir/suppression_magick.supp --suppressions=$suppression_files_dir/suppression_sqlite.supp --suppressions=$suppression_files_dir/suppression_ld.supp --suppressions=$suppression_files_dir/suppression_selinux.supp --suppressions=$suppression_files_dir/suppression_opengl.supp"
i tried doing this:
memcheck_options="--tool=memcheck -q -v --num-callers=24 --leak-check=full --show-below-main=no --undef-value-errors=yes --leak-resolution=high --show-reachable=yes --error-limit=no --xml=yes --suppressions=$suppression_files_dir/*.supp"
but valgrind needs filename (doesn't accept asterix).
since doing in bash script, can tell me easiest way form line?
i thought listing files in suppression directory, iterating on list, , adding --suppressions=
prefix.
edit
i forgot ask. have far :
all_suppresion_files=`ls $suppression_files_dir/*.supp`
but can not find how transfer array. can help?
just way:
# form list of suppression files pass valgrind valgrind_suppression_files_list="" suppression_file in $suppression_files_dir/*.supp; valgrind_suppression_files_list+=" --suppressions=$suppression_file" done
there's no need ls
.
here's way without loop:
array=($suppression_files_dir/*.supp) valgrind_suppression_files_list=${array[@]/#/--suppressions=}
neither of these work if filenames contain spaces, additional steps can take care of that.
Comments
Post a Comment