Changeset 30 for trunk/test
- Timestamp:
- Apr 27, 2006, 10:40:32 PM (19 years ago)
- Location:
- trunk/test
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/test.sh
r29 r30 19 19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 20 # 21 22 # ----------------------------------------------------------------------- 23 # Be Bourne compatible 24 # ----------------------------------------------------------------------- 25 26 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 27 emulate sh 28 NULLCMD=: 29 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then 30 set -o posix 31 fi 32 33 # ----------------------------------------------------------------------- 34 # Make sure we support functions (from the autoconf manual) 35 # ----------------------------------------------------------------------- 36 37 TSHELL="${TSHELL-/bin/sh}" 38 if test x"$1" = "x--re-executed" 39 then 40 shift 41 elif "$TSHELL" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1 42 then 43 : 44 else 45 for cmd in sh bash ash bsh ksh zsh sh5; do 46 X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin"; 47 OLD_IFS=${IFS} 48 IFS=':'; export IFS 49 for dir in $X; do 50 shell="$dir/$cmd" 51 if (test -f "$shell" || test -f "$shell.exe") 52 then 53 if "$shell" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1 54 then 55 TSHELL="$shell"; export TSHELL 56 IFS=${OLD_IFS}; export IFS 57 exec "$shell" "$0" --re-executed ${1+"$@"} 58 fi 59 fi 60 done 61 IFS=${OLD_IFS}; export IFS 62 done 63 echo "-----------------------------------------------------------------" 64 echo "ERROR: Unable to locate a shell interpreter with function support" >&2 65 echo "-----------------------------------------------------------------" 66 { (exit 1); exit 1; } 67 fi 68 69 # ----------------------------------------------------------------------- 70 # Make sure we support 'let' (from the autoconf manual) 71 # ----------------------------------------------------------------------- 72 73 TSHELL="${TSHELL-/bin/sh}" 74 if test x"$1" = "x--re-run" 75 then 76 shift 77 elif "$TSHELL" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1 78 then 79 : 80 else 81 for cmd in sh bash ash bsh ksh zsh sh5; do 82 X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin"; 83 OLD_IFS=${IFS} 84 IFS=':'; export IFS 85 for dir in $X; do 86 shell="$dir/$cmd" 87 if (test -f "$shell" || test -f "$shell.exe") 88 then 89 if "$shell" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1 90 then 91 if "$shell" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1 92 then 93 TSHELL="$shell"; export TSHELL 94 IFS=${OLD_IFS}; export IFS 95 exec "$shell" "$0" --re-run ${1+"$@"} 96 fi 97 fi 98 fi 99 done 100 IFS=${OLD_IFS}; export IFS 101 done 102 echo "-----------------------------------------------------------------" 103 echo "ERROR: Unable to locate a shell interpreter with support for 'let'" >&2 104 echo "-----------------------------------------------------------------" 105 { (exit 1); exit 1; } 106 fi 107 108 109 umask 0022 21 110 22 111 isok=`test -t 1 2>&1 | wc -c` … … 366 455 tmp="localhost" 367 456 fi 368 echo "$tmp" 457 # 458 # first one is hostname, others are aliases 459 # 460 tmp2=`cat /etc/hosts | egrep "^ *[0123456789].* $tmp" | awk '{ print $2 }'` 461 if [ -z "$tmp2" ]; then 462 echo "$tmp" 463 else 464 echo "$tmp2" 465 fi 369 466 } 370 467 -
trunk/test/testcompile.sh
r29 r30 20 20 # 21 21 22 MAXTEST=56; export MAXTEST 22 MAXTEST=57; export MAXTEST 23 24 run_flawfinder () 25 { 26 flawfinder --minlevel=3 --quiet src/s*.c | \ 27 egrep '^No hits found.' >/dev/null 2>&1 28 if [ $? -eq 0 ]; then 29 [ -z "$quiet" ] && log_ok $2 ${MAXTEST} "$TEST"; 30 else 31 flawfinder --minlevel=3 --quiet src/s*.c >test_log 2>&1 32 [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST"; 33 return 1 34 fi 35 } 23 36 24 37 run_smatch () … … 133 146 134 147 # 148 # test flawfinder 149 # 150 TEST="${S}check w/flawfinder${E}" 151 # 152 # 153 let "num = num + 1" >/dev/null 154 FLAWFINDER=`find_path flawfinder` 155 # 156 if [ -z "$FLAWFINDER" ]; then 157 log_skip $num $MAXTEST 'check w/flawfinder (not in PATH)' 158 else 159 run_flawfinder 0 $num || let "numfail = numfail + 1" >/dev/null 160 fi 161 # 162 163 # 135 164 # test standalone compilation 136 165 # -
trunk/test/testext.sh
r27 r30 58 58 if test x$? = x0; then 59 59 [ -z "$verbose" ] || log_msg_ok "configure..."; 60 $MAKE > /dev/null60 $MAKE >/dev/null 2>>test_log 61 61 if test x$? = x0; then 62 62 [ -z "$verbose" ] || log_msg_ok "make..."; -
trunk/test/testrun_1.sh
r27 r30 82 82 REPLACEMENT='FileCheckScheduleOne = 6 12 * * *' 83 83 ex $RCFILE <<EOF 84 :%s/${ORIGINAL}/${REPLACEMENT}/g85 :wq84 %s/${ORIGINAL}/${REPLACEMENT}/g 85 wq 86 86 EOF 87 87 } … … 865 865 return 1 866 866 fi 867 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` 868 871 if [ $tmp -ne 0 ]; then 869 [ -z "$verbose" ] || log_msg_fail " update not successful(?)";872 [ -z "$verbose" ] || log_msg_fail "errors during check"; 870 873 return 1 871 874 fi … … 889 892 prep_testdata () 890 893 { 891 if [ -d "${BASE}" ]; then 892 chmod -R 0700 "${BASE}" || { 893 [ -z "$quiet" ] && log_msg_fail "chmod -R 0700 ${BASE}"; 894 return 1; 895 } 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 896 901 fi 897 902 … … 947 952 if test x$? = x0; then 948 953 [ -z "$verbose" ] || log_msg_ok "configure..."; 949 $MAKE > /dev/null954 $MAKE >/dev/null 2>>test_log 950 955 if test x$? = x0; then 951 956 [ -z "$verbose" ] || log_msg_ok "make..."; -
trunk/test/testrun_1c.sh
r27 r30 255 255 if test x$? = x0; then 256 256 [ -z "$verbose" ] || log_msg_ok "configure..."; 257 $MAKE 'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' >/dev/null 257 $MAKE 'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' >/dev/null 2>&1 258 258 if test x$? = x0; then 259 259 [ -z "$verbose" ] || log_msg_ok "make..."; -
trunk/test/testrun_2.sh
r29 r30 138 138 REPLACEMENT="UseSeparateLogs=yes" 139 139 ex $RCFILE <<EOF 140 :%s/$ORIGINAL/$REPLACEMENT/g141 :wq140 %s/$ORIGINAL/$REPLACEMENT/g 141 wq 142 142 EOF 143 143 # :%s is the "ex" substitution command. … … 182 182 CLIENTLOG="${LOGFILE}.${remhost}" 183 183 else 184 CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -n 1` 184 tail -n 1 ${SCRIPTDIR}/test.sh >/dev/null 2>&1 185 if [ $? -eq 0 ]; then 186 CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -n 1` 187 else 188 CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -1` 189 fi 185 190 fi 186 191 … … 235 240 REPLACEMENT_4="SetClientTimeLimit=20" 236 241 ex $RCFILE <<EOF 237 :%s/${ORIGINAL_1}/${REPLACEMENT_1}/g238 :%s/${ORIGINAL_2}/${REPLACEMENT_2}/g239 :%s/${ORIGINAL_3}/${REPLACEMENT_3}/g240 :%s/${ORIGINAL_4}/${REPLACEMENT_4}/g241 :wq242 %s/${ORIGINAL_1}/${REPLACEMENT_1}/g 243 %s/${ORIGINAL_2}/${REPLACEMENT_2}/g 244 %s/${ORIGINAL_3}/${REPLACEMENT_3}/g 245 %s/${ORIGINAL_4}/${REPLACEMENT_4}/g 246 wq 242 247 EOF 243 248 # :%s is the "ex" substitution command. … … 336 341 REPLACEMENT_1="SetSocketAllowUid=$me" 337 342 ex $RCFILE <<EOF 338 :%s/${ORIGINAL_1}/${REPLACEMENT_1}/g339 :wq343 %s/${ORIGINAL_1}/${REPLACEMENT_1}/g 344 wq 340 345 EOF 341 346 … … 435 440 436 441 kill ${PROC_Y} 442 sleep 2 443 kill -9 ${PROC_Y} >/dev/null 2>&1 437 444 438 445 [ -z "$VALGRIND" ] || { … … 633 640 # 634 641 cp samhain samhain.build || return 1 635 makeclean >/dev/null || return 1642 $MAKE clean >/dev/null || return 1 636 643 637 644 ${TOP_SRCDIR}/configure --quiet $TRUST --enable-debug --enable-network=server --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=${RCFILE}2 --with-log-file=${LOGFILE}2 --with-pid-file=$PW_DIR/.samhain_lock2 --with-html-file=${HTML}2 --with-state-dir=$PW_DIR --enable-encrypt=2 --with-port=49778 … … 655 662 # 656 663 cp yule yule.2 || return 1 657 makeclean >/dev/null || return 1664 $MAKE clean >/dev/null || return 1 658 665 659 666 ${TOP_SRCDIR}/configure --quiet $TRUST --enable-debug --enable-network=server --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-html-file=$HTML --with-state-dir=$PW_DIR --enable-encrypt=2 -
trunk/test/testrun_2a.sh
r29 r30 25 25 SERVER_BUILDOPTS="--quiet $TRUST --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export SERVER_BUILDOPTS 26 26 27 CLIENT_BUILDOPTS="--quiet $TRUST --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR -- localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$RCFILE --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS27 CLIENT_BUILDOPTS="--quiet $TRUST --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$RCFILE --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS 28 28 29 29 do_test_1_a () { … … 131 131 # 132 132 cp samhain samhain.build || return 1 133 makeclean >/dev/null || return 1133 $MAKE clean >/dev/null || return 1 134 134 135 135 ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS} -
trunk/test/testrun_2b.sh
r29 r30 26 26 SERVER_BUILDOPTS="--quiet $TRUST --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export SERVER_BUILDOPTS 27 27 28 CLIENT_BUILDOPTS="--quiet $TRUST --enable-micro-stealth=137 --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR -- localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER${RCFILE_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS28 CLIENT_BUILDOPTS="--quiet $TRUST --enable-micro-stealth=137 --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER${RCFILE_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS 29 29 30 30 testrun2b_internal () … … 80 80 81 81 cp samhain samhain.build || return 1 82 makeclean >/dev/null || return 182 $MAKE clean >/dev/null || return 1 83 83 84 84 ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS} -
trunk/test/testrun_2c.sh
r27 r30 22 22 SERVER_BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=mysql"; export SERVER_BUILDOPTS 23 23 24 CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR -- localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS24 CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS 25 25 26 26 check_mysql_log () { … … 92 92 REPLACEMENT="DatabaseSeverity=info" 93 93 ex $RCFILE <<EOF 94 :%s/$ORIGINAL/$REPLACEMENT/g95 :wq94 %s/$ORIGINAL/$REPLACEMENT/g 95 wq 96 96 EOF 97 97 # -
trunk/test/testrun_2d.sh
r27 r30 22 22 SERVER_BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=postgresql"; export SERVER_BUILDOPTS 23 23 24 CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR -- localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS24 CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS 25 25 26 26 check_psql_log () { … … 94 94 REPLACEMENT="DatabaseSeverity=info" 95 95 ex $RCFILE <<EOF 96 :%s/$ORIGINAL/$REPLACEMENT/g97 :wq96 %s/$ORIGINAL/$REPLACEMENT/g 97 wq 98 98 EOF 99 99 # -
trunk/test/testtimesrv.sh
r27 r30 30 30 prep_testdata () 31 31 { 32 chmod -R 0700 "${BASE}" || { 33 [ -z "$quiet" ] && log_msg_fail "chmod -R 0700 ${BASE}"; 34 return 1; 35 } 32 if test -d "$BASE"; then 33 chmod -R 0700 "${BASE}" || { 34 [ -z "$quiet" ] && log_msg_fail "chmod -R 0700 ${BASE}"; 35 return 1; 36 } 37 fi 36 38 37 39 rm -rf "${BASE}" || { … … 140 142 # standalone compilation 141 143 # 142 [ -z "$verbose" ] || { echo; echo "${S}Building standalone agent w/timeserver${E}"; echo; }144 [ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; } 143 145 # 144 146 if test -r "Makefile"; then … … 150 152 if test x$? = x0; then 151 153 [ -z "$verbose" ] || log_msg_ok "configure..."; 152 $MAKE > /dev/null 154 $MAKE > /dev/null 2>>test_log 153 155 if test x$? = x0; then 154 156 [ -z "$verbose" ] || log_msg_ok "make...";
Note:
See TracChangeset
for help on using the changeset viewer.