Changeset 169 for trunk/test
- Timestamp:
- Apr 13, 2008, 9:59:55 PM (17 years ago)
- Location:
- trunk/test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/testrun_1.sh
r138 r169 41 41 testrun1_setup=0 42 42 43 MAXTEST=1 3; export MAXTEST43 MAXTEST=15; export MAXTEST 44 44 45 45 test_dirs () { … … 65 65 fi 66 66 done 67 } 68 69 70 TESTPOLICY_15=" 71 [Misc] 72 DigestAlgo=SHA1 73 RedefReadOnly = +TXT 74 [ReadOnly] 75 dir=${BASE} 76 " 77 mod_testdata_15 () { 78 mod_testdata_1 79 } 80 chk_testdata_15 () { 81 chk_testdata_1 82 } 83 84 TESTPOLICY_14=" 85 [Misc] 86 DigestAlgo=MD5 87 RedefReadOnly = +TXT 88 [ReadOnly] 89 dir=${BASE} 90 " 91 mod_testdata_14 () { 92 mod_testdata_1 93 } 94 chk_testdata_14 () { 95 chk_testdata_1 67 96 } 68 97 … … 455 484 mod_testdata_5 () { 456 485 mod_testdata_4 457 echo "This is a xxxx file" > "${BASE}/a/a/b/x" # GrowingLogFiles 458 echo "This is a test file" > "${BASE}/a/a/b/y" # GrowingLogFiles 459 echo "This is a xxxx file bad" > "${BASE}/a/a/b/z" # GrowingLogFiles 486 echo "1 This is a xxxx file" > "${BASE}/a/a/b/x" # GrowingLogFiles 487 echo "1 This is a test file" > "${BASE}/a/a/b/y" # GrowingLogFiles 488 echo "2 This is a test file" >> "${BASE}/a/a/b/y" # GrowingLogFiles 489 echo "1 This is a xxxx file bad" > "${BASE}/a/a/b/z" # GrowingLogFiles 490 echo "2 This is a xxxx file bad" >>"${BASE}/a/a/b/z" # GrowingLogFiles 491 echo "3 This is a xxxx file bad" >>"${BASE}/a/a/b/z" # GrowingLogFiles 460 492 } 461 493 … … 716 748 " 717 749 mod_testdata_2 () { 718 mod_testdata_1; 750 # mod_testdata_1; 751 one_sec_sleep 752 touch "${BASE}/a/a/x" 753 chmod 0555 "${BASE}/a/a/y" 754 mv "${BASE}/a/b/y" "${BASE}/a/b/yy"; 755 echo "1 This is a test file" > "${BASE}/a/b/y"; 756 echo "2 This is a test file" >> "${BASE}/a/b/y"; 757 echo "4 This is a test file" >> "${BASE}/a/b/z"; 758 rm "${BASE}/a/b/yy"; # mv/rm to force new inode 759 rm "${BASE}/a/b/l_y"; 760 ln -s "${BASE}/a/b/x" "${BASE}/a/b/l_y"; 761 echo "foobar" > "${BASE}/a/c/y" 719 762 rm "${BASE}/a/a/c/y" 720 763 echo "foobar" > "${BASE}/a/a/c/foo" … … 762 805 fi 763 806 tmp=`grep CRIT $LOGFILE | wc -l` 764 if [ $tmp -ne 8]; then807 if [ $tmp -ne 10 ]; then 765 808 [ -z "$verbose" ] || log_msg_fail "policy count"; 766 809 return 1 … … 769 812 770 813 TESTPOLICY_1=" 814 [Misc] 815 RedefReadOnly = +TXT 771 816 [ReadOnly] 772 817 dir=${BASE} … … 777 822 touch "${BASE}/a/a/x" 778 823 chmod 0555 "${BASE}/a/a/y" 779 mv "${BASE}/a/b/y" "${BASE}/a/b/yy"; echo "This is a test file" > "${BASE}/a/b/y"; rm "${BASE}/a/b/yy" 824 mv "${BASE}/a/b/y" "${BASE}/a/b/yy"; 825 echo "1 This is a test file" > "${BASE}/a/b/y"; 826 echo "2 This is a test file" >> "${BASE}/a/b/y"; 827 echo "4 This is a test file" >> "${BASE}/a/b/z"; 828 rm "${BASE}/a/b/yy"; # mv/rm to force new inode 829 rm "${BASE}/a/b/l_y"; 830 ln -s "${BASE}/a/b/x" "${BASE}/a/b/l_y"; 780 831 echo "foobar" > "${BASE}/a/c/y" 832 # 833 mv "${BASE}/b/x" "${BASE}/b/xx"; # mv/rm to force new inode 834 mkdir "${BASE}/b/x" 835 rm "${BASE}/b/xx"; 836 # 837 mv "${BASE}/b/y" "${BASE}/b/yy"; # mv/rm to force new inode 838 ln -s "${BASE}/b/z" "${BASE}/b/y" 839 rm "${BASE}/b/yy"; 840 # 841 rm "${BASE}/b/l_x"; echo "1 This is a test file" > "${BASE}/b/l_x"; 781 842 } 782 843 … … 792 853 if [ $tmp -ne 1 ]; then 793 854 [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)"; 855 return 1 794 856 fi 795 857 # … … 797 859 egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1 798 860 if [ $? -ne 0 ]; then 799 [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checking)"; 800 return 1 861 if [ "${BASE}/${ff}" != "${BASE}/b" ]; then 862 [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checksum)"; 863 return 1 864 fi 801 865 fi 802 866 tmp=`egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE 2>/dev/null | wc -l` 803 867 if [ $tmp -ne 1 ]; then 804 [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)"; 868 if [ "${BASE}/${ff}" != "${BASE}/b" ]; then 869 [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)"; 870 return 1 871 fi 805 872 fi 806 873 done 807 874 done 875 # 876 # 877 # 878 egrep "CRIT.*POLICY \[ReadOnly\] ----H---T-.*${BASE}/b" $LOGFILE >/dev/null 2>&1 879 if [ $? -ne 0 ]; then 880 [ -z "$verbose" ] || log_msg_fail "${BASE}/b"; 881 return 1 882 fi 883 egrep "CRIT.*POLICY \[ReadOnly\] CL-I-M--TS.*${BASE}/b/y" $LOGFILE >/dev/null 2>&1 884 if [ $? -ne 0 ]; then 885 [ -z "$verbose" ] || log_msg_fail "${BASE}/b/y"; 886 return 1 887 fi 888 egrep "CRIT.*POLICY \[ReadOnly\] CL---M--TS.*${BASE}/b/l_x" $LOGFILE >/dev/null 2>&1 889 if [ $? -ne 0 ]; then 890 [ -z "$verbose" ] || log_msg_fail "${BASE}/b/l_x"; 891 return 1 892 fi 893 egrep "CRIT.*POLICY \[ReadOnly\] C--IHM--TS.*${BASE}/b/x" $LOGFILE >/dev/null 2>&1 894 if [ $? -ne 0 ]; then 895 [ -z "$verbose" ] || log_msg_fail "${BASE}/b/x"; 896 return 1 897 fi 898 # 899 # 900 # 808 901 egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/a/a/x" $LOGFILE >/dev/null 2>&1 809 902 if [ $? -ne 0 ]; then … … 821 914 return 1 822 915 fi 916 egrep "CRIT.*POLICY \[ReadOnly\] -L-I----T-.*${BASE}/a/b/l_y" $LOGFILE >/dev/null 2>&1 917 if [ $? -ne 0 ]; then 918 [ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/l_y"; 919 return 1 920 fi 823 921 egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/a/b" $LOGFILE >/dev/null 2>&1 824 922 if [ $? -ne 0 ]; then … … 826 924 return 1 827 925 fi 926 egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/b/z" $LOGFILE >/dev/null 2>&1 927 if [ $? -ne 0 ]; then 928 [ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/z"; 929 return 1 930 fi 828 931 egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/c/y" $LOGFILE >/dev/null 2>&1 829 932 if [ $? -ne 0 ]; then … … 832 935 fi 833 936 tmp=`grep CRIT $LOGFILE | wc -l` 834 if [ $tmp -ne 5]; then937 if [ $tmp -ne 11 ]; then 835 938 [ -z "$verbose" ] || log_msg_fail "policy count"; 836 939 return 1 837 940 fi 941 for ff in x y z; do 942 ./samhain --list-file "${BASE}/a/a/${ff}" -d "$PW_DIR/.samhain_file" > "$PW_DIR/.samhain_tmp" 943 diff "$PW_DIR/.samhain_tmp" "${BASE}/a/a/${ff}" >/dev/null 944 if [ $? -ne 0 ]; then 945 [ -z "$verbose" ] || log_msg_fail "diff $PW_DIR/.samhain_tmp ${BASE}/a/a/${ff}" 946 return 1 947 fi 948 done 949 838 950 return 0 839 951 } … … 1028 1140 chmod 0755 "${BASE}/${ff}" 1029 1141 for gg in $TFILES; do 1030 echo " This is a test file" > "${BASE}/${ff}/${gg}"1142 echo "1 This is a test file" > "${BASE}/${ff}/${gg}" 1031 1143 chmod 0644 "${BASE}/${ff}/${gg}" 1144 ln -s "${BASE}/${ff}/${gg}" "${BASE}/${ff}/l_${gg}" 1032 1145 done 1146 echo "2 This is a test file" >> "${BASE}/${ff}/y" 1147 echo "2 This is a test file" >> "${BASE}/${ff}/z" 1148 echo "3 This is a test file" >> "${BASE}/${ff}/z" 1033 1149 done 1034 1150 } -
trunk/test/testrun_1b.sh
r163 r169 20 20 # 21 21 22 MAXTEST= 5; export MAXTEST22 MAXTEST=6; export MAXTEST 23 23 LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE 24 24 RCFILE="$PW_DIR/testrc_1.dyn"; export RCFILE … … 136 136 137 137 mv $PW_DIR/.samhain_file.asc $PW_DIR/.samhain_file 138 } 139 140 testrun1b_nogpg () 141 { 142 BUILDOPTS="$1" 143 # 144 # test standalone compilation 145 # 146 [ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; } 147 # 148 if test -r "Makefile"; then 149 $MAKE distclean >/dev/null >&1 150 fi 151 152 ${TOP_SRCDIR}/configure ${BUILDOPTS} 2>/dev/null 153 # 154 # 155 if test x$? = x0; then 156 [ -z "$verbose" ] || log_msg_ok "configure..."; 157 $MAKE > /dev/null 2>&1 158 if test x$? = x0; then 159 [ -z "$verbose" ] || log_msg_ok "make..."; 160 else 161 [ -z "$quiet" ] && log_msg_fail "make..."; 162 return 1 163 fi 164 165 else 166 [ -z "$quiet" ] && log_msg_fail "configure..."; 167 return 1 168 fi 169 170 rm -f ./.samhain_file 171 rm -f ./.samhain_log 172 rm -f ./.samhain_lock 173 174 cp "${SCRIPTDIR}/testrc_1" "${RCFILE}" 175 176 ./samhain -t init -p none -l info 177 178 if test x$? = x0; then 179 [ -z "$verbose" ] || log_msg_ok "init..."; 180 else 181 [ -z "$quiet" ] && log_msg_fail "init..."; 182 return 1 183 fi 184 138 185 } 139 186 … … 316 363 fi 317 364 fi 365 366 # 367 # ------------- sixth test ------------- 368 # 369 if test -f /usr/local/lib/libprelude.so 370 then 371 LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" 372 export LD_LIBRARY_PATH 373 fi 374 # 375 PM=`find_path prelude-manager` 376 if [ -z "$PM" ]; then 377 log_skip 6 $MAXTEST 'prelude-manager not found in $PATH' 378 elif [ -z "$doall" ]; then 379 log_skip 6 $MAXTEST 'logging to prelude (or use --really-all)' 380 else 381 BUILDOPTS="--quiet $TRUST --with-prelude --enable-login-watch --enable-mounts-check --enable-process-check --enable-port-check --enable-suidcheck --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file" 382 testrun1b_nogpg "${BUILDOPTS} CFLAGS=-DSH_NOFAILOVER=1" 383 do_test_1b_2 384 if [ $? -eq 0 ]; then 385 log_ok 6 $MAXTEST 'logging to prelude' 386 else 387 log_fail 6 $MAXTEST 'logging to prelude' 388 fi 389 fi 390 318 391 fi 319 392 fi -
trunk/test/testrun_1d.sh
r85 r169 197 197 proc_psarg () 198 198 { 199 OS=`uname - o`199 OS=`uname -s` 200 200 case $OS in 201 201 *Linux*|*linux*) 202 202 PSARG="-eT";; 203 *OpenBSD*) 204 PSARG="akx";; 203 205 *) 204 206 PS=`proc_pspath`
Note:
See TracChangeset
for help on using the changeset viewer.