| 1 | #!/usr/bin/envscip-shell filesystem . . `/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_resultsscip-shell shell shell-project 0.0.0 test_check_engine_results(). { |
| 16 | |
| 17 | xccdf_file=${srcdir}/$1 |
| 18 | stderr=$(mktempscip-shell system . . mktemp.) |
| 19 | report=$(mktempscip-shell system . . mktemp.) |
| 20 | results="empty_stdout.sh.result.xml" |
| 21 | |
| 22 | [scip-shell system . . `[`. -f $results ] && rmscip-shell system . . rm. -f $results |
| 23 | |
| 24 | $OSCAP xccdf eval --check-engine-results --report $report "$xccdf_file" 2> $stderr |
| 25 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr |
| 26 | [scip-shell system . . `[`. -f $results ]; [scip-shell system . . `[`. -s $results ]; rmscip-shell system . . rm. $results |
| 27 | [scip-shell system . . `[`. -f $report ]; [scip-shell system . . `[`. -s $report ]; rmscip-shell system . . 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 |