| 1 | #!/usr/bin/env bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | LST_VALID=" |
| 5 | tfc54-def-5.4-valid.xml |
| 6 | tfc54-def-5.5-valid.xml |
| 7 | tfc54-def-5.6-valid.xml |
| 8 | tfc54-def-5.7-valid.xml |
| 9 | tfc54-def-5.8-valid.xml |
| 10 | tfc54-def-5.9-valid.xml |
| 11 | tfc54-def-5.10-valid.xml |
| 12 | tfc54-def-5.10.1-valid.xml |
| 13 | " |
| 14 | LST_INVALID=" |
| 15 | tfc54-def-5.4-invalid.xml |
| 16 | " |
| 17 | |
| 18 | function tfc54_validation { |
| 19 | local ret=0 |
| 20 | |
| 21 | echo "*** Validating and evaluating correct OVAL content:" |
| 22 | for i in $LST_VALID; do |
| 23 | i="${srcdir}/$i" |
| 24 | echo "Validating definitions '$i'." |
| 25 | $OSCAP oval validate "$i" \ |
| 26 | || { echo "Validation failed."; ret=1; continue; } |
| 27 | echo "Evaluating definitions '$i'." |
| 28 | r="$(basename $i .xml)-results.xml" |
| 29 | $OSCAP oval eval --results "$r" "$i" \ |
| 30 | || { echo "Evaluation failed."; ret=1; continue; } |
| 31 | echo "Validating results '$r'." |
| 32 | $OSCAP oval validate --results "$r" \ |
| 33 | || { echo "Validation failed."; ret=1; } |
| 34 | done |
| 35 | |
| 36 | echo "*** Validating incorrect OVAL content:" |
| 37 | for i in $LST_INVALID; do |
| 38 | echo "Validating content '$i'." |
| 39 | $OSCAP oval validate "$i" \ |
| 40 | && { echo "Validation incorrectly succeeded."; ret=1; } |
| 41 | done |
| 42 | |
| 43 | return $ret |
| 44 | } |
| 45 | |
| 46 | export OSCAP_FULL_VALIDATION=1 |
| 47 | tfc54_validation |