Debian Codegraph @

tests/DS/schematron/schematron.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 . $builddir/tests/test_common.sh
4 set -e -o pipefail
5
6 # both XCCDF and SDS schematrons find only warnings but not errors
7 output="$(mktempscip-shell system . . mktemp.)"
8 $OSCAP xccdf validate "$srcdir/simple_ds.xml" >"$output"
9 [scip-shell system . . `[`. $? = 0 ]
10 grepscip-shell system . . grep. -q "Schematron validation of OVAL Definition component 'test_single_rule.oval.xml': PASS" "$output"
11 grepscip-shell system . . grep. -q "Schematron validation of XCCDF Checklist component 'scap_org.open-scap_cref_test_single_rule.xccdf.xml': PASS" "$output"
12 grepscip-shell system . . grep. -q "Global schematron validation using the source data stream schematron: PASS" $output
13 grepscip-shell system . . grep. -q "Complete result of schematron validation of '$srcdir/simple_ds.xml': PASS" $output
14 rmscip-shell system . . rm. -f "$output"
15
16 # XCCDF schematron reports an error
17 output="$(mktempscip-shell system . . mktemp.)"
18 stderr="$(mktempscip-shell system . . mktemp.)"
19 $OSCAP xccdf validate "$srcdir/simple_ds_xccdf_schematron_error.xml" >"$output" 2>"$stderr" || ret=$?
20 [scip-shell system . . `[`. $ret = 2 ]
21 grepscip-shell system . . grep. -q "Error: The given @idref attribute 'xccdf_com.example.www_rule_test-pass2' must match a the @id or @cluster-id attributes of a 'Rule' or 'Group' element. See the XCCDF 1.2.1 specification, Section 6.5.3." $output
22 grepscip-shell system . . grep. -q "Schematron validation of OVAL Definition component 'test_single_rule.oval.xml': PASS" "$output"
23 grepscip-shell system . . grep. -q "Schematron validation of XCCDF Checklist component 'scap_org.open-scap_cref_test_single_rule.xccdf.xml': FAIL" "$output"
24 grepscip-shell system . . grep. -q "Global schematron validation using the source data stream schematron: PASS" $output
25 grepscip-shell system . . grep. -q "Complete result of schematron validation of '$srcdir/simple_ds_xccdf_schematron_error.xml': FAIL" $output
26 grepscip-shell system . . grep. -q "OpenSCAP Error: Invalid SCAP Source Datastream (1.3) content in $srcdir/simple_ds_xccdf_schematron_error.xml" "$stderr"
27 rmscip-shell system . . rm. -f "$output"
28 rmscip-shell system . . rm. -f "$stderr"