summaryrefslogtreecommitdiff
path: root/testsuite/all_sourcecode.tests
blob: dd92426da3cd968deee24ff6ca4182cf36bd8dab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh

# Tests for the sourcecode base itself.
# Copyright 2006 by Mike Frysinger <vapier@gentoo.org>
# Licensed under GPL v2, see file LICENSE for details.

[ -n "$srcdir" ] || srcdir=$(pwd)
. testing.sh


#
# if we don't have the sourcecode available, let's just bail
#
[ -s "$srcdir/../Makefile" ] || exit 0
[ -s "$srcdir/../include/applets.h" ] || exit 0


#
# verify the applet order is correct in applets.h, otherwise
# applets won't be called properly.
#
sed -n -e '/^USE_[A-Z]*(APPLET(/{s:.*(::;s:,.*::;s:"::g;p}' \
	$srcdir/../include/applets.h > applet.order.current
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


#
# 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\>' \
		-e '\<depency\>' \
		-e '\<defalt\>' \
		-e '\<remaing\>' \
		-e '\<queuing\>' \
		-e '\<detatch\>' \
		-e '\<sempahore\>' \
		-e '\<reprenstative\>' \
		-e '\<overriden\>' \
		-e '\<readed\>' \
		-e '\<formated\>' \
		-e '\<algorithic\>' \
		-e '\<deamon\>' \
		| 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 \
	grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes)\>[[:space:]]*\(' \
	| 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 \
	grep -E -e '\<(malloc|memory)\.h\>' \
	| sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers
testing "Obsolete function usage" "cat src.obsolete.headers" "" "" ""
rm -f src.obsolete.headers


exit $FAILCOUNT