/
runchecks
executable file
·73 lines (64 loc) · 1.96 KB
/
runchecks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
XSD_RNG=${1:-xsd10.rng}
fail () {
echo "${@}" 1>&2
exit 1
}
case "${XSD_RNG}" in
*xsd10.rng)
PASS_GLOB="test1x/t*.xsd test10/t*.xsd test11/f*.xsd"
FAIL_GLOB="test1x/f*.xsd test10/f*.xsd test11/t*.xsd"
;;
*xsd11.rng)
PASS_GLOB="test1x/t*.xsd test11/t*.xsd test10/f*.xsd"
FAIL_GLOB="test1x/f*.xsd test11/f*.xsd test10/t*.xsd"
;;
esac
genpyxb () {
# Exclude files that load local DTDs or have DTD syntax errors
find /opt/pyxb/pyxb/bundles -name '*.xsd' \
| sed \
-e '\!wssplat/schemas/policy.xsd!d' \
-e '\!common/schemas/xhtml.xsd!d' \
-e '\!common/schemas/XMLSchema!d' \
-e '\!common/schemas/xsd_hfp.xsd!d' \
-e '\!common/schemas/datatypes.xsd!d'
}
genpass () {
ls ${PASS_GLOB} 2>/dev/null | sed -e '/\*/d'
}
genfail () {
ls ${FAIL_GLOB} 2>/dev/null | sed -e '/\*/d'
}
echo "Running ${XSD_RNG} pass tests with xmllint..."
( ( genpass \
| xargs xmllint --noout --relaxng ${XSD_RNG} \
) > xmlpass.log 2>&1 \
) || (cat xmlpass.log ; fail xmllint valid tests failed )
echo "Running ${XSD_RNG} fail tests with xmllint..."
for f in $(genfail) ; do
( xmllint --noout --relaxng xsd10.rng ${f} > xmlfail.log 2>&1 ) \
&& ( cat xmlfail.log ; fail "incorrect validation of ${f}" )
done
if [ -f jing.jar ] ; then
echo "Running ${XSD_RNG} pass tests with (modified) jing"
( genpass \
| xargs java -jar jing.jar ${XSD_RNG} ) \
|| fail "jing valid tests failed"
echo "Running ${XSD_RNG} fail tests with (modified) jing"
for f in $(genfail) ; do
( java -jar jing.jar ${XSD_RNG} ${f} > jing.log 2>&1 ) \
&& ( cat jing.log ; fail "incorrect validation of ${f}" )
done
fi
if [ -d /opt/pyxb ] ; then
echo "Running ${XSD_RNG} xmllint on PyXB source schemas..."
genpyxb \
| xargs xmllint --noout --relaxng ${XSD_RNG} \
2>&1 | grep validity
if [ -f jing.jar ] ; then
echo "Running ${XSD_RNG} jing on PyXB source schemas..."
genpyxb \
| xargs java -jar jing.jar ${XSD_RNG}
fi
fi