| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Copyright 2014 Red Hat Inc., Durham, North Carolina. |
| 4 | # All Rights Reserved. |
| 5 | |
| 6 | set -e -o pipefail |
| 7 | |
| 8 | . $builddir/tests/test_common.sh |
| 9 | |
| 10 | function test_api_xccdf_result_files_cpe_conflict { |
| 11 | local ABS_SRC_DIR=`cd $srcdir; pwd` |
| 12 | |
| 13 | local INPUT=$1 |
| 14 | local CPE=$2 |
| 15 | local OVAL=$3 |
| 16 | |
| 17 | local FIRST_OVAL_RESULT=$4 |
| 18 | local SECOND_OVAL_RESULT=$5 |
| 19 | |
| 20 | local TMP_RESULT_DIR=`mktemp -d` |
| 21 | cd $TMP_RESULT_DIR |
| 22 | |
| 23 | cp $ABS_SRC_DIR/$INPUT . |
| 24 | cp $ABS_SRC_DIR/$CPE . |
| 25 | cp $ABS_SRC_DIR/$OVAL . |
| 26 | |
| 27 | $OSCAP xccdf eval --cpe $CPE --oval-results $INPUT |
| 28 | |
| 29 | echo "First OVAL result:" |
| 30 | cat $FIRST_OVAL_RESULT |
| 31 | echo "Second OVAL result:" |
| 32 | cat $SECOND_OVAL_RESULT |
| 33 | |
| 34 | rm -rf "$TMP_RESULT_DIR" |
| 35 | |
| 36 | return 0 |
| 37 | } |
| 38 | |
| 39 | # Testing. |
| 40 | |
| 41 | test_init "test_api_xccdf_result_files.log" |
| 42 | |
| 43 | test_run "test_api_xccdf_result_files_cpe_conflict" test_api_xccdf_result_files_cpe_conflict simple-xccdf.xml cpe-dict.xml cpe-oval.xml cpe-oval.xml.result.xml cpe-oval.xml.result2.xml |
| 44 | |
| 45 | test_exit |