| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | . $builddir/tests/test_common.sh |
| 4 | |
| 5 | set -e -o pipefail |
| 6 | |
| 7 | result=$(mktempscip-shell system . . mktemp.) |
| 8 | |
| 9 | guest="/tmp/guestscip-shell filesystem . . `/tmp/guest`." |
| 10 | mkdirscip-shell system . . mkdir. -p "$guest" |
| 11 | test_data_dir="/tmp/oscap_test_skip_pathsscip-shell filesystem . . `/tmp/oscap_test_skip_paths`." |
| 12 | mkdirscip-shell system . . mkdir. -p "$guest/$test_data_dir/a" |
| 13 | touchscip-shell system . . touch. "$guest/$test_data_dir/a/x" |
| 14 | cpscip-shell system . . cp. "$srcdir/test.xml" "$guest/$test_data_dir/a/" |
| 15 | mkdirscip-shell system . . mkdir. -p "$guest/$test_data_dir/b" |
| 16 | touchscip-shell system . . touch. "$guest/$test_data_dir/b/y" |
| 17 | cpscip-shell system . . cp. "$srcdir/test.xml" "$guest/$test_data_dir/b/" |
| 18 | mkdirscip-shell system . . mkdir. -p "$guest/$test_data_dir/c" |
| 19 | touchscip-shell system . . touch. "$guest/$test_data_dir/c/z" |
| 20 | cpscip-shell system . . cp. "$srcdir/test.xml" "$guest/$test_data_dir/c/" |
| 21 | # oscap probes will skip directories "b" and "c" |
| 22 | export OSCAP_PROBE_IGNORE_PATHS="$test_data_dir/b:$test_data_dir/c" |
| 23 | set_chroot_offline_test_mode "$guest" |
| 24 | $OSCAP oval eval --results $result "$srcdir/test_skip_paths.xml" |
| 25 | unset_chroot_offline_test_mode |
| 26 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1" and @result="true"]`.' |
| 27 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1" and @flag="complete"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1" and @flag="complete"]`.' |
| 28 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_itemscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item`.' |
| 29 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/x"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/x"]`.' |
| 30 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2" and @result="true"]`.' |
| 31 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:2" and @flag="does not exist"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:2" and @flag="does not exist"]`.' |
| 32 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]`.' |
| 33 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:file_item/unix-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]`.' |
| 34 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:3" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:3" and @result="true"]`.' |
| 35 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:3" and @flag="complete"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:3" and @flag="complete"]`.' |
| 36 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/x"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/x"]`.' |
| 37 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:4" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:4" and @result="true"]`.' |
| 38 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:4" and @flag="does not exist"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:4" and @flag="does not exist"]`.' |
| 39 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]`.' |
| 40 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]`.' |
| 41 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5" and @result="true"]`.' |
| 42 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:5" and @flag="complete"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:5" and @flag="complete"]`.' |
| 43 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/x"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/x"]`.' |
| 44 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6" and @result="true"]`.' |
| 45 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:6" and @flag="does not exist"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:6" and @flag="does not exist"]`.' |
| 46 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]`.' |
| 47 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]`.' |
| 48 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:7" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:7" and @result="true"]`.' |
| 49 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:7" and @flag="complete"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:7" and @flag="complete"]`.' |
| 50 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/test.xml"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/test.xml"]`.' |
| 51 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:8" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:8" and @result="true"]`.' |
| 52 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:8" and @flag="does not exist"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:8" and @flag="does not exist"]`.' |
| 53 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/test.xml"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/test.xml"]`.' |
| 54 | assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/test.xml"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/test.xml"]`.' |
| 55 | rmscip-shell system . . rm. -f $result |
| 56 | rmscip-shell system . . rm. -rf "$guest" |