Repair generate_test_coverage.sh after move to scripts directory.

This commit is contained in:
Todd C. Miller
2022-03-02 13:45:16 -07:00
parent cdee5d48da
commit 9f47ea5cb0

View File

@@ -1,16 +1,18 @@
#! /bin/bash
# This script is meant as an example on how to generate test coverage information
# It is meant to be executed from an empty build directory like:
# Usage: <path to the script>/generate_test_coverage.sh [some extra configure options]
#!/bin/sh
# This script is meant as an example on how to generate test coverage
# information. It is meant to be executed from an empty build directory.
#
# Usage: <path to the script>/generate_test_coverage.sh [configure options]
#
# Example:
# mkdir -p build
# cd build
# ../generate_test_coverage.sh --enable-python
# ../scripts/generate_test_coverage.sh --enable-python
script_dir=$(dirname "$0")
CONFIGURE=${CONFIGURE:-${script_dir}/configure}
srcdir=$(dirname "$0")
srcdir=${srcdir%%"/scripts"}
CONFIGURE=${CONFIGURE:-${srcdir}/configure}
LCOV=${LCOV:-lcov}
GENHTML=${GENHTML:-genhtml}
@@ -21,8 +23,8 @@ echo "Using genhtml: $GENHTML (Override with GENHTML environment variable)"
echo
"$CONFIGURE" "$@" CFLAGS="--coverage -fprofile-arcs -ftest-coverage -O0" LDFLAGS="-lgcov"
make
make || exit 1
make check
"${LCOV}" -c --directory . --output-file coverage.info --rc "geninfo_adjust_src_path = $PWD => $script_dir"
"${LCOV}" -c --directory . --output-file coverage.info --rc "geninfo_adjust_src_path = $PWD => $srcdir"
"${GENHTML}" coverage.info --output-directory test_coverage
echo "Test coverage can be found at: test_coverage/index.html"