Skip to content

Commit 49da404

Browse files
FStelzergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cd3e606 commit 49da404

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

t/aggregate-results.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ success=0
66
failed=0
77
broken=0
88
total=0
9+
missing_prereq=
910

1011
while read file
1112
do
@@ -30,10 +31,26 @@ do
3031
broken=$(($broken + $value)) ;;
3132
total)
3233
total=$(($total + $value)) ;;
34+
missing_prereq)
35+
missing_prereq="$missing_prereq,$value" ;;
3336
esac
3437
done <"$file"
3538
done
3639

40+
if test -n "$missing_prereq"
41+
then
42+
unique_missing_prereq=$(
43+
echo $missing_prereq |
44+
tr -s "," "\n" |
45+
grep -v '^$' |
46+
sort -u |
47+
paste -s -d ' ')
48+
if test -n "$unique_missing_prereq"
49+
then
50+
printf "\nmissing prereq: $unique_missing_prereq\n\n"
51+
fi
52+
fi
53+
3754
if test -n "$failed_tests"
3855
then
3956
printf "\nfailed test(s):$failed_tests\n\n"

t/test-lib.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ test_fixed=0
669669
test_broken=0
670670
test_success=0
671671

672+
test_missing_prereq=
673+
672674
test_external_has_tap=0
673675

674676
die () {
@@ -1069,6 +1071,14 @@ test_skip () {
10691071
of_prereq=" of $test_prereq"
10701072
fi
10711073
skipped_reason="missing $missing_prereq${of_prereq}"
1074+
1075+
# Keep a list of all the missing prereq for result aggregation
1076+
if test -z "$missing_prereq"
1077+
then
1078+
test_missing_prereq=$missing_prereq
1079+
else
1080+
test_missing_prereq="$test_missing_prereq,$missing_prereq"
1081+
fi
10721082
fi
10731083

10741084
case "$to_skip" in
@@ -1175,6 +1185,7 @@ test_done () {
11751185
fixed $test_fixed
11761186
broken $test_broken
11771187
failed $test_failure
1188+
missing_prereq $test_missing_prereq
11781189
11791190
EOF
11801191
fi

0 commit comments

Comments
 (0)