mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-20 13:50:16 +01:00
Don't hardcode /bin/bash, use /usr/bin/env bash instead, since not all platforms install bash as /bin/bash. FreeBSD, as an example, installs bash in /usr/local/bin/bash by default. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
40 lines
1 KiB
Bash
Executable file
40 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
if [[ $# -lt 2 ]]; then
|
|
echo "Usage: ./generate-gcov-report.sh <rel-target-dir> <srcdir> [<srcdir> ... ]"
|
|
exit 1
|
|
fi
|
|
|
|
target_dir=$1
|
|
shift
|
|
source_dirs=$*
|
|
|
|
if [[ "${target_dir:0:1}" != '/' ]]; then
|
|
target_dir="$PWD/$target_dir"
|
|
fi
|
|
summary_file="$target_dir/summary.txt"
|
|
|
|
mkdir -p "$target_dir"
|
|
rm -f "$target_dir"/*.gcov
|
|
|
|
for dir in $source_dirs; do
|
|
pushd "$dir" > /dev/null
|
|
for file in *.c; do
|
|
find ./ -name "*${file/\.c/.gcda}" -exec gcov {} \; > /dev/null
|
|
done
|
|
find ./ -name "*.gcov" \! -path "*/`basename "$target_dir"`/*" -exec mv {} "$target_dir" \;
|
|
popd > /dev/null
|
|
done
|
|
|
|
echo "========== coverage report ========" > "$summary_file"
|
|
for file in "$target_dir"/*.gcov; do
|
|
total=`grep -v " -:" "$file" | wc -l`
|
|
missing=`grep "#####" "$file" | wc -l`
|
|
hit=$((total - missing));
|
|
percent=$((($hit * 100)/$total))
|
|
fname=`basename "$file"`
|
|
printf "%-32s total lines: %4s not tested: %4s (%3s%%)\n" "$fname" "$total" "$missing" "$percent">> "$summary_file"
|
|
done
|
|
echo "========== =============== ========" >> "$summary_file"
|