Debian Codegraph @

tests/API/XCCDF/applicability/test_platform_inheritance.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 . $builddir/tests/test_common.sh
3
4 set -e
5 set -o pipefail
6
7 name=$(basename $0 .sh)
8 stderr=$(make_temp_file /tmp ${name}.out)
9 tmpdir=$(make_temp_dir /tmp ${name}.out)
10 result=$(make_temp_file ${tmpdir} ${name}.out)
11
12 cpe=$srcdir/${name}.cpe.xml
13
14 echo "Stderr file = $stderr"
15 echo "Result file = $result"
16
17 $OSCAP xccdf eval --cpe $cpe --results $result $srcdir/${name}.xccdf.xml 2> $stderr
18 [ "$?" == "0" ]
19 [ -f $stderr ]; [ ! -s $stderr ]; :> $stderr
20 assert_exists 1 '//TestResult'
21 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rtrue"]/result[text()="pass"]'
22 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rfalse"]/result[text()="notapplicable"]'
23 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rnone"]/result[text()="pass"]'
24
25 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rtrue"]/result[text()="notapplicable"]'
26 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rfalse"]/result[text()="notapplicable"]'
27 assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rnone"]/result[text()="notapplicable"]'
28
29 rm $result