blob: c115878febe3800eab7b0edbdffbefd737aaaffe [file] [log] [blame]
Mike Frysingerb0c54452006-04-01 01:36:32 +00001#!/bin/sh
2
3# Tests for the sourcecode base itself.
4# Copyright 2006 by Mike Frysinger <vapier@gentoo.org>
5# Licensed under GPL v2, see file LICENSE for details.
6
Mike Frysinger819b56b2006-04-01 20:38:22 +00007[ -n "$srcdir" ] || srcdir=$(pwd)
Mike Frysingerb0c54452006-04-01 01:36:32 +00008. testing.sh
9
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000010
11#
12# if we don't have the sourcecode available, let's just bail
13#
14[ -s "$srcdir/../Makefile" ] || exit 0
15[ -s "$srcdir/../include/applets.h" ] || exit 0
16
17
18#
Mike Frysingerb0c54452006-04-01 01:36:32 +000019# verify the applet order is correct in applets.h, otherwise
20# applets won't be called properly.
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000021#
Mike Frysingerb0c54452006-04-01 01:36:32 +000022sed -n -e '/^USE_[A-Z]*(APPLET(/{s:.*(::;s:,.*::;s:"::g;p}' \
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000023 $srcdir/../include/applets.h > applet.order.current
Mike Frysingerb0c54452006-04-01 01:36:32 +000024LC_ALL=C sort applet.order.current > applet.order.correct
25testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""
26rm -f applet.order.current applet.order.correct
27
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000028
29#
30# check for misc common typos
31#
32find $srcdir/../ \
33 '(' -type d -a '(' -name .svn -o -name testsuite ')' -prune ')' \
34 -o '(' -type f -a -print0 ')' | xargs -0 \
35 grep -I \
36 -e '\<compatability\>' \
37 -e '\<compatable\>' \
38 -e '\<fordeground\>' \
Mike Frysinger9c03cb92006-05-26 01:41:04 +000039 -e '\<depency\>' -e '\<dependancy\>' -e '\<dependancies\>' \
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000040 -e '\<defalt\>' \
41 -e '\<remaing\>' \
Mike Frysinger9c03cb92006-05-26 01:41:04 +000042 -e '\<queueing\>' \
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000043 -e '\<detatch\>' \
44 -e '\<sempahore\>' \
45 -e '\<reprenstative\>' \
46 -e '\<overriden\>' \
47 -e '\<readed\>' \
48 -e '\<formated\>' \
Bernhard Reutner-Fischer9b68dbd2006-04-18 08:44:19 +000049 -e '\<algorithic\>' \
Bernhard Reutner-Fischer074fe342006-04-18 11:15:19 +000050 -e '\<deamon\>' \
Bernhard Reutner-Fischer18260d52006-04-18 14:17:49 +000051 -e '\<derefernce\>' \
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +000052 -e '\<acomadate\>' \
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000053 | sed -e "s:^$srcdir/\.\./::g" > src.typos
54testing "Common typos" "cat src.typos" "" "" ""
55rm -f src.typos
56
57
58#
59# don't allow obsolete functions
60#
61find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
62 grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes)\>[[:space:]]*\(' \
Mike Frysingerd017d732006-04-16 21:14:59 +000063 | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs
64testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" ""
65rm -f src.obsolete.funcs
66
67
68#
69# don't allow obsolete headers
70#
71find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \
Mike Frysinger02fe8102006-04-29 04:44:08 +000072 grep -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \
Mike Frysingerd017d732006-04-16 21:14:59 +000073 | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers
Bernhard Reutner-Fischer15545b12006-04-28 19:53:48 +000074testing "Obsolete headers" "cat src.obsolete.headers" "" "" ""
Mike Frysingerd017d732006-04-16 21:14:59 +000075rm -f src.obsolete.headers
Mike Frysingerdbd8c3b2006-04-16 06:09:46 +000076
77
Mike Frysingerb0c54452006-04-01 01:36:32 +000078exit $FAILCOUNT