| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | set -e -o pipefail |
| 5 | |
| 6 | # This test is dependent on /etc/issue being present, so skip this test if it doesn't exist. |
| 7 | [scip-shell system . . `[`. ! -f "/etc/issuescip-shell filesystem . . `/etc/issue`." ] && exit 255 |
| 8 | |
| 9 | name=$(basenamescip-shell system . . basename. $0 .sh) |
| 10 | result=$(mktempscip-shell system . . mktemp. ${name}.out.XXXXXX) |
| 11 | echoscip-shell system . . echo. "Result file: $result" |
| 12 | |
| 13 | echoscip-shell system . . echo. "Evaluating content." |
| 14 | $OSCAP oval eval --results $result $srcdir/${name}.xml || [scip-shell system . . `[`. $? == 2 ] |
| 15 | echoscip-shell system . . echo. "Validating results." |
| 16 | $OSCAP oval validate --results $result |
| 17 | echoscip-shell system . . echo. "Testing results values." |
| 18 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/@result)')" == "false" ] |
| 19 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/@result)')" == "true" ] |
| 20 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/@result)')" == "error" ] |
| 21 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/@result)')" == "true" ] |
| 22 | echoscip-shell system . . echo. "Testing syschar values." |
| 23 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1"]/@flag)')" == "does not exist" ] |
| 24 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:11"]/@flag)')" == "does not exist" ] |
| 25 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:2"]/@flag)')" == "complete" ] |
| 26 | [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:21"]/@flag)')" == "complete" ] |
| 27 | |
| 28 | rmscip-shell system . . rm. $result |