Detect which directories to test

This commit is contained in:
Pierre Pronchery 2016-01-20 02:03:17 +01:00
parent 024133740f
commit 66081c65c5

View File

@ -27,14 +27,51 @@
#variables
DEVNULL="/dev/null"
PROGNAME="xmllint.sh"
PROJECTCONF="../project.conf"
#executables
DATE="date"
DEBUG="_debug"
FIND="find"
SORT="sort"
TR="tr"
XMLLINT="xmllint"
#functions
#xmllint
_xmllint()
{
ret=0
$DATE
echo
while read line; do
case "$line" in
"["*)
break
;;
"subdirs="*)
subdirs=${line#subdirs=}
subdirs=$(echo "$subdirs" | $TR ',' ' ')
;;
esac
done < "$PROJECTCONF"
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
for filename in $($FIND "../$subdir" -name '*.xml' -o -name '*.xsl'); do
$DEBUG $XMLLINT "$filename" 2>&1 > "$DEVNULL"
if [ $? -eq 0 ]; then
echo "$filename:"
else
echo "$PROGNAME: $filename: FAIL" 1>&2
ret=2
fi
done
done
return $ret
}
#debug
_debug()
{
@ -81,9 +118,5 @@ target="$1"
#clean
[ $clean -ne 0 ] && return 0
ret=0
exec 3>&1
for i in $($FIND "../src" "../tools" -name '*.xml' -o -name '*.xsl' | $SORT); do
$DEBUG $XMLLINT "$i" > "$DEVNULL" || ret=2
done 2> "$target"
exit $ret
_xmllint > "$target"