Debian Codegraph @

tests/API/OVAL/unittests/test_state_check_existence.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 . $builddir/tests/test_common.sh
3
4 result=`mktempscip-shell system . . mktemp.`
5
6 set -e
7 set -o pipefail
8
9 catscip-shell system . . cat. > /tmp/foo.txtscip-shell filesystem . . `/tmp/foo.txt`. <<EOF
10 Hello
11 Hello
12 Hello
13 Hello
14 Hello
15 EOF
16
17 $OSCAP oval eval --results $result $srcdir/state_check_existence.xml
18
19 assert_exists 4 '/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:textscip-shell filesystem . . `/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text`.'
20 assert_exists 3 '/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence]scip-shell filesystem . . `/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence]`.'
21 assert_exists 1 '/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence="all_exist"]scip-shell filesystem . . `/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence="all_exist"]`.'
22 assert_exists 1 '/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence="none_exist"]scip-shell filesystem . . `/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence="none_exist"]`.'
23 assert_exists 1 '/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence="only_one_exists"]scip-shell filesystem . . `/oval_results/oval_definitions/states/ind-def:textfilecontent54_state/ind-def:text[@check_existence="only_one_exists"]`.'
24 assert_exists 1 '/oval_results/results/system/testsscip-shell filesystem . . `/oval_results/results/system/tests`.'
25 assert_exists 4 '/oval_results/results/system/tests/testscip-shell filesystem . . `/oval_results/results/system/tests/test`.'
26 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:1" and @result="true"]`.'
27 assert_exists 5 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item[@result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item[@result="true"]`.'
28 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2" and @result="false"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:2" and @result="false"]`.'
29 assert_exists 5 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item[@result="false"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item[@result="false"]`.'
30 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3" and @result="false"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:3" and @result="false"]`.'
31 assert_exists 5 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_item[@result="false"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_item[@result="false"]`.'
32 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:4" and @result="true"]`.'
33 assert_exists 5 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_item[@result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_item[@result="true"]`.'
34 assert_exists 5 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_itemscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item`.'
35
36 rmscip-shell system . . rm. $result
37 rmscip-shell system . . rm. /tmp/foo.txtscip-shell filesystem . . `/tmp/foo.txt`.