| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Test to check there are output streams separated |
| 4 | # |
| 5 | # Author: |
| 6 | # Marek Haicman <[email protected]> |
| 7 | |
| 8 | . $builddir/tests/test_common.sh |
| 9 | |
| 10 | set -e -o pipefail |
| 11 | |
| 12 | function test_sce_stdout_stderr { |
| 13 | |
| 14 | local xccdf_file=${srcdir}/$1 |
| 15 | local stderr=$(mktemp) |
| 16 | local result=$(mktemp) |
| 17 | |
| 18 | $OSCAP xccdf eval --results "$result" "$xccdf_file" 2> $stderr |
| 19 | echo "===== result =====" |
| 20 | cat $result |
| 21 | |
| 22 | grep -q '<check-import import-name="stdout">test_out' $result && \ |
| 23 | grep -q '<check-import import-name="stderr">test_err' $result |
| 24 | } |
| 25 | |
| 26 | # Testing. |
| 27 | test_init |
| 28 | |
| 29 | test_run "SCE stdout and stderr" test_sce_stdout_stderr test_sce_stdout_stderr.xccdf.xml |
| 30 | |
| 31 | test_exit |