Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 1 | #!/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 Frysinger | 819b56b | 2006-04-01 20:38:22 +0000 | [diff] [blame] | 7 | [ -n "$srcdir" ] || srcdir=$(pwd) |
Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 8 | . testing.sh |
| 9 | |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 10 | |
| 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 Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 19 | # verify the applet order is correct in applets.h, otherwise |
| 20 | # applets won't be called properly. |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 21 | # |
Denis Vlasenko | 8274e06 | 2007-08-06 03:41:08 +0000 | [diff] [blame] | 22 | sed -n -e '/^USE_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 23 | $srcdir/../include/applets.h > applet.order.current |
Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 24 | LC_ALL=C sort applet.order.current > applet.order.correct |
| 25 | testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" "" |
| 26 | rm -f applet.order.current applet.order.correct |
| 27 | |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 28 | |
| 29 | # |
| 30 | # check for misc common typos |
| 31 | # |
| 32 | find $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 Frysinger | 9c03cb9 | 2006-05-26 01:41:04 +0000 | [diff] [blame] | 39 | -e '\<depency\>' -e '\<dependancy\>' -e '\<dependancies\>' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 40 | -e '\<defalt\>' \ |
| 41 | -e '\<remaing\>' \ |
Mike Frysinger | 9c03cb9 | 2006-05-26 01:41:04 +0000 | [diff] [blame] | 42 | -e '\<queueing\>' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 43 | -e '\<detatch\>' \ |
| 44 | -e '\<sempahore\>' \ |
| 45 | -e '\<reprenstative\>' \ |
| 46 | -e '\<overriden\>' \ |
| 47 | -e '\<readed\>' \ |
| 48 | -e '\<formated\>' \ |
Bernhard Reutner-Fischer | 9b68dbd | 2006-04-18 08:44:19 +0000 | [diff] [blame] | 49 | -e '\<algorithic\>' \ |
Bernhard Reutner-Fischer | 074fe34 | 2006-04-18 11:15:19 +0000 | [diff] [blame] | 50 | -e '\<deamon\>' \ |
Bernhard Reutner-Fischer | 18260d5 | 2006-04-18 14:17:49 +0000 | [diff] [blame] | 51 | -e '\<derefernce\>' \ |
Bernhard Reutner-Fischer | 73561cc | 2006-08-28 23:31:54 +0000 | [diff] [blame] | 52 | -e '\<acomadate\>' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 53 | | sed -e "s:^$srcdir/\.\./::g" > src.typos |
| 54 | testing "Common typos" "cat src.typos" "" "" "" |
| 55 | rm -f src.typos |
| 56 | |
| 57 | |
| 58 | # |
| 59 | # don't allow obsolete functions |
| 60 | # |
| 61 | find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \ |
| 62 | grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes)\>[[:space:]]*\(' \ |
Mike Frysinger | d017d73 | 2006-04-16 21:14:59 +0000 | [diff] [blame] | 63 | | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs |
| 64 | testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" "" |
| 65 | rm -f src.obsolete.funcs |
| 66 | |
| 67 | |
| 68 | # |
| 69 | # don't allow obsolete headers |
| 70 | # |
| 71 | find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \ |
Mike Frysinger | 02fe810 | 2006-04-29 04:44:08 +0000 | [diff] [blame] | 72 | grep -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \ |
Mike Frysinger | d017d73 | 2006-04-16 21:14:59 +0000 | [diff] [blame] | 73 | | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers |
Bernhard Reutner-Fischer | 15545b1 | 2006-04-28 19:53:48 +0000 | [diff] [blame] | 74 | testing "Obsolete headers" "cat src.obsolete.headers" "" "" "" |
Mike Frysinger | d017d73 | 2006-04-16 21:14:59 +0000 | [diff] [blame] | 75 | rm -f src.obsolete.headers |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 76 | |
| 77 | |
Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 78 | exit $FAILCOUNT |