3 # Tests for the sourcecode base itself.
4 # Copyright 2006 by Mike Frysinger <vapier@gentoo.org>
5 # Licensed under GPLv2, see file LICENSE in this source tree.
7 [ -n "$srcdir" ] || srcdir
=$
(pwd)
12 # if we don't have the sourcecode available, let's just bail
14 [ -s "$srcdir/../Makefile" ] ||
exit 0
15 [ -s "$srcdir/../include/applets.h" ] ||
exit 0
19 # make sure all usage strings are properly escaped. oftentimes people miss
20 # an escape sequence so we end up with:
22 # " this line is ok" \
24 # " but this one is broken as the \ is missing from above"
26 ${CROSS_COMPILE}cpp
-dD -P $srcdir/..
/include
/usage.h \
27 |
sed -e '/^#define/d' -e '/^$/d' > src.usage.escaped
28 testing
"Usage strings escaped" "cat src.usage.escaped" "" "" ""
29 rm -f src.usage.escaped
33 # verify the applet order is correct in applets.h, otherwise
34 # applets won't be called properly.
36 sed -n -e 's:^//::' -e '/^IF_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \
37 $srcdir/..
/include
/applets.h
> applet.order.current
38 LC_ALL
=C
sort applet.order.current
> applet.order.correct
39 testing
"Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""
40 rm -f applet.order.current applet.order.correct
44 # check for misc common typos
47 '(' -type d
-a '(' -name .svn
-o -name testsuite
')' -prune ')' \
48 -o '(' -type f
-a -print0 ')' |
xargs -0 \
50 -e '\<compatability\>' \
52 -e '\<fordeground\>' \
53 -e '\<depency\>' -e '\<dependancy\>' -e '\<dependancies\>' \
59 -e '\<reprenstative\>' \
67 |
sed -e "s:^$srcdir/\.\./::g" > src.typos
68 testing
"Common typos" "cat src.typos" "" "" ""
73 # don't allow obsolete functions
75 find $srcdir/..
'(' -name '*.c' -o -name '*.h' ')' -print0 |
xargs -0 \
76 grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime|sigblock|siggetmask|sigsetmask)\>[[:space:]]*\(' \
77 |
sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs
78 testing
"Obsolete function usage" "cat src.obsolete.funcs" "" "" ""
79 rm -f src.obsolete.funcs
83 # don't allow obsolete headers
85 find $srcdir/..
'(' -name '*.c' -o -name '*.h' ')' -print0 |
xargs -0 \
86 grep -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \
87 |
sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers
88 testing
"Obsolete headers" "cat src.obsolete.headers" "" "" ""
89 rm -f src.obsolete.headers