Debian Codegraph @

tests/probes/partition/test_probes_partition.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 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 echo "result file: $result"
15 local stderr=$(mktemp $1.err.XXXXXX)
16 echo "stderr file: $stderr"
17
18 [ -f $result ] && rm -f $result
19
20 $OSCAP oval eval --results $result $DF 2>$stderr
21
22 if [ -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_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_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 grep -Ei "(W: |E: )" $stderr && ret_val=1 && echo "There is an error and/or a warning in the output!"
38 rm $stderr
39
40 return $ret_val
41 }
42
43 test_run "Probe partition simple test (/proc mount point)" test_probes_partition