Debian Codegraph @

tests/API/XCCDF/unittests/test_default_selector.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 name=$(basenamescip-shell system . . basename. $0 .sh)
8
9 result=$name.oval.xml-0.variables-0.xml
10 stderr=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX)
11
12 $OSCAP xccdf eval --export-variable $srcdir/${name}.xccdf.xml 2> $stderr
13
14 echoscip-shell system . . echo. "Stderr file = $stderr"
15 echoscip-shell system . . echo. "Result file = $result"
16 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
17
18 test_variablescip-shell shell shell-project 0.0.0 test_variable().() {
19 assert_exists 3 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
20 assert_exists 3 '//variable'
21 assert_exists 3 '//variable/*'
22 assert_exists 3 '//variable/value'
23 assert_exists 0 '//variable/value/@*'
24 assert_exists 1 '//variable[@id="oval:ssg:var:1"]/value'
25 assert_exists 1 '//variable[@id="oval:ssg:var:2"]/value'
26 assert_exists 1 '//variable[@id="oval:ssg:var:3"]/value'
27 assert_exists 3 '//variable/value[text()="100"]'
28 }
29
30 test_variablescip-shell shell shell-project 0.0.0 test_variable().
31 rmscip-shell system . . rm. $result
32
33 # Ensure that it works even for export-oval-variables (trac#267)
34 $OSCAP xccdf export-oval-variables $srcdir/${name}.xccdf.xml 2>&1 > $stderr
35 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr
36 test_variablescip-shell shell shell-project 0.0.0 test_variable().
37 rmscip-shell system . . rm. $result
38