| 1 | #!/usr/bin/env bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | set -e -o pipefail |
| 5 | |
| 6 | name=$(basename $0 .sh) |
| 7 | result=$(mktemp -t ${name}.out.XXXXXX) |
| 8 | report=$(mktemp -t ${name}.out.XXXXXX) |
| 9 | stderr=$(mktemp -t ${name}.out.XXXXXX) |
| 10 | |
| 11 | $OSCAP xccdf eval --results $result --report $report $srcdir/${name}.xccdf.xml 2> $stderr |
| 12 | |
| 13 | echo "Stderr file = $stderr" |
| 14 | echo "Result file = $result" |
| 15 | echo "Report file = $report" |
| 16 | [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr |
| 17 | [ -f $report ]; [ -s $report ]; rm $report |
| 18 | |
| 19 | $OSCAP xccdf validate --skip-schematron $result |
| 20 | |
| 21 | assert_exists 1 '//rule-result' |
| 22 | assert_exists 1 '//rule-result/result' |
| 23 | assert_exists 1 '//rule-result/result[text()="informational"]' |
| 24 | assert_exists 1 '//rule-result/check' |
| 25 | assert_exists 1 '//rule-result/check/check-content-ref' |
| 26 | assert_exists 1 '//score[@system="urn:xccdf:scoring:default" and text()="0.000000"]' |
| 27 | assert_exists 1 '//score[@system="urn:xccdf:scoring:flat" and text()="0.000000"]' |
| 28 | assert_exists 1 '//score[@system="urn:xccdf:scoring:flat-unweighted" and text()="0.000000"]' |
| 29 | assert_exists 1 '//score[@system="urn:xccdf:scoring:absolute" and text()="1.000000"]' |
| 30 | |
| 31 | rm $result |