Просмотр исходного кода

Improve testsuite.

pull/1/head
Sam Hocevar sam 15 лет назад
Родитель
Сommit
f03f5e8823
4 измененных файлов: 57 добавлений и 61 удалений
  1. +2
    -2
      test/Makefile.am
  2. +0
    -38
      test/check-build
  3. +18
    -21
      test/check-fonts
  4. +37
    -0
      test/check-source

+ 2
- 2
test/Makefile.am Просмотреть файл

@@ -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


+ 0
- 38
test/check-build Просмотреть файл

@@ -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


+ 18
- 21
test/check-fonts Просмотреть файл

@@ -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

echo "$nfonts fonts, $nfails load errors"

if test "$ret" != "0"; then
if test "$nfails" != "0"; then
exit 1
fi



+ 37
- 0
test/check-source Просмотреть файл

@@ -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


Загрузка…
Отмена
Сохранить