wrap-valgrind.sh raw

   1  #!/usr/bin/env bash
   2  #
   3  # Copyright (c) 2018-2021 The Limenka 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 "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
  19