| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -e -o pipefail |
| 4 | |
| 5 | . $builddir/tests/test_common.sh |
| 6 | |
| 7 | probecheck "textfilecontent54" || exit 255 |
| 8 | |
| 9 | cp $srcdir/30-ospp-v42.rules /tmp |
| 10 | |
| 11 | name=$(basename $0 .sh) |
| 12 | input=$srcdir/$name.oval.xml |
| 13 | result=$(mktemp) |
| 14 | stdout=$(mktemp) |
| 15 | stderr=$(mktemp) |
| 16 | |
| 17 | $OSCAP oval eval --results $result $input > $stdout 2> $stderr |
| 18 | |
| 19 | grep -q "Function oscap_pcre_exec() failed to match a regular expression with return code -21" $stderr |
| 20 | |
| 21 | assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1" and @result="error"]' |
| 22 | |
| 23 | co='/oval_results/results/system/oval_system_characteristics/collected_objects' |
| 24 | assert_exists 1 $co'/object[@flag="error"]' |
| 25 | assert_exists 1 $co'/object/message[@level="error"]' |
| 26 | assert_exists 1 $co'/object/message[text()="Regular expression pattern match failed in file /tmp/30-ospp-v42.rules with error -21."]' |
| 27 | |
| 28 | rm -f /tmp/30-ospp-v42.rules |
| 29 | rm -f $result |
| 30 | rm -f $stdout |
| 31 | rm -f $stderr |