slitaz-base-files rev 170

Add libtaz.sh and libpkg.sh functions usage to testsuite
author Christophe Lincoln <pankso@slitaz.org>
date Wed May 16 16:55:32 2012 +0200 (2012-05-16)
parents 076cd48b7ee8
children 4ca3c7426952
files testsuite.sh
line diff
     1.1 --- a/testsuite.sh	Tue May 15 21:47:57 2012 -0500
     1.2 +++ b/testsuite.sh	Wed May 16 16:55:32 2012 +0200
     1.3 @@ -22,6 +22,31 @@
     1.4  	separator
     1.5  }
     1.6  
     1.7 +# Usage: check_functions path/to/lib.sh
     1.8 +check_functions() {
     1.9 +	lib=$1
    1.10 +	echo -n "$(boldify "Checking: $(basename $lib) functions")"
    1.11 +	indent 34 "$(colorize $(grep "[a-z]() {" $lib | wc -l) 32)"
    1.12 +	separator
    1.13 +	grep "[a-z]() {" $lib | while read line
    1.14 +	do
    1.15 +		func=`echo "$line" | cut -d '(' -f 1`
    1.16 +		count=0
    1.17 +		usage=0
    1.18 +		echo -n "Checking: ${func}()"
    1.19 +		for tool in /usr/bin/cook* /usr/bin/taz* /usr/bin/spk* /usr/sbin/spk* \
    1.20 +			/sbin/taz*
    1.21 +		do
    1.22 +			[ -x "$tool" ] || continue
    1.23 +			count=$(grep "$func" $tool | wc -l)
    1.24 +			usage=$(($usage + $count))
    1.25 +		done
    1.26 +		indent 34 "$usage"
    1.27 +	done
    1.28 +	separator
    1.29 +}
    1.30 +
    1.31 +#clear
    1.32  echo -n "Checking libtaz.sh: log()"
    1.33  activity=/tmp/testsuite.log
    1.34  log "Message from SliTaz testsuite"
    1.35 @@ -31,10 +56,17 @@
    1.36  
    1.37  check_libtaz
    1.38  output="raw"
    1.39 +echo "Checking libtaz.sh: --output=raw"
    1.40  check_libtaz
    1.41  
    1.42 +# Check libtaz.sh functions usage
    1.43 +output="term"
    1.44 +check_functions 'rootfs/lib/libtaz.sh'
    1.45 +
    1.46 +# Check libpkg.sh functions usage
    1.47 +check_functions 'rootfs/usr/lib/slitaz/libpkg.sh'
    1.48 +
    1.49  [ "$forced" ] && echo "Checking option: forced=$forced"
    1.50  [ "$root" ] && echo "Checking option: root=$root"
    1.51  [ ! "$1" ] && echo "Check options: $(basename $0) --forced --root=/dev/null"
    1.52 -
    1.53  exit 0