mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-20 17:20:05 +01:00
The main thing holding us back here was our gcov hacks. We used to rebuild the libevdev sources locally inside test/ with the gcov flags so that we could leave the main libevdev sources untouched. This doesn't work well with subdir-objects - we have to link to libevdev.la instead. To enable gcov, we now have to apply the gcov flags to the main library object. But this also means that when running, the notes files will be somewhere within the libevdev/ directory, not the test/ directory. Working around this in automake gets nasty quickly, so just add a script that knows how to search for things. No functional changes unless --enable-gcov is given at configure time - then don't install the library. The gcov reports are now in test/gcov-reports/ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
38 lines
1 KiB
Bash
Executable file
38 lines
1 KiB
Bash
Executable file
#!/bin/bash -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"
|