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 | caa7940 | 2009-11-04 18:41:22 -0500 | [diff] [blame] | 8 | . ./testing.sh |
Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 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 | 25cd7fd | 2008-02-15 01:42:28 +0000 | [diff] [blame] | 19 | # make sure all usage strings are properly escaped. oftentimes people miss |
| 20 | # an escape sequence so we end up with: |
| 21 | # #define foo_usage \ |
| 22 | # " this line is ok" \ |
| 23 | # " as is this line" |
| 24 | # " but this one is broken as the \ is missing from above" |
| 25 | # |
| 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 |
| 30 | |
| 31 | |
| 32 | # |
Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 33 | # verify the applet order is correct in applets.h, otherwise |
| 34 | # applets won't be called properly. |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 35 | # |
Mike Frysinger | eacbca5 | 2009-11-04 18:49:08 -0500 | [diff] [blame] | 36 | sed -n -e 's:^//::' -e '/^IF_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 37 | $srcdir/../include/applets.h > applet.order.current |
Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 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 |
| 41 | |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 42 | |
| 43 | # |
| 44 | # check for misc common typos |
| 45 | # |
| 46 | find $srcdir/../ \ |
| 47 | '(' -type d -a '(' -name .svn -o -name testsuite ')' -prune ')' \ |
| 48 | -o '(' -type f -a -print0 ')' | xargs -0 \ |
| 49 | grep -I \ |
| 50 | -e '\<compatability\>' \ |
| 51 | -e '\<compatable\>' \ |
| 52 | -e '\<fordeground\>' \ |
Mike Frysinger | 9c03cb9 | 2006-05-26 01:41:04 +0000 | [diff] [blame] | 53 | -e '\<depency\>' -e '\<dependancy\>' -e '\<dependancies\>' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 54 | -e '\<defalt\>' \ |
| 55 | -e '\<remaing\>' \ |
Mike Frysinger | 9c03cb9 | 2006-05-26 01:41:04 +0000 | [diff] [blame] | 56 | -e '\<queueing\>' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 57 | -e '\<detatch\>' \ |
| 58 | -e '\<sempahore\>' \ |
| 59 | -e '\<reprenstative\>' \ |
| 60 | -e '\<overriden\>' \ |
| 61 | -e '\<readed\>' \ |
| 62 | -e '\<formated\>' \ |
Bernhard Reutner-Fischer | 9b68dbd | 2006-04-18 08:44:19 +0000 | [diff] [blame] | 63 | -e '\<algorithic\>' \ |
Bernhard Reutner-Fischer | 074fe34 | 2006-04-18 11:15:19 +0000 | [diff] [blame] | 64 | -e '\<deamon\>' \ |
Bernhard Reutner-Fischer | 18260d5 | 2006-04-18 14:17:49 +0000 | [diff] [blame] | 65 | -e '\<derefernce\>' \ |
Bernhard Reutner-Fischer | 73561cc | 2006-08-28 23:31:54 +0000 | [diff] [blame] | 66 | -e '\<acomadate\>' \ |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 67 | | sed -e "s:^$srcdir/\.\./::g" > src.typos |
| 68 | testing "Common typos" "cat src.typos" "" "" "" |
| 69 | rm -f src.typos |
| 70 | |
| 71 | |
| 72 | # |
| 73 | # don't allow obsolete functions |
| 74 | # |
| 75 | find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \ |
Denis Vlasenko | d02db89 | 2008-03-17 09:05:21 +0000 | [diff] [blame] | 76 | grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes|sigblock|siggetmask|sigsetmask)\>[[:space:]]*\(' \ |
Mike Frysinger | d017d73 | 2006-04-16 21:14:59 +0000 | [diff] [blame] | 77 | | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs |
| 78 | testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" "" |
| 79 | rm -f src.obsolete.funcs |
| 80 | |
| 81 | |
| 82 | # |
| 83 | # don't allow obsolete headers |
| 84 | # |
| 85 | find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \ |
Mike Frysinger | 02fe810 | 2006-04-29 04:44:08 +0000 | [diff] [blame] | 86 | 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] | 87 | | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers |
Bernhard Reutner-Fischer | 15545b1 | 2006-04-28 19:53:48 +0000 | [diff] [blame] | 88 | testing "Obsolete headers" "cat src.obsolete.headers" "" "" "" |
Mike Frysinger | d017d73 | 2006-04-16 21:14:59 +0000 | [diff] [blame] | 89 | rm -f src.obsolete.headers |
Mike Frysinger | dbd8c3b | 2006-04-16 06:09:46 +0000 | [diff] [blame] | 90 | |
| 91 | |
Mike Frysinger | b0c5445 | 2006-04-01 01:36:32 +0000 | [diff] [blame] | 92 | exit $FAILCOUNT |