| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Test generating results and reports from SCE |
| 4 | # Uses check which produce empty output to test |
| 5 | # retreiving results from an external file. |
| 6 | # |
| 7 | # Author: |
| 8 | # Jan Černý <[email protected]> |
| 9 | |
| 10 | . $builddir/tests/test_common.sh |
| 11 | |
| 12 | set -e -o pipefail |
| 13 | |
| 14 | # Test Cases. |
| 15 | function test_check_engine_results { |
| 16 | |
| 17 | xccdf_file=${srcdir}/$1 |
| 18 | stderr=$(mktemp) |
| 19 | report=$(mktemp) |
| 20 | results="empty_stdout.sh.result.xml" |
| 21 | |
| 22 | [ -f $results ] && rm -f $results |
| 23 | |
| 24 | $OSCAP xccdf eval --check-engine-results --report $report "$xccdf_file" 2> $stderr |
| 25 | [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr |
| 26 | [ -f $results ]; [ -s $results ]; rm $results |
| 27 | [ -f $report ]; [ -s $report ]; rm $report |
| 28 | } |
| 29 | |
| 30 | # Testing. |
| 31 | test_init |
| 32 | |
| 33 | test_run "check_engine_results" test_check_engine_results test_check_engine_results.xccdf.xml |
| 34 | |
| 35 | test_exit |
| 36 |