Skip to content

Commit

Permalink
refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfrantz committed Jul 18, 2024
1 parent 9f388de commit b1a3324
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
46 changes: 28 additions & 18 deletions bash/force-unit-testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ if ! eval ". ${LIB}" >/dev/null 2>&1; then
exit 1
fi


run_units(){
for cmd in "$@"; do
echo $cmd
if [ -f "$cmd" ] && [ -x "$cmd" ]; then
eval $cmd
else
base_cmd=$(basename "$cmd")
echoerr "$base_cmd: not executable"
fi
done
}
export -f run_units

help(){
cat <<HELP
Expand Down Expand Up @@ -95,18 +81,42 @@ echo "##########################################################################
echo ""
echo "Start of unit testing: $(date +"%Y-%m-%d %H:%M:%S")"
echo ""
echo "##########################################################################"
echo ""

units="$TEST/*"
debug "$units"
run_units $units # deliberately no quotes here

echo "$(echo $units | wc -w)" "tests were found."
echo ""
echo "##########################################################################"
echo ""

errors=0

for cmd in $units; do

echo "Testing $cmd"
if ! $cmd; then
((errors++))
fi
echo ""

done

echo ""
echo "##########################################################################"
echo ""
if [ "$errors" -eq 0 ]; then
echo "all tests passed, all OK"
else
echoerr "$errors test(s) have failed, better get some coffee"
fi
echo ""
echo "End of unit testing: $(date +"%Y-%m-%d %H:%M:%S")"
echo ""
echo "##########################################################################"

exit 0
if [ "$errors" -eq 0 ]; then
exit 0
else
exit 1
fi
2 changes: 1 addition & 1 deletion misc/force-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.12-dev:::2024-07-18_09:35:28
3.7.12-dev:::2024-07-18_10:40:56

0 comments on commit b1a3324

Please sign in to comment.