| 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 | set -e -o pipefail |
| 18 | |
| 19 | # Test Cases. |
| 20 | |
| 21 | function test_probes_shadow { |
| 22 | |
| 23 | probecheck "shadow" || return 255 |
| 24 | |
| 25 | local ret_val=0; |
| 26 | local DF="${srcdir}/test_probes_shadow_offline.xml" |
| 27 | local RF="results.xml" |
| 28 | |
| 29 | [ -f $RF ] && rm -f $RF |
| 30 | |
| 31 | tmpdir=$(make_temp_dir /tmp "test_offline_mode_shadow") |
| 32 | mkdir -p "${tmpdir}/etc" |
| 33 | echo "root:!locked::0:99999:7:::" > "${tmpdir}/etc/shadow" |
| 34 | set_chroot_offline_test_mode "${tmpdir}" |
| 35 | |
| 36 | $OSCAP oval eval --results $RF $DF |
| 37 | |
| 38 | unset_chroot_offline_test_mode |
| 39 | rm -rf "${tmpdir}" |
| 40 | |
| 41 | if [ -f $RF ]; then |
| 42 | verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF $LINES |
| 43 | ret_val=$? |
| 44 | else |
| 45 | ret_val=1 |
| 46 | fi |
| 47 | |
| 48 | return $ret_val |
| 49 | } |
| 50 | |
| 51 | # Testing. |
| 52 | |
| 53 | test_init |
| 54 | |
| 55 | test_run "test_probes_shadow" test_probes_shadow |
| 56 | |
| 57 | test_exit |