| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # This is regression test of RHBZ #2008922 |
| 4 | |
| 5 | set -e -o pipefail |
| 6 | |
| 7 | . $builddir/tests/test_common.sh |
| 8 | probecheck "process58" || exit 255 |
| 9 | |
| 10 | name=$(basename $0 .sh) |
| 11 | result=$(mktemp ${name}.out.XXXXXX) |
| 12 | stderr=$(mktemp ${name}.err.XXXXXX) |
| 13 | |
| 14 | root=$(mktemp -d) |
| 15 | |
| 16 | # create an empty /proc in the offline file system dir |
| 17 | mkdir -p "$root/proc" |
| 18 | |
| 19 | export OSCAP_PROBE_ROOT="$root" |
| 20 | $OSCAP oval eval --results $result $srcdir/capability.oval.xml 2> $stderr |
| 21 | |
| 22 | [ $? -eq 0 ] |
| 23 | grep -q "^W: oscap:\s\+No data about processes could be read from '$root/proc'." "$stderr" |
| 24 | grep -q "OpenSCAP Error: Probe at sd=1 (process58) reported an error: Operation not permitted" "$stderr" && false |
| 25 | grep -q "W: oscap:\s\+Can't receive message: 125, Operation canceled." "$stderr" && false |
| 26 | |
| 27 | [ -s "$result" ] |
| 28 | assert_exists 1 '/oval_results/results/system/definitions/definition[@result="false"]' |
| 29 | assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@flag="does not exist"]' |
| 30 | |
| 31 | rm "$stderr" |
| 32 | rm "$result" |
| 33 | rm -r "$root" |