| 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 | function test_probes_partitionscip-shell shell shell-project 0.0.0 test_probes_partition(). { |
| 8 | probecheck "partition" || return 255 |
| 9 | require_non_chroot || return 255 |
| 10 | |
| 11 | local ret_val=0; |
| 12 | local DF="${srcdir}/test_probes_partition.xml" |
| 13 | local result="test_probes_partition.results.xml" |
| 14 | echoscip-shell system . . echo. "result file: $result" |
| 15 | local stderr=$(mktempscip-shell system . . mktemp. $1.err.XXXXXX) |
| 16 | echoscip-shell system . . echo. "stderr file: $stderr" |
| 17 | |
| 18 | [scip-shell system . . `[`. -f $result ] && rmscip-shell system . . rm. -f $result |
| 19 | |
| 20 | $OSCAP oval eval --results $result $DF 2>$stderr |
| 21 | |
| 22 | if [scip-shell system . . `[`. -f $result ]; then |
| 23 | verify_results "def" $DF $result 3 && verify_results "tst" $DF $result 3 |
| 24 | ret_val=$? |
| 25 | else |
| 26 | ret_val=1 |
| 27 | fi |
| 28 | |
| 29 | CO='/oval_results/results/system/oval_system_characteristics/collected_objectsscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects`.' |
| 30 | assert_exists 1 $CO'/object[@id="oval:1:obj:1" and @flag="complete"]' |
| 31 | assert_exists 1 $CO'/object[@id="oval:1:obj:2" and @flag="complete"]' |
| 32 | assert_exists 1 $CO'/object[@id="oval:1:obj:3" and @flag="does not exist"]' |
| 33 | SD='/oval_results/results/system/oval_system_characteristics/system_datascip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data`.' |
| 34 | assert_exists 1 $SD'/lin-sys:partition_item' |
| 35 | assert_exists 1 $SD'/lin-sys:partition_item/lin-sys:mount_point[text()="/proc"]' |
| 36 | |
| 37 | grepscip-shell system . . grep. -Ei "(W: |E: )" $stderr && ret_val=1 && echoscip-shell system . . echo. "There is an error and/or a warning in the output!" |
| 38 | rmscip-shell system . . rm. $stderr |
| 39 | |
| 40 | return $ret_val |
| 41 | } |
| 42 | |
| 43 | test_run "Probe partition simple test (/proc mount point)" test_probes_partition |