| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | . $builddir/tests/test_common.sh |
| 4 | |
| 5 | function test_probes_selinuxsecuritycontext { |
| 6 | # if the user doesn't have SELinux enabled we will skip the test |
| 7 | selinuxenabled || return 255 |
| 8 | |
| 9 | probecheck "selinuxboolean" || return 255 |
| 10 | |
| 11 | local ret_val=0; |
| 12 | local DF="${srcdir}/test_probes_selinuxsecuritycontext.xml" |
| 13 | local RF="test_probes_selinuxsecuritycontext.results.xml" |
| 14 | local stderr=$(mktemp $1.err.XXXXXX) |
| 15 | echo "stderr file: $stderr" |
| 16 | |
| 17 | [ -f $RF ] && rm -f $RF |
| 18 | |
| 19 | $OSCAP oval eval --results $RF $DF 2>$stderr |
| 20 | |
| 21 | if [ -f $RF ]; then |
| 22 | verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF 1 |
| 23 | ret_val=$? |
| 24 | else |
| 25 | ret_val=1 |
| 26 | fi |
| 27 | |
| 28 | grep -Ei "(W: |E: )" $stderr && ret_val=1 && echo "There is an error and/or a warning in the output!" |
| 29 | rm $stderr |
| 30 | |
| 31 | return $ret_val |
| 32 | } |
| 33 | |
| 34 | test_run "Basic selinuxsecuritycontext probe test" test_probes_selinuxsecuritycontext |