2006-04-01 07:06:32 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Tests for the sourcecode base itself.
|
|
|
|
# Copyright 2006 by Mike Frysinger <vapier@gentoo.org>
|
2010-08-16 23:44:46 +05:30
|
|
|
# Licensed under GPLv2, see file LICENSE in this source tree.
|
2006-04-01 07:06:32 +05:30
|
|
|
|
2006-04-02 02:08:22 +05:30
|
|
|
[ -n "$srcdir" ] || srcdir=$(pwd)
|
2009-11-05 05:11:22 +05:30
|
|
|
. ./testing.sh
|
2006-04-01 07:06:32 +05:30
|
|
|
|
2006-04-16 11:39:46 +05:30
|
|
|
|
|
|
|
#
|
|
|
|
# if we don't have the sourcecode available, let's just bail
|
|
|
|
#
|
|
|
|
[ -s "$srcdir/../Makefile" ] || exit 0
|
|
|
|
[ -s "$srcdir/../include/applets.h" ] || exit 0
|
|
|
|
|
|
|
|
|
2008-02-15 07:12:28 +05:30
|
|
|
#
|
|
|
|
# make sure all usage strings are properly escaped. oftentimes people miss
|
|
|
|
# an escape sequence so we end up with:
|
|
|
|
# #define foo_usage \
|
|
|
|
# " this line is ok" \
|
|
|
|
# " as is this line"
|
|
|
|
# " but this one is broken as the \ is missing from above"
|
|
|
|
#
|
|
|
|
${CROSS_COMPILE}cpp -dD -P $srcdir/../include/usage.h \
|
|
|
|
| sed -e '/^#define/d' -e '/^$/d' > src.usage.escaped
|
|
|
|
testing "Usage strings escaped" "cat src.usage.escaped" "" "" ""
|
|
|
|
rm -f src.usage.escaped
|
|
|
|
|
|
|
|
|
2006-04-16 11:39:46 +05:30
|
|
|
#
|
2006-04-01 07:06:32 +05:30
|
|
|
# verify the applet order is correct in applets.h, otherwise
|
|
|
|
# applets won't be called properly.
|
2006-04-16 11:39:46 +05:30
|
|
|
#
|
2009-11-05 05:19:08 +05:30
|
|
|
sed -n -e 's:^//::' -e '/^IF_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \
|
2006-04-16 11:39:46 +05:30
|
|
|
$srcdir/../include/applets.h > applet.order.current
|
2006-04-01 07:06:32 +05:30
|
|
|
LC_ALL=C sort applet.order.current > applet.order.correct
|
|
|
|
testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""
|
|
|
|
rm -f applet.order.current applet.order.correct
|
|
|
|
|
2006-04-16 11:39:46 +05:30
|
|
|
|
|
|
|
#
|
|
|
|
# check for misc common typos
|
|
|
|
#
|
|
|
|
find $srcdir/../ \
|
|
|
|
'(' -type d -a '(' -name .svn -o -name testsuite ')' -prune ')' \
|
|
|
|
-o '(' -type f -a -print0 ')' | xargs -0 \
|
|
|
|
grep -I \
|
|
|
|
-e '\<compatability\>' \
|
|
|
|
-e '\<compatable\>' \
|
|
|
|
-e '\<fordeground\>' \
|
2006-05-26 07:11:04 +05:30
|
|
|
-e '\<depency\>' -e '\<dependancy\>' -e '\<dependancies\>' \
|
2006-04-16 11:39:46 +05:30
|
|
|
-e '\<defalt\>' \
|
|
|
|
-e '\<remaing\>' \
|
2006-05-26 07:11:04 +05:30
|
|
|
-e '\<queueing\>' \
|
2006-04-16 11:39:46 +05:30
|
|
|
-e '\<detatch\>' \
|
|
|
|
-e '\<sempahore\>' \
|
|
|
|
-e '\<reprenstative\>' \
|
|
|
|
-e '\<overriden\>' \
|
|
|
|
-e '\<readed\>' \
|
|
|
|
-e '\<formated\>' \
|
2006-04-18 14:14:19 +05:30
|
|
|
-e '\<algorithic\>' \
|
2006-04-18 16:45:19 +05:30
|
|
|
-e '\<deamon\>' \
|
2006-04-18 19:47:49 +05:30
|
|
|
-e '\<derefernce\>' \
|
2006-08-29 05:01:54 +05:30
|
|
|
-e '\<acomadate\>' \
|
2006-04-16 11:39:46 +05:30
|
|
|
| sed -e "s:^$srcdir/\.\./::g" > src.typos
|
|
|
|
testing "Common typos" "cat src.typos" "" "" ""
|
|
|
|
rm -f src.typos
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# don't allow obsolete functions
|
|
|
|
#
|
|
|
|
find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
|
2009-11-15 04:42:53 +05:30
|
|
|
grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime|sigblock|siggetmask|sigsetmask)\>[[:space:]]*\(' \
|
2006-04-17 02:44:59 +05:30
|
|
|
| sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs
|
|
|
|
testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" ""
|
|
|
|
rm -f src.obsolete.funcs
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# don't allow obsolete headers
|
|
|
|
#
|
|
|
|
find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
|
2006-04-29 10:14:08 +05:30
|
|
|
grep -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \
|
2006-04-17 02:44:59 +05:30
|
|
|
| sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers
|
2006-04-29 01:23:48 +05:30
|
|
|
testing "Obsolete headers" "cat src.obsolete.headers" "" "" ""
|
2006-04-17 02:44:59 +05:30
|
|
|
rm -f src.obsolete.headers
|
2006-04-16 11:39:46 +05:30
|
|
|
|
|
|
|
|
2006-04-01 07:06:32 +05:30
|
|
|
exit $FAILCOUNT
|