Debian Codegraph @

tests/API/OVAL/unittests/test_oval_empty_variable_evaluation.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 . $builddir/tests/test_common.sh
3
4 set -e -o pipefail
5
6 # This test is dependent on /etc/issue being present, so skip this test if it doesn't exist.
7 [ ! -f "/etc/issue" ] && exit 255
8
9 name=$(basename $0 .sh)
10 result=$(mktemp ${name}.out.XXXXXX)
11 echo "Result file: $result"
12
13 echo "Evaluating content."
14 $OSCAP oval eval --results $result $srcdir/${name}.xml || [ $? == 2 ]
15 echo "Validating results."
16 $OSCAP oval validate --results $result
17 echo "Testing results values."
18 [ "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/@result)')" == "false" ]
19 [ "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/@result)')" == "true" ]
20 [ "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/@result)')" == "error" ]
21 [ "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/@result)')" == "true" ]
22 echo "Testing syschar values."
23 [ "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1"]/@flag)')" == "does not exist" ]
24 [ "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:11"]/@flag)')" == "does not exist" ]
25 [ "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:2"]/@flag)')" == "complete" ]
26 [ "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:21"]/@flag)')" == "complete" ]
27
28 rm $result