| 1 | #!/usr/bin/env bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | ######################################################################## |
| 5 | ### Test "oscap xccdf resolve" command on a Profile with platform |
| 6 | ######################################################################## |
| 7 | |
| 8 | set -e |
| 9 | set -o pipefail |
| 10 | |
| 11 | name=$(basename $0 .sh) |
| 12 | |
| 13 | result=$(mktemp -t ${name}.res.XXXXXX) |
| 14 | stderr=$(mktemp -t ${name}.out.XXXXXX) |
| 15 | stdout=$(mktemp -t ${name}.out.XXXXXX) |
| 16 | |
| 17 | |
| 18 | echo "Stderr file = $stderr" |
| 19 | echo "Result file = $result" |
| 20 | |
| 21 | $OSCAP xccdf resolve --output $result $srcdir/${name}.xccdf.xml > $stdout |
| 22 | $OSCAP xccdf validate --skip-schematron $result >> $stdout |
| 23 | |
| 24 | assert_exists 1 '//Benchmark[@resolved="1"]' |
| 25 | |
| 26 | # Resolve Profile Platform |
| 27 | assert_exists 2 '//Profile[@id="xccdf_resolve_profile_platform"]/select' |
| 28 | assert_exists 1 '//Profile[@id="xccdf_resolve_profile_platform"]/platform[@idref="cpe:/a:open-scap:oscap"]' |
| 29 | |
| 30 | [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr |
| 31 | rm $result |