| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | touchscip-shell system . . touch. not_executable |
| 5 | set -e |
| 6 | set -o pipefail |
| 7 | |
| 8 | name=$(basenamescip-shell system . . basename. $0 .sh) |
| 9 | |
| 10 | result=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX) |
| 11 | stderr=$(mktempscip-shell system . . mktemp. -t ${name}.err.XXXXXX) |
| 12 | |
| 13 | $OSCAP xccdf eval --profile xccdf_moc.elpmaxe.www_profile_3 --results $result $srcdir/${name}.xccdf.xml 2> $stderr |
| 14 | |
| 15 | echoscip-shell system . . echo. "Stderr file = $stderr" |
| 16 | echoscip-shell system . . echo. "Result file = $result" |
| 17 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr |
| 18 | |
| 19 | $OSCAP xccdf validate --skip-schematron $result |
| 20 | |
| 21 | assert_exists 1 '//Benchmark' |
| 22 | assert_exists 1 '//Benchmark[@resolved="1"]' |
| 23 | assert_exists 3 '//Profile' |
| 24 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_1"]' |
| 25 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_1"]/select' |
| 26 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_1"]/select[@idref="my-enabled-cluster" and @selected="false"]' |
| 27 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]' |
| 28 | assert_exists 3 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select' |
| 29 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select[1][@idref="my-enabled-cluster" and @selected="false"]' |
| 30 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select[2][@idref="my-disabled-cluster" and @selected="false"]' |
| 31 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_2"]/select[3][@idref="xccdf_moc.elpmaxe.www_rule_3" and @selected="false"]' |
| 32 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]' |
| 33 | assert_exists 3 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select' |
| 34 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select[1][@idref="my-disabled-cluster" and @selected="false"]' |
| 35 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select[2][@idref="xccdf_moc.elpmaxe.www_rule_3" and @selected="false"]' |
| 36 | assert_exists 1 '//Profile[@id="xccdf_moc.elpmaxe.www_profile_3"]/select[3][@idref="my-enabled-cluster" and @selected="true"]' |
| 37 | assert_exists 3 '//rule-result' |
| 38 | assert_exists 3 '//rule-result/result' |
| 39 | assert_exists 1 '//rule-result/result[text()="pass"]' |
| 40 | assert_exists 2 '//rule-result/result[text()="notselected"]' |
| 41 | assert_exists 1 '//score' |
| 42 | assert_exists 1 '//score[text()="100.000000"]' |
| 43 | rmscip-shell system . . rm. $result |
| 44 | |
| 45 | rmscip-shell system . . rm. not_executable |