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

Add: pt_BR.po && update httpd-cgi.desktop
author Claudinei Pereira <claudinei@slitaz.org>
date Tue Jan 22 23:57:14 2013 -0200 (2013-01-22)
parents d8adb319ac56
children 259c174621c7
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
24 echo -n "Checking libtaz.sh: emsg() "
25 emsg "<b>bold</b> color: <c 31>bold red</c> <c 32>bold green</c> separator:<->newline:<n> message with<i 26>indent"
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 -e "\nChecking 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