/ ci / test / wrap-valgrind.sh
wrap-valgrind.sh
 1  #!/usr/bin/env bash
 2  #
 3  # Copyright (c) 2018-present The Bitcoin Core developers
 4  # Distributed under the MIT software license, see the accompanying
 5  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
 6  
 7  export LC_ALL=C.UTF-8
 8  
 9  for b_name in "${BASE_OUTDIR}/bin"/*; do
10      # shellcheck disable=SC2044
11      for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
12        echo "Wrap $b ..."
13        mv "$b" "${b}_orig"
14        echo '#!/usr/bin/env bash' > "$b"
15        echo "exec valgrind --gen-suppressions=all --quiet --error-exitcode=1 --suppressions=${BASE_ROOT_DIR}/contrib/valgrind.supp \"${b}_orig\" \"\$@\"" >> "$b"
16        chmod +x "$b"
17      done
18  done