| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Copyright 2009 Red Hat Inc., Durham, North Carolina. |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # OpenScap Probes Test Suite. |
| 7 | # |
| 8 | # Created on: Nov 30, 2009 |
| 9 | # |
| 10 | # Authors: |
| 11 | # Peter Vrabec, <[email protected]> |
| 12 | # David Niemoller |
| 13 | # Ondrej Moris, <[email protected]> |
| 14 | |
| 15 | . $builddir/tests/test_common.sh |
| 16 | |
| 17 | # Test Cases. |
| 18 | |
| 19 | function test_probes_shadow { |
| 20 | |
| 21 | probecheck "shadow" || return 255 |
| 22 | |
| 23 | local ret_val=0; |
| 24 | local DF="test_probes_shadow.xml" |
| 25 | local RF="results.xml" |
| 26 | |
| 27 | [ -f $RF ] && rm -f $RF |
| 28 | |
| 29 | eval "cat /etc/shadow > /dev/null 2>&1" |
| 30 | if [ ! $? -eq 0 ]; then |
| 31 | echo -e "Can't read /etc/shadow!\n" |
| 32 | return 255; # Test is not applicable. |
| 33 | fi |
| 34 | |
| 35 | LINES=`cat /etc/shadow | wc -l`; ID=1 |
| 36 | |
| 37 | bash ${srcdir}/test_probes_shadow.xml.sh > $DF |
| 38 | $OSCAP oval eval --results $RF $DF |
| 39 | |
| 40 | if [ -f $RF ]; then |
| 41 | verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF $LINES |
| 42 | ret_val=$? |
| 43 | else |
| 44 | ret_val=1 |
| 45 | fi |
| 46 | |
| 47 | return $ret_val |
| 48 | } |
| 49 | |
| 50 | # Testing. |
| 51 | |
| 52 | test_init |
| 53 | |
| 54 | test_run "test_probes_shadow" test_probes_shadow |
| 55 | |
| 56 | test_exit |