zzuf/test/check-build

66 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
#
# check-build - check build system and source code for inconsistencies
# Copyright (c) 2009-2010 Sam Hocevar <sam@hocevar.net>
# All Rights Reserved
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
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
echo "error: $key missing from msvc/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 src test; do
(cd $(dirname "$0")/../$dir
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)
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