Improve testsuite.
This commit is contained in:
parent
2c63c7ada7
commit
f03f5e8823
4 changed files with 57 additions and 61 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -5,28 +5,25 @@ ret=0
|
||||||
#
|
#
|
||||||
# Check that we have no tabs or trailing spaces in the source code
|
# Check that we have no tabs or trailing spaces in the source code
|
||||||
#
|
#
|
||||||
failure=0
|
nfails=0
|
||||||
(cd ../fonts
|
nfonts=0
|
||||||
for x in $(make -s echo-fonts); do
|
for x in $(make -s echo-fonts -C ../fonts); do
|
||||||
case "$x" in
|
case "$x" in
|
||||||
*.tlf|*.flf) ;;
|
*.tlf|*.flf) ;;
|
||||||
*) continue ;;
|
*) continue ;;
|
||||||
esac
|
esac
|
||||||
echo "Checking font $x..."
|
nfonts=$(($nfonts + 1))
|
||||||
if ../src/toilet -d ../fonts -f "$x" Hello World >/dev/null; then
|
if ../src/toilet -d ../fonts -f "$x" Hello World >/dev/null; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
echo "Error loading font $x"
|
echo "Error loading font $x"
|
||||||
failure=1
|
nfails=$(($nfails + 1))
|
||||||
fi
|
fi
|
||||||
done)
|
done
|
||||||
if test "$failure" != "0"; then
|
|
||||||
ret=1
|
|
||||||
else
|
|
||||||
echo "0 errors in fonts"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$ret" != "0"; then
|
echo "$nfonts fonts, $nfails load errors"
|
||||||
|
|
||||||
|
if test "$nfails" != "0"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
37
test/check-source
Executable file
37
test/check-source
Executable 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
|
||||||
|
|
Loading…
Reference in a new issue