Debian Codegraph @

tests/API/XCCDF/unittests/test_xccdf_selectors_cluster3.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 . $builddir/tests/test_common.sh
3
4 touch not_executable
5 set -e
6 set -o pipefail
7
8 name=$(basename $0 .sh)
9
10 result=$(mktemp -t ${name}.out.XXXXXX)
11 stderr=$(mktemp -t ${name}.err.XXXXXX)
12
13 $OSCAP xccdf eval --profile xccdf_moc.elpmaxe.www_profile_3 --results $result $srcdir/${name}.xccdf.xml 2> $stderr
14
15 echo "Stderr file = $stderr"
16 echo "Result file = $result"
17 [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr
18
19 $OSCAP xccdf validate --skip-schematron $result
20
21 assert_exists 1 '//Benchmark'
22 assert_exists 1 '//Benchmark[@resolved="1"]'
23 assert_exists 3 '//Profile'
24 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_1"]'
25 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_1"]/select'
26 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_1"]/select[@idref="my-enabled-cluster" and @selected="false"]'
27 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]'
28 assert_exists 3 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select'
29 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select[1][@idref="my-enabled-cluster" and @selected="false"]'
30 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select[2][@idref="my-disabled-cluster" and @selected="false"]'
31 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select[3][@idref="xccdf_moc.elpmaxe.www_rule_3" and @selected="false"]'
32 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]'
33 assert_exists 3 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select'
34 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select[1][@idref="my-disabled-cluster" and @selected="false"]'
35 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select[2][@idref="xccdf_moc.elpmaxe.www_rule_3" and @selected="false"]'
36 assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select[3][@idref="my-enabled-cluster" and @selected="true"]'
37 assert_exists 3 '//rule-result'
38 assert_exists 3 '//rule-result/result'
39 assert_exists 1 '//rule-result/result[text()="pass"]'
40 assert_exists 2 '//rule-result/result[text()="notselected"]'
41 assert_exists 1 '//score'
42 assert_exists 1 '//score[text()="100.000000"]'
43 rm $result
44
45 rm not_executable