| 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 | # Evgenii Kolesnikov, <[email protected]> |
| 15 | |
| 16 | . $builddir/tests/test_common.sh |
| 17 | |
| 18 | set -e -o pipefail |
| 19 | |
| 20 | # Test Cases. |
| 21 | |
| 22 | function test_probes_password { |
| 23 | |
| 24 | probecheck "password" || return 255 |
| 25 | |
| 26 | local ret_val=0; |
| 27 | local DF="${srcdir}/test_probes_password_offline.xml" |
| 28 | local RF="results.xml" |
| 29 | |
| 30 | [ -f $RF ] && rm -f $RF |
| 31 | |
| 32 | tmpdir=$(mktemp -t -d "test_password.XXXXXX") |
| 33 | mkdir -p "$tmpdir/etc" |
| 34 | echo "root:x:0:0:root:/root:/bin/bash" > "$tmpdir/etc/passwd" |
| 35 | set_chroot_offline_test_mode "$tmpdir" |
| 36 | |
| 37 | $OSCAP oval eval --results $RF $DF |
| 38 | |
| 39 | unset_chroot_offline_test_mode |
| 40 | rm -rf $tempdir |
| 41 | |
| 42 | if [ -f $RF ]; then |
| 43 | result=$RF |
| 44 | assert_exists 1 'oval_results/results/system/tests/test[@test_id="oval:1:tst:1"][@result="true"]' |
| 45 | ret_val=$? |
| 46 | else |
| 47 | ret_val=1 |
| 48 | fi |
| 49 | |
| 50 | return $ret_val |
| 51 | } |
| 52 | |
| 53 | # Testing. |
| 54 | |
| 55 | test_init |
| 56 | |
| 57 | test_run "test_probes_password_offline" test_probes_password |
| 58 | |
| 59 | test_exit |