2009-10-08 22:06:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-08-22 15:30:50 +00:00
|
|
|
(xmllint --version) >/dev/null 2>&1 || skip_test_ 'Missing xmllint'
|
|
|
|
|
2009-10-16 23:16:25 +00:00
|
|
|
check_schema () {
|
2009-10-08 22:06:59 +00:00
|
|
|
|
|
|
|
DIRS=$1
|
2009-11-30 19:01:31 +00:00
|
|
|
SCHEMA="$abs_srcdir/../docs/schemas/$2"
|
|
|
|
|
|
|
|
test_intro $this_test
|
2009-10-08 22:06:59 +00:00
|
|
|
|
|
|
|
n=0
|
|
|
|
f=0
|
|
|
|
for dir in $DIRS
|
|
|
|
do
|
|
|
|
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
|
|
|
|
2011-12-22 19:00:45 +00:00
|
|
|
for xml in `echo "$XML" | sort`
|
2009-10-08 22:06:59 +00:00
|
|
|
do
|
|
|
|
n=`expr $n + 1`
|
|
|
|
cmd="xmllint --relaxng $SCHEMA --noout $xml"
|
|
|
|
result=`$cmd 2>&1`
|
|
|
|
ret=$?
|
2009-11-30 19:01:31 +00:00
|
|
|
|
2013-05-09 17:36:58 +00:00
|
|
|
# Alter ret if error was expected.
|
|
|
|
case $xml:$ret in
|
|
|
|
*-invalid.xml:[34]) ret=0 ;;
|
|
|
|
*-invalid.xml:0) ret=3 ;;
|
|
|
|
esac
|
|
|
|
|
2009-11-30 19:01:31 +00:00
|
|
|
test_result $n $(basename $(dirname $xml))"/"$(basename $xml) $ret
|
2010-03-24 08:05:27 +00:00
|
|
|
if test "$verbose" = "1" && test $ret != 0 ; then
|
2010-04-14 11:25:46 +00:00
|
|
|
printf '%s\n' "$cmd" "$result"
|
2009-11-30 19:01:31 +00:00
|
|
|
fi
|
|
|
|
if test "$ret" != 0 ; then
|
2009-10-08 22:06:59 +00:00
|
|
|
f=`expr $f + 1`
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2009-11-30 19:01:31 +00:00
|
|
|
|
|
|
|
test_final $n $f
|
2009-10-08 22:06:59 +00:00
|
|
|
|
|
|
|
ret=0
|
|
|
|
test $f != 0 && ret=255
|
|
|
|
exit $ret
|
|
|
|
|
|
|
|
}
|