1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-07 16:36:13 +02:00
git/t/aggregate-results.sh
Fabian Stelzer 49da404070 test-lib: show missing prereq summary
When running the full test suite many tests can be skipped because of
missing prerequisites. It not easy right now to get an overview of which
ones are missing.
When switching to a new machine or environment some libraries and tools
might be missing or maybe a dependency broke completely. In this case
the tests would indicate nothing since all dependant tests are simply
skipped. This could hide broken behaviour or missing features in the
build. Therefore this patch summarizes the missing prereqs at the end of
the test run making it easier to spot such cases.

 - Add failed prereqs to the test results.
 - Aggregate and then show them with the totals.

Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-11-20 23:24:11 -08:00

64 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
failed_tests=
fixed=0
success=0
failed=0
broken=0
total=0
missing_prereq=
while read file
do
while read type value
do
case $type in
'')
continue ;;
fixed)
fixed=$(($fixed + $value)) ;;
success)
success=$(($success + $value)) ;;
failed)
failed=$(($failed + $value))
if test $value != 0
then
testnum=$(expr "$file" : 'test-results/\(t[0-9]*\)-')
failed_tests="$failed_tests $testnum"
fi
;;
broken)
broken=$(($broken + $value)) ;;
total)
total=$(($total + $value)) ;;
missing_prereq)
missing_prereq="$missing_prereq,$value" ;;
esac
done <"$file"
done
if test -n "$missing_prereq"
then
unique_missing_prereq=$(
echo $missing_prereq |
tr -s "," "\n" |
grep -v '^$' |
sort -u |
paste -s -d ' ')
if test -n "$unique_missing_prereq"
then
printf "\nmissing prereq: $unique_missing_prereq\n\n"
fi
fi
if test -n "$failed_tests"
then
printf "\nfailed test(s):$failed_tests\n\n"
fi
printf "%-8s%d\n" fixed $fixed
printf "%-8s%d\n" success $success
printf "%-8s%d\n" failed $failed
printf "%-8s%d\n" broken $broken
printf "%-8s%d\n" total $total