File: test_platform_inheritance.sh

package info (click to toggle)
openscap 1.4.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 125,040 kB
  • sloc: xml: 527,109; ansic: 91,390; sh: 19,789; python: 2,515; perl: 444; makefile: 49
file content (29 lines) | stat: -rwxr-xr-x 1,235 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
. $builddir/tests/test_common.sh

set -e
set -o pipefail

name=$(basename $0 .sh)
stderr=$(make_temp_file /tmp ${name}.out)
tmpdir=$(make_temp_dir /tmp ${name}.out)
result=$(make_temp_file ${tmpdir} ${name}.out)

cpe=$srcdir/${name}.cpe.xml

echo "Stderr file = $stderr"
echo "Result file = $result"

$OSCAP xccdf eval --cpe $cpe --results $result $srcdir/${name}.xccdf.xml 2> $stderr
[ "$?" == "0" ]
[ -f $stderr ]; [ ! -s $stderr ]; :> $stderr
assert_exists 1 '//TestResult'
assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rtrue"]/result[text()="pass"]'
assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rfalse"]/result[text()="notapplicable"]'
assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rnone"]/result[text()="pass"]'

assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rtrue"]/result[text()="notapplicable"]'
assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rfalse"]/result[text()="notapplicable"]'
assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rnone"]/result[text()="notapplicable"]'

rm $result