| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Author: |
| 4 | # Michal Srubar <[email protected]> |
| 5 | |
| 6 | # Test whether the value of set with <refine-value> or <set-value> is passed to |
| 7 | # the SCE script correctly or not. |
| 8 | |
| 9 | set -e -o pipefail |
| 10 | |
| 11 | . $builddir/tests/test_common.sh |
| 12 | |
| 13 | # Test Cases. |
| 14 | function test_passing_values { |
| 15 | |
| 16 | local DEFFILE=${srcdir}/$1 |
| 17 | local RESFILE=$1.results |
| 18 | |
| 19 | [ -f $RESFILE ] && rm -f $RESFILE |
| 20 | |
| 21 | $OSCAP xccdf eval --results "$RESFILE" --profile "default" "$DEFFILE" |
| 22 | |
| 23 | # ensure that value set with <refine-value> was passed correctly |
| 24 | grep "VALUE_1=fail" "$RESFILE" |
| 25 | # ensure that value set with <set-value> was passed correctly |
| 26 | grep "VALUE_2=my_pass_val" "$RESFILE" |
| 27 | rm $RESFILE |
| 28 | } |
| 29 | |
| 30 | # Testing. |
| 31 | test_init |
| 32 | |
| 33 | test_run "sce" test_passing_values test_passing_vars_xccdf.xml |
| 34 | |
| 35 | test_exit |
| 36 |