Debian Codegraph @

tests/API/XCCDF/unittests/test_xccdf_overrides.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 . $builddir/tests/test_common.sh
4
5 set -e
6 set -o pipefail
7
8 name=$(basename $0 .sh)
9
10 ./${name} ${srcdir}/${name}.arf.xml
11
12 result="${name}.xml.out"
13 echo "Result file = $result"
14 [ -f "$result" ]
15 stderr=$(mktemp -t ${name}.out.XXXXXX)
16 echo "Stderr file = $stderr"
17
18 $OSCAP info $result 2> $stderr
19 [ ! -s $stderr ]
20
21 $OSCAP ds rds-validate $result 2> $stderr
22 [ ! -s $stderr ]; rm $stderr
23
24 assert_exists 1 '//TestResult'
25 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]'
26 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/result'
27 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/result[text()="pass"]'
28 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override'
29 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override[@date]'
30 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override[@authority]'
31 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override/old-result'
32 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override/old-result[text()="fail"]'
33 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override/new-result'
34 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override/new-result[text()="pass"]'
35 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override/remark'
36 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_org.ssgproject.content_rule_disable_prelink"]/override/remark[text()="I believe this should have passed"]'
37
38 rm $result