| 1 | #!/usr/bin/env bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | set -e -o pipefail |
| 5 | |
| 6 | name=$(basename $0 .sh) |
| 7 | result=$(mktemp ${name}.out.XXXXXX) |
| 8 | echo "result file: $result" |
| 9 | stderr=$(mktemp ${name}.err.XXXXXX) |
| 10 | echo "stderr file: $stderr" |
| 11 | |
| 12 | echo "Analysing syschar content." |
| 13 | $OSCAP oval analyse --results $result $srcdir/$name.oval.xml $srcdir/$name.syschar.xml 2> $stderr |
| 14 | [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr |
| 15 | [ -f $result ] |
| 16 | |
| 17 | assert_exists 1 '/oval_results' |
| 18 | assert_exists 1 '/oval_results/generator' |
| 19 | assert_exists 1 '/oval_results/generator/oval:product_name' |
| 20 | assert_exists 1 '/oval_results/generator/oval:product_name[text()="cpe:/a:open-scap:oscap"]' |
| 21 | assert_exists 1 '/oval_results/generator/oval:schema_version' |
| 22 | assert_exists 1 '/oval_results/generator/oval:schema_version[text()="5.8"]' |
| 23 | assert_exists 1 '/oval_results/generator/oval:timestamp' |
| 24 | assert_exists 1 '/oval_results/directives' |
| 25 | assert_exists 1 '/oval_results/oval_definitions' |
| 26 | assert_exists 1 '/oval_results/results' |
| 27 | assert_exists 1 '/oval_results/results/system' |
| 28 | assert_exists 1 '/oval_results/results/system/definitions' |
| 29 | assert_exists 6 '/oval_results/results/system/definitions/definition' |
| 30 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]' |
| 31 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"][@result="true"]' |
| 32 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]/criteria' |
| 33 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]/criteria/criterion' |
| 34 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]/criteria/criterion[@result="true"]' |
| 35 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]' |
| 36 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"][@result="false"]' |
| 37 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]/criteria' |
| 38 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]/criteria/criterion' |
| 39 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]/criteria/criterion[@result="false"]' |
| 40 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:3"]' |
| 41 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:3"][@result="true"]' |
| 42 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:3"]/criteria' |
| 43 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:3"]/criteria/criterion' |
| 44 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:3"]/criteria/criterion[@result="true"]' |
| 45 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:4"]' |
| 46 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:4"][@result="false"]' |
| 47 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:4"]/criteria' |
| 48 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:4"]/criteria/criterion' |
| 49 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:4"]/criteria/criterion[@result="false"]' |
| 50 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5"]' |
| 51 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5"][@result="true"]' |
| 52 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5"]/criteria' |
| 53 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5"]/criteria/criterion' |
| 54 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5"]/criteria/criterion[@result="true"]' |
| 55 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6"]' |
| 56 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6"][@result="false"]' |
| 57 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6"]/criteria' |
| 58 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6"]/criteria/criterion' |
| 59 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6"]/criteria/criterion[@result="false"]' |
| 60 | assert_exists 1 '/oval_results/results/system/tests' |
| 61 | assert_exists 6 '/oval_results/results/system/tests/test' |
| 62 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]' |
| 63 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"][@result="true"]' |
| 64 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/*' |
| 65 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item' |
| 66 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item/@*' |
| 67 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item/@item_id' |
| 68 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item[@result="true"]' |
| 69 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_variable' |
| 70 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_variable/@*' |
| 71 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_variable[@variable_id="oval:x:var:1"]' |
| 72 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_variable[text()="192.168.1.1"]' |
| 73 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]' |
| 74 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"][@result="false"]' |
| 75 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/*' |
| 76 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item' |
| 77 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item/@*' |
| 78 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item/@item_id' |
| 79 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item[@result="false"]' |
| 80 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_variable' |
| 81 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_variable/@*' |
| 82 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_variable[@variable_id="oval:x:var:1"]' |
| 83 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_variable[text()="192.168.1.1"]' |
| 84 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]' |
| 85 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"][@result="true"]' |
| 86 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/*' |
| 87 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_item' |
| 88 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_item/@*' |
| 89 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_item/@item_id' |
| 90 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_item[@result="true"]' |
| 91 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_variable' |
| 92 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_variable/@*' |
| 93 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_variable[@variable_id="oval:x:var:2"]' |
| 94 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:3"]/tested_variable[text()="192.168.1.1/16"]' |
| 95 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]' |
| 96 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"][@result="false"]' |
| 97 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/*' |
| 98 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_item' |
| 99 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_item/@*' |
| 100 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_item/@item_id' |
| 101 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_item[@result="false"]' |
| 102 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_variable' |
| 103 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_variable/@*' |
| 104 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_variable[@variable_id="oval:x:var:3"]' |
| 105 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:4"]/tested_variable[text()="192.168.99.1"]' |
| 106 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]' |
| 107 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"][@result="true"]' |
| 108 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/*' |
| 109 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_item' |
| 110 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_item/@*' |
| 111 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_item/@item_id' |
| 112 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_item[@result="true"]' |
| 113 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_variable' |
| 114 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_variable/@*' |
| 115 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_variable[@variable_id="oval:x:var:4"]' |
| 116 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:5"]/tested_variable[text()="192.168.99.1/16"]' |
| 117 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]' |
| 118 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"][@result="false"]' |
| 119 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/*' |
| 120 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_item' |
| 121 | assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_item/@*' |
| 122 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_item/@item_id' |
| 123 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_item[@result="false"]' |
| 124 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_variable' |
| 125 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_variable/@*' |
| 126 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_variable[@variable_id="oval:x:var:5"]' |
| 127 | assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:6"]/tested_variable[text()="192.168.99.1/29"]' |
| 128 | |
| 129 | rm $result |