| 1 | #!/usr/bin/env bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | result=`mktemp` |
| 5 | |
| 6 | set -e |
| 7 | set -o pipefail |
| 8 | |
| 9 | cat > /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:text' |
| 20 | assert_exists 3 '/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"]' |
| 22 | assert_exists 1 '/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"]' |
| 24 | assert_exists 1 '/oval_results/results/system/tests' |
| 25 | assert_exists 4 '/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"]' |
| 27 | assert_exists 5 '/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"]' |
| 29 | assert_exists 5 '/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"]' |
| 31 | assert_exists 5 '/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"]' |
| 33 | assert_exists 5 '/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_item' |
| 35 | |
| 36 | rm $result |
| 37 | rm /tmp/foo.txt |