test_probes_environmentvariable.sh | test_probes_environmentvariable.sh | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
# Peter Vrabec, <pvrabec@redhat.com> | # Peter Vrabec, <pvrabec@redhat.com> | |||
# David Niemoller | # David Niemoller | |||
# Ondrej Moris, <omoris@redhat.com> | # Ondrej Moris, <omoris@redhat.com> | |||
. ${srcdir}/../../test_common.sh | . ${srcdir}/../../test_common.sh | |||
# Test Cases. | # Test Cases. | |||
function test_probes_environmentvariable { | function test_probes_environmentvariable { | |||
probecheck "environmentvariable" || return 255 | ||||
local ret_val=0; | local ret_val=0; | |||
local DEFFILE="$1.xml" | local DF="$1.xml" | |||
local RESFILE="$1.results.xml" | local RF="$1.results.xml" | |||
[ -f $RESFILE ] && rm -f $RESFILE | [ -f $RF ] && rm -f $RF | |||
bash ${srcdir}/$1.xml.sh > $DEFFILE | bash ${srcdir}/$1.xml.sh > $DF | |||
LINES=$? | LINES=$? | |||
../../../utils/.libs/oscap oval eval --results $RESFILE $DEFFILE | ../../../utils/.libs/oscap oval eval --results $RF $DF | |||
if [ -f $RESFILE ]; then | ||||
DEF_DEF=`cat "$DEFFILE" | grep "id=\"oval:1:def:1\""` | ||||
DEF_RES=`cat "$RESFILE" | grep "definition_id=\"oval:1:def:1\""` | ||||
if (echo $DEF_RES | grep -q "result=\"true\""); then | ||||
RES="TRUE" | ||||
elif (echo $DEF_RES | grep -q "result=\"false\""); then | ||||
RES="FALSE" | ||||
else | ||||
RES="ERROR" | ||||
fi | ||||
if (echo $DEF_DEF | grep -q "comment=\"true\""); then | ||||
CMT="TRUE" | ||||
elif (echo $DEF_DEF | grep -q "comment=\"false\""); then | ||||
CMT="FALSE" | ||||
else | ||||
CMT="ERROR" | ||||
fi | ||||
if [ ! $RES = $CMT ]; then | ||||
echo "Result of oval:1:def:1 should be ${CMT}!" | ||||
ret_val=$[$ret_val + 1] | ||||
fi | ||||
COUNT=$LINES; ID=1 | ||||
while [ $ID -le $COUNT ]; do | ||||
TEST_DEF=`cat "$DEFFILE" | grep "id=\"oval:1:tst:${ID}\""` | ||||
TEST_RES=`cat "$RESFILE" | grep "test_id=\"oval:1:tst:${ID}\""` | ||||
if (echo $TEST_RES | grep -q "result=\"true\""); then | ||||
RES="TRUE" | ||||
elif (echo $TEST_RES | grep -q "result=\"false\""); then | ||||
RES="FALSE" | ||||
else | ||||
RES="ERROR" | ||||
fi | ||||
if (echo $TEST_DEF | grep -q "comment=\"true\""); then | ||||
CMT="TRUE" | ||||
elif (echo $TEST_DEF | grep -q "comment=\"false\""); then | ||||
CMT="FALSE" | ||||
else | ||||
CMT="ERROR" | ||||
fi | ||||
if [ ! $RES = $CMT ]; then | ||||
echo "Result of oval:1:tst:${ID} should be ${CMT}!" | ||||
ret_val=$[$ret_val + 1] | ||||
fi | ||||
ID=$[$ID+1] | if [ -f $RF ]; then | |||
done | verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF $LINE | |||
S | ||||
ret_val=$? | ||||
else | else | |||
ret_val=1 | ret_val=1 | |||
fi | fi | |||
return $ret_val | return $ret_val | |||
} | } | |||
# Testing. | # Testing. | |||
test_init "test_probes_environmentvariable.log" | test_init "test_probes_environmentvariable.log" | |||
test_run "test_probes_environmentvariable" test_probes_environmentvariable | test_run "test_probes_environmentvariable" test_probes_environmentvariable | |||
test_probes_environmentvariable | \ | |||
test_run "test_probes_environmentvariable" test_probes_environmentvariable | test_probes_environmentvariable | |||
test_probes_environmentvariable-fail | test_run "test_probes_environmentvariable-fail" test_probes_environmentvari | |||
able \ | ||||
test_probes_environmentvariable-fail | ||||
test_exit | test_exit | |||
End of changes. 7 change blocks. | ||||
64 lines changed or deleted | 17 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |