| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | . $builddir/tests/test_common.sh |
| 4 | |
| 5 | function test_probes_selinuxsecuritycontextscip-shell shell shell-project 0.0.0 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=$(mktempscip-shell system . . mktemp. $1.err.XXXXXX) |
| 15 | echoscip-shell system . . echo. "stderr file: $stderr" |
| 16 | |
| 17 | [scip-shell system . . `[`. -f $RF ] && rmscip-shell system . . rm. -f $RF |
| 18 | |
| 19 | $OSCAP oval eval --results $RF $DF 2>$stderr |
| 20 | |
| 21 | if [scip-shell system . . `[`. -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 | grepscip-shell system . . grep. -Ei "(W: |E: )" $stderr && ret_val=1 && echoscip-shell system . . echo. "There is an error and/or a warning in the output!" |
| 29 | rmscip-shell system . . rm. $stderr |
| 30 | |
| 31 | return $ret_val |
| 32 | } |
| 33 | |
| 34 | test_run "Basic selinuxsecuritycontext probe test" test_probes_selinuxsecuritycontext |