Add a source code sanity check.

This commit is contained in:
Sam Hocevar 2009-12-16 15:54:17 +00:00 committed by sam
parent fb6aeb50d0
commit 63311c54a5
6 changed files with 46 additions and 1 deletions

View file

@ -1,5 +1,5 @@
SUBDIRS = src tools fonts doc
SUBDIRS = src tools fonts doc test
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = bootstrap

View file

@ -78,5 +78,6 @@ AC_OUTPUT([
tools/Makefile
fonts/Makefile
doc/Makefile
test/Makefile
])

View file

@ -10,3 +10,5 @@ toilet_CPPFLAGS = -DFONTDIR=\"$(datadir)/figlet\"
toilet_CFLAGS = @CACA_CFLAGS@
toilet_LDADD = @CACA_LIBS@ @GETOPT_LIBS@ @ZLIB_LIBS@
echo-sources: ; echo $(SOURCES)

6
test/Makefile.am Normal file
View file

@ -0,0 +1,6 @@
# $Id$
EXTRA_DIST = check-build
TESTS = check-build

34
test/check-build Executable file
View file

@ -0,0 +1,34 @@
#!/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 echo-sources); do
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

@ -6,3 +6,5 @@ caca2tlf_SOURCES = caca2tlf.c
caca2tlf_CFLAGS = @CACA_CFLAGS@
caca2tlf_LDADD = @CACA_LIBS@
echo-sources: ; echo $(SOURCES)