Changes in trunk/test/testrun_1.sh [19:30]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/testrun_1.sh
r19 r30 1 1 #! /bin/sh 2 3 # 4 # Copyright Rainer Wichmann (2006) 5 # 6 # License Information: 7 # This program is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program; if not, write to the Free Software 19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 # 2 21 3 22 RCFILE="$PW_DIR/testrc_1.dyn"; export RCFILE … … 22 41 testrun1_setup=0 23 42 24 MAXTEST=1 0; export MAXTEST43 MAXTEST=11; export MAXTEST 25 44 26 45 test_dirs () { … … 46 65 fi 47 66 done 67 } 68 69 # 70 # combine file check schedule with one-shot mode 71 # 72 TESTPOLICY_11=" 73 [ReadOnly] 74 dir=99${BASE} 75 " 76 77 mod_testdata_11 () { 78 sleep 1 79 echo "foobar" >"${BASE}/c/x"; # bad 80 chmod 0555 "${BASE}/a/y"; # bad 81 ORIGINAL='SetFilecheckTime=60' 82 REPLACEMENT='FileCheckScheduleOne = 6 12 * * *' 83 ex $RCFILE <<EOF 84 %s/${ORIGINAL}/${REPLACEMENT}/g 85 wq 86 EOF 87 } 88 89 chk_testdata_11 () { 90 # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; 91 tmp=`grep CRIT $LOGFILE | wc -l` 92 if [ $tmp -ne 2 ]; then 93 [ -z "$verbose" ] || log_msg_fail "policy count"; 94 return 1 95 fi 96 egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1 97 if [ $? -ne 0 ]; then 98 [ -z "$verbose" ] || log_msg_fail "${BASE}/c/x"; 99 return 1 100 fi 101 egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/a/y" $LOGFILE >/dev/null 2>&1 102 if [ $? -ne 0 ]; then 103 [ -z "$verbose" ] || log_msg_fail "${BASE}/a/y"; 104 return 1 105 fi 106 CDIRS="a a/a a/b a/c c b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; 107 NDIRS=""; 108 test_dirs; 109 return $? 48 110 } 49 111 … … 749 811 run_init () 750 812 { 751 ./samhain -t init -p none 813 rm -f test_log_valgrind 814 815 ${VALGRIND} ./samhain -t init -p none 2>>test_log_valgrind 752 816 753 817 if test x$? = x0; then … … 761 825 run_check () 762 826 { 763 ./samhain -t check -p none -l debug827 ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind 764 828 765 829 if test x$? = x0; then … … 778 842 run_update () 779 843 { 780 ./samhain -t update -p none -l debug844 ${VALGRIND} ./samhain -t update -p none -l debug 2>>test_log_valgrind 781 845 782 846 if test x$? = x0; then … … 792 856 rm -rf $LOGFILE 793 857 794 ./samhain -t check -p none -l debug858 ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind 795 859 796 860 if test x$? = x0; then … … 801 865 return 1 802 866 fi 803 tmp=`./samhain -j -L $LOGFILE | grep ERR | wc -l` 867 # 868 # wtmp may not be readable 869 # 870 tmp=`./samhain -j -L $LOGFILE | grep ERR | grep -v wtmp | wc -l` 804 871 if [ $tmp -ne 0 ]; then 805 [ -z "$verbose" ] || log_msg_fail "update not successful(?)"; 806 return 1 807 fi 872 [ -z "$verbose" ] || log_msg_fail "errors during check"; 873 return 1 874 fi 875 # 876 [ -z "$VALGRIND" ] || { 877 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 878 if [ $tmp -ne 0 ]; then 879 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 880 cat test_log_valgrind 881 return 1; 882 fi; 883 } 808 884 # 809 885 [ -z "$verbose" ] || log_msg_ok "check(2)..."; … … 816 892 prep_testdata () 817 893 { 818 chmod -R 0700 "${BASE}" || { 819 [ -z "$quiet" ] && log_msg_fail "chmod -R 0700 ${BASE}"; 820 return 1; 821 } 894 if test -d "$BASE"; then 895 if [ -d "${BASE}" ]; then 896 chmod -R 0700 "${BASE}" || { 897 [ -z "$quiet" ] && log_msg_fail "chmod -R 0700 ${BASE}"; 898 return 1; 899 } 900 fi 901 fi 822 902 823 903 rm -rf "${BASE}" || { … … 872 952 if test x$? = x0; then 873 953 [ -z "$verbose" ] || log_msg_ok "configure..."; 874 $MAKE > /dev/null954 $MAKE >/dev/null 2>>test_log 875 955 if test x$? = x0; then 876 956 [ -z "$verbose" ] || log_msg_ok "make...";
Note:
See TracChangeset
for help on using the changeset viewer.