schematestutils.sh 633 字节
Newer Older
1 2
#!/bin/sh

3
check_schema () {
4 5

DIRS=$1
6 7 8
SCHEMA="$abs_srcdir/../docs/schemas/$2"

test_intro $this_test
9 10 11 12 13 14 15

n=0
f=0
for dir in $DIRS
do
  XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1

16
  for xml in `echo $XML | sort`
17 18 19 20 21
  do
    n=`expr $n + 1`
    cmd="xmllint --relaxng $SCHEMA --noout $xml"
    result=`$cmd 2>&1`
    ret=$?
22 23

    test_result $n $(basename $(dirname $xml))"/"$(basename $xml) $ret
24
    if test "$verbose" = "1" && test $ret != 0 ; then
25
        printf '%s\n' "$cmd" "$result"
26 27
    fi
    if test "$ret" != 0 ; then
28 29 30 31
        f=`expr $f + 1`
    fi
  done
done
32 33

test_final $n $f
34 35 36 37 38 39

ret=0
test $f != 0 && ret=255
exit $ret

}