Debian Codegraph @

tests/probes/partition/test_probes_partition_offline_mode.sh

raw symbols SCIP
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 local VALID=$1
9
10 probecheck "partition" || return 255
11
12 local ret_val=0;
13 local DF="${srcdir}/test_probes_partition.xml"
14 local RF="test_probes_partition_offline_mode.results.xml"
15 echoscip-shell system . . echo. "result file: $RF"
16 local stderr=$(mktempscip-shell system . . mktemp. $1.err.XXXXXX)
17 echoscip-shell system . . echo. "stderr file: $stderr"
18
19 [scip-shell system . . `[`. -f $RF ] && rmscip-shell system . . rm. -f $RF
20
21 tmpdir=$(mktempscip-shell system . . mktemp. -t -d "test_offline_mode_partition.XXXXXX")
22
23 if [[ "${VALID}" == "true" ]]; then
24 lnscip-shell system . . ln. -s /procscip-shell filesystem . . `/proc`. $tmpdir
25 fi
26
27 set_chroot_offline_test_mode "$tmpdir"
28
29 $OSCAP oval eval --results $RF $DF 2>$stderr
30
31 unset_chroot_offline_test_mode
32
33 [scip-shell system . . `[`. -f $RF ]
34
35 result="$RF"
36
37 if [[ "${VALID}" == "true" ]]; then
38 assert_exists 1 '/oval_results/results/system/tests/test[@result="true"][@test_id="oval:1:tst:1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@result="true"][@test_id="oval:1:tst:1"]`.'
39 verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF 1
40 else
41 assert_exists 1 '/oval_results/results/system/tests/test[@result="false"][@test_id="oval:1:tst:1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@result="false"][@test_id="oval:1:tst:1"]`.'
42 fi
43
44 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!"
45 rmscip-shell system . . rm. $stderr
46
47 rmscip-shell system . . rm. -rf ${tmpdir}
48
49 return $ret_val
50 }
51
52 test_run "Probe partition simple offline test (/proc mount point)" test_probes_partition "true"
53 test_run "Probe partition simple offline test (/proc mount point) (invalid prefix)" test_probes_partition "false"