diff --git a/test/Makefile.am b/test/Makefile.am index 48eb792..4131cd7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -5,12 +5,15 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca if USE_CPPUNIT cppunit_tests = caca-test endif +if BUILD_DOCUMENTATION +doxygen_tests = check-doxygen +endif -EXTRA_DIST = check-build +EXTRA_DIST = check-doxygen check-source check-win32 noinst_PROGRAMS = simple bench $(cppunit_tests) -TESTS = simple check-build $(cppunit_tests) +TESTS = simple check-source check-win32 $(doxygen_tests) $(cppunit_tests) simple_SOURCES = simple.c simple_LDADD = ../caca/libcaca.la diff --git a/test/check-build b/test/check-build deleted file mode 100755 index 17503b5..0000000 --- a/test/check-build +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -ret=0 - -# -# Check that the Win32 config.h is in sync with config.h.in -# - -config_h_in=$(dirname "$0")/../config.h.in -win32_config_h=$(dirname "$0")/../win32/config.h - -failure=0 -for key in $(sed -ne 's/.*#undef *\([A-Za-z0-9_]*\).*/\1/p' "$config_h_in"); -do - if ! grep '[ef] \<'"$key"'\>' "$win32_config_h" >/dev/null 2>&1; then - echo "error: $key missing from win32/config.h" - failure=1 - fi -done -if test "$failure" != "0"; then - ret=1 -else - echo "0 errors in Win32 config.h" -fi - -# -# Check that we have no tabs or trailing spaces in the source code -# -failure=0 -for dir in caca kernel src cxx examples ruby 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 - -# -# Check for Doxygen errors -# -warnings="$(grep -c Warning: ../doc/doxygen.log 2>/dev/null || echo 0)" -if test "$warnings" != "0"; then - echo "error: $warnings warnings in Doxygen generation:" - grep Warning: ../doc/doxygen.log | sed 's/\(.\{75\}\)...*/\1 .../' - ret=1 -else - echo "0 visible errors in documentation" -fi - -if test "$ret" != "0"; then - exit 1 -fi - -exit 0 - diff --git a/test/check-doxygen b/test/check-doxygen new file mode 100755 index 0000000..4f782ae --- /dev/null +++ b/test/check-doxygen @@ -0,0 +1,14 @@ +#!/bin/sh + +# +# Check for Doxygen warnings +# +if warnings="$(grep -c Warning: ../doc/doxygen.log 2>/dev/null)"; then + echo "error: $warnings warnings in Doxygen generation:" + grep Warning: ../doc/doxygen.log | sed 's/\(.\{75\}\)...*/\1 .../' + exit 1 +fi + +echo "0 visible errors in documentation" +exit 0 + diff --git a/test/check-source b/test/check-source new file mode 100755 index 0000000..e222bd9 --- /dev/null +++ b/test/check-source @@ -0,0 +1,32 @@ +#!/bin/sh + +# +# Check that we have no tabs or trailing spaces in the source code +# +failure=0 +for dir in caca kernel src cxx examples ruby 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 + exit 1 +fi + +echo "0 errors in source code" +exit 0 + diff --git a/test/check-win32 b/test/check-win32 new file mode 100755 index 0000000..602bdf2 --- /dev/null +++ b/test/check-win32 @@ -0,0 +1,27 @@ +#!/bin/sh + +ret=0 + +# +# Check that the Win32 config.h is in sync with config.h.in +# + +config_h_in=$(dirname "$0")/../config.h.in +win32_config_h=$(dirname "$0")/../win32/config.h + +failure=0 +for key in $(sed -ne 's/.*#undef *\([A-Za-z0-9_]*\).*/\1/p' "$config_h_in"); +do + if ! grep '[ef] \<'"$key"'\>' "$win32_config_h" >/dev/null 2>&1; then + echo "error: $key missing from win32/config.h" + failure=1 + fi +done + +if test "$failure" != "0"; then + exit 1 +fi + +echo "0 errors in Win32 config.h" +exit 0 +