Debian Codegraph @

tests/probes/maskattr/test_object_entity_mask_oval_5_9.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 . $builddir/tests/test_common.sh
4
5 set -e -o pipefail
6
7 function perform_test {
8 probecheck "file" || return 255
9
10 name=$(basename $0 .sh)
11 result=$(mktemp ${name}.out.XXXXXX)
12 echo "Result file: $result"
13
14 echo "Evaluating content."
15 $OSCAP oval eval --results $result $srcdir/${name}.xml || [ $? == 2 ]
16
17 echo "Validating results."
18 $OSCAP oval validate --results $result
19
20 echo "Testing that oval_definitions are altered"
21 assert_exists 0 '/oval_results/oval_definitions/objects/unix-def:file_object/unix-def:filepath[text()="/etc/passwd"]'
22
23 echo "Testing results values."
24 [ "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/@result)')" == "true" ]
25
26 echo "Testing syschar values."
27 [ "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1"]/@flag)')" == "complete" ]
28 [ "$($XPATH $result 'count(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1"]/reference)')" == "1" ]
29
30 [ "$($XPATH $result 'boolean(/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath/@mask)')" == "1" ]
31 [ "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath)')" == "" ]
32
33 rm $result
34 }
35
36 perform_test