| 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_environmentvariable58_offline_modescip-shell shell shell-project 0.0.0 test_probes_environmentvariable58_offline_mode(). { |
| 8 |
probecheck "environmentvariable58" || return 255 |
| 9 |
|
| 10 |
local ret_val=0; |
| 11 |
local DF="${srcdir}/test_probes_environmentvariable58_offline_mode.sh.xml" |
| 12 |
local RF="test_probes_environmentvariable58_offline_mode.sh.results.xml" |
| 13 |
echoscip-shell system . . echo. "result file: $RF" |
| 14 |
local stderr=$(mktempscip-shell system . . mktemp. $1.err.XXXXXX) |
| 15 |
echoscip-shell system . . echo. "stderr file: $stderr" |
| 16 |
|
| 17 |
[scip-shell system . . `[`. -f $RF ] && rmscip-shell system . . rm. -f $RF |
| 18 |
|
| 19 |
tmpdir=$(mktempscip-shell system . . mktemp. -t -d "test_offline_mode_environmentvariable58.XXXXXX") |
| 20 |
mkdirscip-shell system . . mkdir. -p "$tmpdir/proc/1" |
| 21 |
|
| 22 |
set_chroot_offline_test_mode "$tmpdir" |
| 23 |
|
| 24 |
OSCAP_CONTAINER_VARS=$'CONTAINER_VARIABLE=/some/value/for/container\nOTHER_CONTAINER_VAR=other' $OSCAP oval eval --results $RF $DF 2> $stderr |
| 25 |
|
| 26 |
unset_chroot_offline_test_mode |
| 27 |
|
| 28 |
if [scip-shell system . . `[`. -f $RF ]; then |
| 29 |
verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF 1 |
| 30 |
ret_val=$? |
| 31 |
else |
| 32 |
ret_val=1 |
| 33 |
fi |
| 34 |
|
| 35 |
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!" |
| 36 |
|
| 37 |
rmscip-shell system . . rm. $stderr |
| 38 |
|
| 39 |
rmscip-shell system . . rm. -rf ${tmpdir} |
| 40 |
|
| 41 |
return $ret_val |
| 42 |
} |
| 43 |
|
| 44 |
test_run "test_probes_environmentvariable58_offline_mode" test_probes_environmentvariable58_offline_mode |