From f32467338703790f5f764aa924d37c983d1985f8 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 22 Nov 2009 18:54:25 +0000 Subject: [PATCH] Check for typical source code issues in the testsuite. --- test/check-build | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/test/check-build b/test/check-build index 5c39351..e21f6ad 100755 --- a/test/check-build +++ b/test/check-build @@ -1,10 +1,15 @@ #!/bin/sh -failure=0 +ret=0 + +# +# Check that the Win32 config.h is in sync with config.h.in +# config_h_in=$(dirname "$0")/../config.h.in msvc_config_h=$(dirname "$0")/../msvc/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"'\>' "$msvc_config_h" >/dev/null 2>&1; then @@ -12,12 +17,41 @@ do failure=1 fi done - if test "$failure" != "0"; then - exit 1 + 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 src test; do + pushd ../$dir >/dev/null + # Dirty hack to print the $(SOURCES) variable + for x in $(make -s ID SHELL='echo @@$(SOURCES)@@' | tr -d '\n' | sed 's/.*@@\([^@]*\)@@.*/\1/'); + 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