Initial test framework and first test.
Add a basic test framework, borrowed from the framework used by git.git. A shell script library (tests/test-lib.sh) helps generate the fixtures, and simplifies the process of writing test scripts. Tests can be run as a suite (via 'make test') or individually (sh tests/t0000-config.sh). Results are aggregated upon completion. Includes a detailed README. A basic test of config file processing is part of this commit. Signed-off-by: Emil Sit <sit@emilsit.net>
This commit is contained in:
34
tests/aggregate-results.sh
Executable file
34
tests/aggregate-results.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
fixed=0
|
||||
success=0
|
||||
failed=0
|
||||
broken=0
|
||||
total=0
|
||||
|
||||
for file
|
||||
do
|
||||
while read type value
|
||||
do
|
||||
case $type in
|
||||
'')
|
||||
continue ;;
|
||||
fixed)
|
||||
fixed=$(($fixed + $value)) ;;
|
||||
success)
|
||||
success=$(($success + $value)) ;;
|
||||
failed)
|
||||
failed=$(($failed + $value)) ;;
|
||||
broken)
|
||||
broken=$(($broken + $value)) ;;
|
||||
total)
|
||||
total=$(($total + $value)) ;;
|
||||
esac
|
||||
done <"$file"
|
||||
done
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user