mirror of https://gitee.com/openkylin/libvirt.git
tests: Break out duplicate schema verification functionality.
All schema tests have identical functionality, so avoid the duplication.
This commit is contained in:
parent
16a3a4a30a
commit
39a7be470c
|
@ -52,6 +52,7 @@ EXTRA_DIST = \
|
|||
test-lib.sh \
|
||||
qemuxml2argvdata \
|
||||
nodeinfodata \
|
||||
schematestutils.sh \
|
||||
capabilityschematest \
|
||||
capabilityschemadata \
|
||||
networkschematest \
|
||||
|
|
|
@ -1,34 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
source ./schematestutils.sh
|
||||
|
||||
DOMAINDIRS="capabilityschemadata xencapsdata"
|
||||
DIRS="capabilityschemadata xencapsdata"
|
||||
SCHEMA="capability.rng"
|
||||
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DOMAINDIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
result=`xmllint --relaxng $srcdir/../docs/schemas/capability.rng --noout $xml 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo $result
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
check_schema "$DIRS" "$SCHEMA"
|
||||
|
|
|
@ -1,33 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
source ./schematestutils.sh
|
||||
|
||||
DOMAINDIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata"
|
||||
DIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata"
|
||||
SCHEMA="domain.rng"
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DOMAINDIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
result=`xmllint --relaxng $srcdir/../docs/schemas/domain.rng --noout $xml 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo $result
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
check_schema "$DIRS" "$SCHEMA"
|
||||
|
|
|
@ -1,33 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
source ./schematestutils.sh
|
||||
|
||||
DIRS="interfaceschemadata"
|
||||
SCHEMA="interface.rng"
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
result=`xmllint --relaxng $srcdir/../docs/schemas/interface.rng --noout $xml 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo $result
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
check_schema "$DIRS" "$SCHEMA"
|
||||
|
|
|
@ -1,33 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
source ./schematestutils.sh
|
||||
|
||||
DIRS="../src/network networkschemadata"
|
||||
SCHEMA="network.rng"
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
check_schema "$DIRS" "$SCHEMA"
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
result=`xmllint --relaxng $srcdir/../docs/schemas/network.rng --noout $xml 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo $result
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
|
|
|
@ -1,33 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
source ./schematestutils.sh
|
||||
|
||||
DIRS="nodedevschemadata"
|
||||
SCHEMA="nodedev.rng"
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
result=`xmllint --relaxng $srcdir/../docs/schemas/nodedev.rng --noout $xml 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo $result
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
check_schema "$DIRS" "$SCHEMA"
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
|
||||
function check_schema {
|
||||
|
||||
DIRS=$1
|
||||
SCHEMA="$srcdir/../docs/schemas/$2"
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
cmd="xmllint --relaxng $SCHEMA --noout $xml"
|
||||
result=`$cmd 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo -e "$cmd\n$result"
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
|
||||
}
|
|
@ -1,33 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
source ./schematestutils.sh
|
||||
|
||||
DIRS="storagepoolschemadata"
|
||||
SCHEMA="storagepool.rng"
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
result=`xmllint --relaxng $srcdir/../docs/schemas/storagepool.rng --noout $xml 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo $result
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
check_schema "$DIRS" "$SCHEMA"
|
||||
|
|
|
@ -1,33 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_srcdir" && abs_srcdir=`pwd`
|
||||
source ./schematestutils.sh
|
||||
|
||||
DIRS="storagevolschemadata"
|
||||
SCHEMA="storagevol.rng"
|
||||
|
||||
n=0
|
||||
f=0
|
||||
for dir in $DIRS
|
||||
do
|
||||
XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
|
||||
check_schema "$DIRS" "$SCHEMA"
|
||||
|
||||
for xml in $XML
|
||||
do
|
||||
n=`expr $n + 1`
|
||||
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
|
||||
result=`xmllint --relaxng $srcdir/../docs/schemas/storagevol.rng --noout $xml 2>&1`
|
||||
ret=$?
|
||||
if test $ret = 0; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAILED"
|
||||
echo $result
|
||||
f=`expr $f + 1`
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo "Validated $n files, $f failed"
|
||||
|
||||
ret=0
|
||||
test $f != 0 && ret=255
|
||||
exit $ret
|
||||
|
|
Loading…
Reference in New Issue