If we expect an XML file to be invalid, we cannot check multiple files with a single xmllint command. Split out the minimum needed to check a file into a separate function. --- tests/schematestutils.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/schematestutils.sh b/tests/schematestutils.sh index 7ffc800..498b7ec 100644 --- a/tests/schematestutils.sh +++ b/tests/schematestutils.sh @@ -28,24 +28,28 @@ do for xml in `echo "$XML" | sort` do - n=`expr $n + 1` - cmd="xmllint --relaxng $SCHEMA --noout $xml" - result=`$cmd 2>&1` - ret=$? - - # Alter ret if error was expected. - case $xml:$ret in - *-invalid.xml:[34]) ret=0 ;; - *-invalid.xml:0) ret=3 ;; - esac - + check_one_file test_result $n $(basename $(dirname $xml))"/"$(basename $xml) $ret if test "$verbose" = "1" && test $ret != 0 ; then printf '%s\n' "$cmd" "$result" fi - if test "$ret" != 0 ; then - f=`expr $f + 1` - fi done done } + +check_one_file () { +n=`expr $n + 1` +cmd="xmllint --relaxng $SCHEMA --noout $xml" +result=`$cmd 2>&1` +ret=$? + +# Alter ret if error was expected. +case $xml:$ret in + *-invalid.xml:[34]) ret=0 ;; + *-invalid.xml:0) ret=3 ;; +esac + +if test "$ret" != 0 ; then + f=`expr $f + 1` +fi +} -- 2.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list