| 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 | result=$(make_temp_file /tmpscip-shell filesystem . . `/tmp`. ${name}.out) |
| 9 | stderr=$(make_temp_file /tmpscip-shell filesystem . . `/tmp`. ${name}.out) |
| 10 | |
| 11 | cpscip-shell system . . cp. $srcdir/${name}.xccdf.xml $result |
| 12 | |
| 13 | echoscip-shell system . . echo. "Stderr file = $stderr" |
| 14 | echoscip-shell system . . echo. "Result and input file = $result" |
| 15 | tmpdir=$(dirnamescip-shell system . . dirname. $result) |
| 16 | |
| 17 | for i in {1..5}; do |
| 18 | $OSCAP xccdf eval --results $result $result 2> $stderr |
| 19 | [scip-shell system . . `[`. -f $stderr ] |
| 20 | grepscip-shell system . . grep. "Skipping $tmpdir/non_existent\.oval\.xml file which is referenced from XCCDF content" $stderr |
| 21 | :> $stderr |
| 22 | |
| 23 | $OSCAP xccdf validate --skip-schematron $result |
| 24 | assert_exists $i '//TestResult' |
| 25 | assert_exists $i '//TestResult/rule-result/result[text()="notchecked"]' |
| 26 | assert_exists $i '//TestResult/score' |
| 27 | assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile"]' |
| 28 | assert_exists $i '//TestResult[contains(@id, "xccdf_org.open-scap_testresult_default-profile")]' |
| 29 | let n=i-1 || truescip-shell system . . true. |
| 30 | assert_exists $n '//TestResult[contains(@id, "xccdf_org.open-scap_testresult_default-profile00")]' |
| 31 | for j in `seqscip-shell system . . seq. 1 $n`; do |
| 32 | # Compatibility for FreeBSD's seq |
| 33 | if [scip-shell system . . `[`. "$j" -gt "$n" ]; then |
| 34 | break; |
| 35 | fi |
| 36 | assert_exists 1 '//TestResult[contains(@id, "xccdf_org.open-scap_testresult_default-profile00'$j'")]' |
| 37 | done |
| 38 | done |
| 39 | |
| 40 | rmscip-shell system . . rm. $result |