slitaz-base-files view testsuite.sh @ rev 175

Update colorize to handle args easier
author Christian Mesh <meshca@clarkson.edu>
date Sat May 19 03:35:25 2012 -0500 (2012-05-19)
parents 614db28a1e8a
children c09b461ada93
line source
1 #!/bin/sh
2 #
3 . rootfs/lib/libtaz.sh
5 check_libtaz() {
6 echo -n "Checking libtaz.sh: status() 0"
7 status
9 echo -n "Checking libtaz.sh: status() 1"
10 touch /tmp/1/2/2/4 2>/dev/null
11 status
13 echo -n "Checking libtaz.sh: boldify() "
14 boldify "Message"
16 echo -n "Checking libtaz.sh: colorize() "
17 echo -n $(colorize 33 "Message ")
18 echo -n $(colorize 35 "Message ")
19 colorize 36 "Message"
21 echo "Checking libtaz.sh: separator"
22 separator
23 }
25 # Usage: check_functions path/to/lib.sh
26 check_functions() {
27 lib=$1
28 echo -n "$(boldify "Checking: $(basename $lib) functions")"
29 indent 34 "$(colorize $(grep "[a-z]() {" $lib | wc -l) 32)"
30 separator
31 grep "[a-z]() {" $lib | while read line
32 do
33 func=`echo "$line" | cut -d '(' -f 1`
34 count=0
35 usage=0
36 echo -n "Checking: ${func}()"
37 for tool in /usr/bin/cook* /usr/bin/taz* /usr/bin/spk* /usr/sbin/spk* \
38 /sbin/taz*
39 do
40 [ -x "$tool" ] || continue
41 count=$(grep "$func" $tool | wc -l)
42 usage=$(($usage + $count))
43 done
44 indent 34 "$usage"
45 done
46 separator
47 }
49 #clear
50 echo -n "Checking libtaz.sh: log()"
51 activity=/tmp/testsuite.log
52 log "Message from SliTaz testsuite"
53 status
54 cat $activity
55 rm -f $activity
57 check_libtaz
58 output="raw"
59 echo "Checking libtaz.sh: --output=raw"
60 check_libtaz
62 # Check libtaz.sh functions usage
63 output="term"
64 check_functions 'rootfs/lib/libtaz.sh'
66 # Check libpkg.sh functions usage
67 check_functions 'rootfs/usr/lib/slitaz/libpkg.sh'
69 [ "$forced" ] && echo "Checking option: forced=$forced"
70 [ "$root" ] && echo "Checking option: root=$root"
71 [ ! "$1" ] && echo "Check options: $(basename $0) --forced --root=/dev/null"
72 exit 0