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

New function unboldify(); I think, they will be handy
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon May 21 11:34:18 2012 +0300 (2012-05-21)
parents c09b461ada93
children d4df77afbed6
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: unboldify() "
17 unboldify "It's a <b>sample</b> message"
19 echo -n "Checking libtaz.sh: colorize() "
20 echo -n $(colorize 33 "Message ")
21 echo -n $(colorize 35 "Message ")
22 colorize 36 "Message"
24 echo "Checking libtaz.sh: separator"
25 separator
26 }
28 # Usage: check_functions path/to/lib.sh
29 check_functions() {
30 lib=$1
31 echo -n "$(boldify "Checking: $(basename $lib) functions")"
32 indent 34 "$(colorize 32 $(grep "[a-z]() {" $lib | wc -l))"
33 separator
34 grep "[a-z]() {" $lib | while read line
35 do
36 func=`echo "$line" | cut -d '(' -f 1`
37 count=0
38 usage=0
39 echo -n "Checking: ${func}()"
40 for tool in /usr/bin/cook* /usr/bin/taz* /usr/bin/spk* /usr/sbin/spk* \
41 /sbin/taz*
42 do
43 [ -x "$tool" ] || continue
44 count=$(grep "$func" $tool | wc -l)
45 usage=$(($usage + $count))
46 done
47 indent 34 "$usage"
48 done
49 separator
50 }
52 #clear
53 echo -n "Checking libtaz.sh: log()"
54 activity=/tmp/testsuite.log
55 log "Message from SliTaz testsuite"
56 status
57 cat $activity
58 rm -f $activity
60 check_libtaz
61 output="raw"
62 echo "Checking libtaz.sh: --output=raw"
63 check_libtaz
65 # Check libtaz.sh functions usage
66 output="term"
67 check_functions 'rootfs/lib/libtaz.sh'
69 # Check libpkg.sh functions usage
70 check_functions 'rootfs/usr/lib/slitaz/libpkg.sh'
72 [ "$forced" ] && echo "Checking option: forced=$forced"
73 [ "$root" ] && echo "Checking option: root=$root"
74 [ ! "$1" ] && echo "Check options: $(basename $0) --forced --root=/dev/null"
75 exit 0