Debian Codegraph @

tests/API/XCCDF/unittests/test_deriving_xccdf_result_from_oval2.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 . $builddir/tests/test_common.sh
3
4 set -e
5 set -o pipefail
6
7 touchscip-shell system . . touch. not_executable
8
9 name=$(basenamescip-shell system . . basename. $0 .sh)
10
11 result=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX)
12 stderr=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX)
13
14 $OSCAP xccdf eval --results $result $srcdir/${name}.xccdf.xml 2> $stderr
15
16 echoscip-shell system . . echo. "Stderr file = $stderr"
17 echoscip-shell system . . echo. "Result file = $result"
18 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr
19
20 $OSCAP xccdf validate --skip-schematron $result
21
22 assert_exists 2 '//rule-result'
23 assert_exists 2 '//rule-result/result'
24 assert_exists 2 '//rule-result/result[text()="pass"]'
25 assert_exists 2 '//rule-result/check'
26 assert_exists 2 '//rule-result/check[@system="http://oval.mitre.org/XMLSchema/oval-definitions-5"]'
27 assert_exists 1 '//rule-result/check[@negate="true"]'
28 assert_exists 2 '//rule-result/check/check-content-ref'
29 assert_exists 1 '//rule-result/check/check-content-ref[@href="test_deriving_xccdf_result_from_oval_fail.oval.xml"]'
30 assert_exists 1 '//rule-result/check/check-content-ref[@href="test_deriving_xccdf_result_from_oval_pass.oval.xml"]'
31 assert_exists 0 '//message'
32 assert_exists 0 '//check/@multi-check'
33 assert_exists 1 '//score'
34 assert_exists 1 '//score[text()="100.000000"]'
35
36 rmscip-shell system . . rm. $result
37
38 rmscip-shell system . . rm. not_executable