| 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 | |
| 9 | result=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX) |
| 10 | stderr=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX) |
| 11 | |
| 12 | $OSCAP xccdf eval --results $result $srcdir/${name}.xccdf.xml 2> $stderr |
| 13 | |
| 14 | echoscip-shell system . . echo. "Stderr file = $stderr" |
| 15 | echoscip-shell system . . echo. "Result file = $result" |
| 16 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr |
| 17 | |
| 18 | $OSCAP xccdf validate --skip-schematron $result |
| 19 | |
| 20 | assert_exists 3 '//fix' |
| 21 | assert_exists 3 '//fix/@id' |
| 22 | assert_exists 3 '//Rule/fix' |
| 23 | assert_exists 0 '//rule-result/fix' |
| 24 | assert_exists 1 '//Rule/fix[@id="fix-empty"]' |
| 25 | assert_exists 0 '//rule-result/fix[@id="fix-empty"]' |
| 26 | assert_exists 1 '//Rule/fix[@id="fix-unknown"]' |
| 27 | assert_exists 0 '//rule-result/fix[@id="fix-unknown"]' |
| 28 | assert_exists 1 '//Rule/fix[@id="fix-restrict"]' |
| 29 | assert_exists 0 '//rule-result/fix[@id="fix-restrict"]' |
| 30 | |
| 31 | assert_exists 1 '//fix[@id="fix-empty"]' |
| 32 | assert_exists 1 '//fix[@id="fix-empty"]/@*' |
| 33 | |
| 34 | assert_exists 1 '//fix[@id="fix-unknown"]' |
| 35 | assert_exists 3 '//fix[@id="fix-unknown"]/@*' |
| 36 | assert_exists 1 '//fix[@id="fix-unknown" and @disruption="unknown"]' |
| 37 | assert_exists 1 '//fix[@id="fix-unknown" and @complexity="unknown"]' |
| 38 | assert_exists 0 '//fix[@id="fix-unknown" and @strategy="unknown"]' |
| 39 | |
| 40 | assert_exists 1 '//fix[@id="fix-restrict"]' |
| 41 | assert_exists 4 '//fix[@id="fix-restrict"]/@*' |
| 42 | assert_exists 1 '//fix[@id="fix-restrict" and @disruption="medium"]' |
| 43 | assert_exists 1 '//fix[@id="fix-restrict" and @complexity="high"]' |
| 44 | assert_exists 1 '//fix[@id="fix-restrict" and @strategy="restrict"]' |
| 45 | |
| 46 | rmscip-shell system . . rm. $result |