| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | set -e |
| 5 | set -o pipefail |
| 6 | |
| 7 | name=$(basenamescip-shell system . . basename. $0 .sh) |
| 8 | stderr=$(make_temp_file /tmpscip-shell filesystem . . `/tmp`. ${name}.out) |
| 9 | tmpdir=$(make_temp_dir /tmpscip-shell filesystem . . `/tmp`. ${name}.out) |
| 10 | result=$(make_temp_file ${tmpdir} ${name}.out) |
| 11 | |
| 12 | cpe=$srcdir/${name}.cpe.xml |
| 13 | |
| 14 | echoscip-shell system . . echo. "Stderr file = $stderr" |
| 15 | echoscip-shell system . . echo. "Result file = $result" |
| 16 | |
| 17 | $OSCAP xccdf eval --cpe $cpe --results $result $srcdir/${name}.xccdf.xml 2> $stderr |
| 18 | [scip-shell system . . `[`. "$?" == "0" ] |
| 19 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; :> $stderr |
| 20 | assert_exists 1 '//TestResult' |
| 21 | assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rtrue"]/result[text()="pass"]' |
| 22 | assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rfalse"]/result[text()="notapplicable"]' |
| 23 | assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gtrue_rnone"]/result[text()="pass"]' |
| 24 | |
| 25 | assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rtrue"]/result[text()="notapplicable"]' |
| 26 | assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rfalse"]/result[text()="notapplicable"]' |
| 27 | assert_exists 1 '//TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_gfalse_rnone"]/result[text()="notapplicable"]' |
| 28 | |
| 29 | rmscip-shell system . . rm. $result |