| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Copyright 2014--2016 Red Hat Inc., Durham, North Carolina. |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # OpenScap Probes Test Suite. |
| 7 | |
| 8 | set -e -o pipefail |
| 9 | |
| 10 | . $builddir/tests/test_common.sh |
| 11 | |
| 12 | function test_probes_systemdunitdependencyscip-shell shell shell-project 0.0.0 test_probes_systemdunitdependency(). { |
| 13 | probecheck "systemdunitdependency" || return 255 |
| 14 | pidofscip-shell system . . pidof. systemd > /dev/nullscip-shell filesystem . . `/dev/null`. || return 255 |
| 15 | systemctl > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 || return 255 |
| 16 | |
| 17 | local ret_val=0; |
| 18 | local DF="test_probes_systemdunitdependency.xml" |
| 19 | local RF="test_probes_systemdunitdependency.results.xml" |
| 20 | local stderr=$(mktempscip-shell system . . mktemp. $1.err.XXXXXX) |
| 21 | echoscip-shell system . . echo. "stderr file: $stderr" |
| 22 | |
| 23 | [scip-shell system . . `[`. -f $RF ] && rmscip-shell system . . rm. -f $RF |
| 24 | ${srcdir}/test_probes_systemdunitdependency.xml.sh "true" > $DF 2>$stderr |
| 25 | |
| 26 | $OSCAP oval eval --results $RF $DF |
| 27 | |
| 28 | [scip-shell system . . `[`. -f $RF ] |
| 29 | verify_results "def" $DF $RF 3 |
| 30 | verify_results "tst" $DF $RF 3 |
| 31 | |
| 32 | 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!" |
| 33 | rmscip-shell system . . rm. $stderr |
| 34 | |
| 35 | rmscip-shell system . . rm. $RF |
| 36 | |
| 37 | return $ret_val |
| 38 | } |
| 39 | |
| 40 | test_run "Probe systemdunitdependency general functionality" test_probes_systemdunitdependency |