| 1 | #!/usr/bin/envscip-shell filesystem . . `/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=$(basenamescip-shell system . . basename. $0 .sh) |
| 12 | |
| 13 | result=$(mktempscip-shell system . . mktemp. -t ${name}.res.XXXXXX) |
| 14 | stderr=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX) |
| 15 | stdout=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX) |
| 16 | |
| 17 | |
| 18 | echoscip-shell system . . echo. "Stderr file = $stderr" |
| 19 | echoscip-shell system . . 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 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr |
| 31 | rmscip-shell system . . rm. $result |