| 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=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX) |
| 9 | stderr=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX) |
| 10 | echoscip-shell system . . echo. "Stderr file = $stderr" |
| 11 | echoscip-shell system . . echo. "Result file = $result" |
| 12 | rmscip-shell system . . rm. -f test_file |
| 13 | |
| 14 | ret=0 |
| 15 | $OSCAP xccdf eval --remediate --results $result $srcdir/${name}.xccdf.xml 2> $stderr || ret=$? |
| 16 | [scip-shell system . . `[`. $ret -eq 2 ] |
| 17 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; :> $stderr |
| 18 | [scip-shell system . . `[`. ! -f test_file ] |
| 19 | |
| 20 | $OSCAP xccdf validate --skip-schematron $result |
| 21 | |
| 22 | assert_exists 1 '//rule-result' |
| 23 | assert_exists 1 '//rule-result/result' |
| 24 | assert_exists 1 '//rule-result/result[text()="fail"]' |
| 25 | assert_exists 0 '//rule-result/fix' |
| 26 | assert_exists 1 '//rule-result/message[text()="No suitable fix found."]' |
| 27 | assert_exists 1 '//score' |
| 28 | assert_exists 1 '//score[text()="0.000000"]' |
| 29 | |
| 30 | rmscip-shell system . . rm. $result |