slitaz-base-files view testsuite.sh @ rev 174
Colorize DEBUG and let use --decolor=NB
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 17 14:53:51 2012 +0200 (2012-05-17) |
parents | 1db99ad848a8 |
children | fa75f9c09dd8 |
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 "Message " 33)
18 echo -n $(colorize "Message " 35)
19 colorize "Message" 36
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