Improve testsuite.

This commit is contained in:
Sam Hocevar 2010-02-09 00:50:15 +00:00 committed by sam
parent 2c63c7ada7
commit f03f5e8823
4 changed files with 57 additions and 61 deletions

View file

@ -1,5 +1,5 @@
EXTRA_DIST = check-build check-fonts
EXTRA_DIST = check-source check-fonts
TESTS = check-build check-fonts
TESTS = check-source check-fonts

View file

@ -1,38 +0,0 @@
#!/bin/sh
ret=0
#
# Check that we have no tabs or trailing spaces in the source code
#
failure=0
for dir in src tools; do
pushd ../$dir >/dev/null
for x in $(make -s echo-sources); do
case "$x" in
*.c|*.cpp|*.h|*.m) ;;
*) continue ;;
esac
if grep '[[:space:]]$' "$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains trailing spaces"
failure=1
fi
if grep ' ' "$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains tabs"
failure=1
fi
done
popd >/dev/null
done
if test "$failure" != "0"; then
ret=1
else
echo "0 errors in source code"
fi
if test "$ret" != "0"; then
exit 1
fi
exit 0

View file

@ -5,28 +5,25 @@ ret=0
#
# Check that we have no tabs or trailing spaces in the source code
#
failure=0
(cd ../fonts
for x in $(make -s echo-fonts); do
case "$x" in
*.tlf|*.flf) ;;
*) continue ;;
esac
echo "Checking font $x..."
if ../src/toilet -d ../fonts -f "$x" Hello World >/dev/null; then
:
else
echo "Error loading font $x"
failure=1
fi
done)
if test "$failure" != "0"; then
ret=1
else
echo "0 errors in fonts"
fi
nfails=0
nfonts=0
for x in $(make -s echo-fonts -C ../fonts); do
case "$x" in
*.tlf|*.flf) ;;
*) continue ;;
esac
nfonts=$(($nfonts + 1))
if ../src/toilet -d ../fonts -f "$x" Hello World >/dev/null; then
:
else
echo "Error loading font $x"
nfails=$(($nfails + 1))
fi
done
if test "$ret" != "0"; then
echo "$nfonts fonts, $nfails load errors"
if test "$nfails" != "0"; then
exit 1
fi

37
test/check-source Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
#
# Check that we have no tabs or trailing spaces in the source code
#
nfails=0
nfiles=0
nlines=0
for dir in $(make -s echo-dirs -C ..); do
if [ ! -d "../$dir" ]; then continue; fi
for x in $(make -s echo-sources -C ../$dir); do
case "$x" in
*.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|.py|.pl)
nfiles=$(($nfiles + 1));
nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;;
*)
continue ;;
esac
if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains trailing spaces"
nfails=$(($nfails + 1))
fi
if grep ' ' "../$dir/$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains tabs"
nfails=$(($nfails + 1))
fi
done
done
echo "$nfiles files, $nlines lines, $nfails errors in source code"
if test "$nfails" != "0"; then
exit 1
fi
exit 0