| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Test basic usage of OVAL Directives. OVAL Directives here are used to exclude |
| 4 | # <definitions> element from the resulting OVAL Results file. |
| 5 | |
| 6 | . $builddir/tests/test_common.sh |
| 7 | |
| 8 | set -e -o pipefail |
| 9 | |
| 10 | name=$(basenamescip-shell system . . basename. $0 .sh) |
| 11 | result=$(mktempscip-shell system . . mktemp. ${name}.out.XXXXXX) |
| 12 | stderr=$(mktempscip-shell system . . mktemp. ${name}.err.XXXXXX) |
| 13 | |
| 14 | $OSCAP oval eval --results $result --directives $srcdir/$name.xml $srcdir/comment.xml 2> $stderr |
| 15 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr |
| 16 | [scip-shell system . . `[`. -f $result ] |
| 17 | |
| 18 | assert_exists 0 '/oval_results/oval_definitionsscip-shell filesystem . . `/oval_results/oval_definitions`.' |
| 19 | assert_exists 1 '/oval_results/directives[@include_source_definitions="false"]scip-shell filesystem . . `/oval_results/directives[@include_source_definitions="false"]`.' |
| 20 | assert_exists 1 '/oval_results/directives/definition_true[@reported="true" and @content="full"]scip-shell filesystem . . `/oval_results/directives/definition_true[@reported="true" and @content="full"]`.' |
| 21 | assert_exists 1 '/oval_results/directives/definition_false[@reported="true" and @content="full"]scip-shell filesystem . . `/oval_results/directives/definition_false[@reported="true" and @content="full"]`.' |
| 22 | assert_exists 1 '/oval_results/directives/definition_unknown[@reported="true" and @content="full"]scip-shell filesystem . . `/oval_results/directives/definition_unknown[@reported="true" and @content="full"]`.' |
| 23 | assert_exists 1 '/oval_results/directives/definition_error[@reported="true" and @content="full"]scip-shell filesystem . . `/oval_results/directives/definition_error[@reported="true" and @content="full"]`.' |
| 24 | assert_exists 1 '/oval_results/directives/definition_not_evaluated[@reported="true" and @content="full"]scip-shell filesystem . . `/oval_results/directives/definition_not_evaluated[@reported="true" and @content="full"]`.' |
| 25 | assert_exists 1 '/oval_results/directives/definition_not_applicable[@reported="true" and @content="full"]scip-shell filesystem . . `/oval_results/directives/definition_not_applicable[@reported="true" and @content="full"]`.' |
| 26 | |
| 27 | rmscip-shell system . . rm. $result |