1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/bin/bash
#
# test-cfg-filelist.sh -- frontend for configuration file testsuite.
# autogenerates test data.
# (C) 2007-2010 - Francesco Romani <fromani -at- gmail -dot- com>
#
# This file is part of transcode, a video stream processing tool.
#
# transcode is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# transcode is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
REF="$( tempfile -p tclst -s .cfg )"
NEW="$( tempfile -p tclst -s .cfg )"
PROG="./test-cfg-filelist"
if [ -n "$1" ]; then
PROG="$1"
fi
function makelist() {
echo "[$1]"
for F in "$1"/*; do
echo "$F"
done
}
function testit() {
makelist "$1" >> "$REF"
"$PROG" "$REF" "$1" 2>&1 | sed 's/^\[test\]\ //g' >> "$NEW"
if diff -q "$REF" "$NEW" &> /dev/null ; then
printf "%-24s OK\n" "($1)"
else
printf "%-24s FAILED -> see ($REF|$NEW)\n" "($1)"
return 1
fi
return 0
}
export "TRANSCODE_LOG_NO_COLOR=1"
DIRS="/usr /boot /usr/bin /usr/lib"
I=0
J=0
for DIR in $DIRS; do
if testit $DIR; then
let J=$J+1
else
break
fi
let I=$I+1
done
#rm -f "$REF" "$NEW"
echo "test succesfull/runned = $J/$I"
|