valgrind-condense revision 3ce85a5f5264e7118beb6524e120fd8b53a13da4
369N/A# Run Valgrind, condensing logged reports into an exit code. 369N/A# Copyright (C) 2014 Red Hat 369N/A# This program is free software; you can redistribute it and/or modify 369N/A# it under the terms of the GNU General Public License as published by 369N/A# the Free Software Foundation; either version 3 of the License, or 369N/A# (at your option) any later version. 369N/A# This program is distributed in the hope that it will be useful, 369N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 369N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 369N/A# GNU General Public License for more details. 369N/A# You should have received a copy of the GNU General Public License 3661N/AUsage: `basename "$0"` ERROR_EXITCODE [PATH_PATTERN...] [-- VALGRIND_ARG...] 3661N/ARun Valgrind, condensing logged reports into an exit code. 3661N/A ERROR_EXITCODE An exit code to return if at least one error is found in 3661N/A PATH_PATTERN An extended glob pattern matching (original) paths to 3661N/A programs to execute under Valgrind. Execution is skipped 3661N/A and success is returned for non-matching programs. Without 3661N/A patterns, all programs match. 3661N/A VALGRIND_ARG An argument to pass to Valgrind after the arguments 3661N/A specified by `basename "$0"`. 4561N/AThe first non-option VALGRIND_ARG will be considered the path to the program 4561N/Ato execute under Valgrind and will be used in naming Valgrind log files as 4561N/A PROGRAM_NAME.PID.valgrind.log 3996N/Awhere PROGRAM_NAME is the filename portion of the program path and PID is the 369N/Aexecuted process ID. If the last directory of the program path is ".libs" and 369N/Athe filename begins with "lt-", both are removed to match the name of libtool 369N/Afrontend script. All files matching PROGRAM_NAME.*.valgrind.log are removed 369N/Abefore invoking Valgrind. 369N/AIf an error is found in Valgrind log files, ERROR_EXITCODE is returned, 369N/Aotherwise Valgrind exit code is returned. 4561N/A echo "Invalid number of arguments." >&
2 369N/A# Find program path argument 369N/Aif [[ -z
"${program_path+set}" ]];
then 369N/A echo "Program path not specified." >&
2 369N/A# Match against path patterns, if any 5810N/Aif [[ ${
#path_pattern_list[@]} != 0 ]]; then # Generate original path from libtool path if grep -q
'^==[0-9]\+== *ERROR SUMMARY: *[1-9]' \