| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Author: |
| 4 | # Martin Preisler <[email protected]> |
| 5 | |
| 6 | . $builddir/tests/test_common.sh |
| 7 | |
| 8 | set -e -o pipefail |
| 9 | |
| 10 | function test_sce { |
| 11 | require "python3" || return 255 |
| 12 | require "lua" || return 255 |
| 13 | |
| 14 | local ret_val=0; |
| 15 | local DEFFILE=${srcdir}/$1 |
| 16 | local RESFILE=$1.results |
| 17 | |
| 18 | [ -f $RESFILE ] && rm $RESFILE |
| 19 | |
| 20 | $OSCAP xccdf eval --results "$RESFILE" --profile "default" "$DEFFILE" |
| 21 | |
| 22 | LINES=`grep \<result\> "$RESFILE"` |
| 23 | |
| 24 | # calculate return code |
| 25 | echo "$LINES" | grep -q -v "pass" || ret_val=$? |
| 26 | [ $ret_val -eq 1 ] |
| 27 | } |
| 28 | |
| 29 | test_init |
| 30 | test_run "sce" test_sce sce_xccdf.xml |
| 31 | test_exit |