| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | . $builddir/tests/test_common.sh |
| 4 | |
| 5 | set -e -o pipefail |
| 6 | |
| 7 | function perform_test { |
| 8 | probecheck "sysctl" || return 255 |
| 9 | |
| 10 | result=`mktemp` |
| 11 | stderr=`mktemp` |
| 12 | hostname=`hostname` |
| 13 | case $(uname) in |
| 14 | FreeBSD) |
| 15 | $OSCAP oval eval --results $result $srcdir/test_sysctl_probe_freebsd.oval.xml 2>$stderr |
| 16 | ;; |
| 17 | *) |
| 18 | $OSCAP oval eval --results $result $srcdir/test_sysctl_probe.oval.xml 2>$stderr |
| 19 | ;; |
| 20 | esac |
| 21 | |
| 22 | [ ! -s $stderr ] |
| 23 | case $(uname) in |
| 24 | FreeBSD) |
| 25 | assert_exists 1 "/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:sysctl_item/unix-sys:name[text()='kern.hostname']" |
| 26 | assert_exists 1 "/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:sysctl_item/unix-sys:value[text()='$hostname']" |
| 27 | ;; |
| 28 | *) |
| 29 | assert_exists 1 "/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:sysctl_item/unix-sys:name[text()='kernel.hostname']" |
| 30 | assert_exists 1 "/oval_results/results/system/oval_system_characteristics/system_data/unix-sys:sysctl_item/unix-sys:value[text()='$hostname']" |
| 31 | ;; |
| 32 | esac |
| 33 | |
| 34 | rm $result |
| 35 | rm $stderr |
| 36 | } |
| 37 | |
| 38 | perform_test |