Changeset 22 for trunk/test
- Timestamp:
- Feb 23, 2006, 12:03:58 AM (19 years ago)
- Location:
- trunk/test
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/test.sh
r19 r22 40 40 echo " ${S}test.sh 6${E} -- Controlling the daemon" 41 41 echo " ${S}test.sh 7${E} -- GnuPG signed files / prelude log" 42 echo " ${S}test.sh 8${E} -- Suidcheck" 42 43 43 44 echo " ${S}test.sh 10${E} -- Test c/s init/check (testrc_2.in)" … … 46 47 echo " ${S}test.sh 13${E} -- Test full c/s w/mysql (testrc_2.in)" 47 48 echo " ${S}test.sh 14${E} -- Test full c/s w/postgres (testrc_2.in)" 48 echo " ${S}test.sh all${E} -- All except 12+" 49 49 echo " ${S}test.sh all${E} -- All tests" 50 } 51 scripts () { 50 52 echo 51 echo "Scripts used by tests (located in ${SCRIPTDIR}):"53 echo "Scripts used by tests:" 52 54 echo " (1) testcompile.sh (2) testhash.sh (3) testrun_1.sh (4) testrun_1a.sh" 53 echo " (5) testext.sh (6) testtimesrv.sh (7) testrun_1b.sh (10) testrun_2.sh" 54 echo " (11) testrun_2a.sh (12) testrun_2b.sh (13) testrun_2c.sh (14) testrun_2d.sh" 55 echo " (5) testext.sh (6) testtimesrv.sh (7) testrun_1b.sh (8) testrun_1c.sh" 56 echo " (10) testrun_2.sh (11) testrun_2a.sh (12) testrun_2b.sh (13) testrun_2c.sh" 57 echo " (14) testrun_2d.sh" 55 58 } 56 59 … … 64 67 cleanup=on 65 68 doall= 69 usevalgrind= 66 70 67 71 while [ $# -gt 0 ] … … 69 73 case "$1" in 70 74 -h|--help) usage; exit 0;; 75 --scripts) usage; scripts; exit 0;; 71 76 -v|--verbose) verbose=on; quiet= ;; 72 77 -q|--quiet) quiet=on; verbose= ;; … … 74 79 --no-cleanup) cleanup= ;; 75 80 --really-all) doall=on;; 81 --valgrind) usevalgrind=on;; 76 82 --srcdir=*) TOP_SRCDIR=`echo $1 | sed s,--srcdir=,,`; export TOP_SRCDIR;; 77 83 --color=*) … … 285 291 rm -f ./.samhain_log* 286 292 rm -f ./.samhain_lock 287 test -d testrun_data && chmod -R 0700 testrun_data 288 rm -rf testrun_data 293 test -d testrun_testdata && chmod -R 0700 testrun_testdata 294 test -d .quarantine && rm -rf .quarantine 295 rm -rf testrun_testdata 289 296 rm -f test_log_db 290 297 rm -f test_log_prelude 298 rm -f test_log_valgrind 299 rm -f test_log_yulectl 300 rm -f yule.html 291 301 } 292 302 … … 342 352 fi 343 353 354 # Seems that 'valgrind' causes random hangs :-( 355 # 356 if [ -z "$usevalgrind" ]; then 357 VALGRIND= 358 else 359 VALGRIND=`find_path valgrind`; 360 fi 361 [ -z "$VALGRIND" ] || { 362 VALGRIND="$VALGRIND --quiet --tool=memcheck --suppressions=.test.supp"; 363 export VALGRIND; 364 [ -z "$verbose" ] || log_msg_ok "using valgrind" 365 cat > ".test.supp" <<End-of-data 366 # 367 # there are unitialized bytes in the struct... 368 # 369 { 370 pushdata_01 371 Memcheck:Param 372 write(buf) 373 obj:/lib/ld-*.so 374 fun:sh_hash_pushdata 375 fun:sh_files_filecheck 376 fun:sh_dirs_chk 377 } 378 { 379 pushdata_02 380 Memcheck:Param 381 write(buf) 382 obj:/lib/ld-*.so 383 fun:sh_hash_pushdata 384 fun:sh_files_filecheck 385 fun:sh_files_checkdir 386 } 387 { 388 pushdata_03 389 Memcheck:Param 390 write(buf) 391 obj:/lib/ld-*.so 392 fun:sh_hash_pushdata 393 fun:sh_hash_writeout 394 fun:main 395 } 396 397 End-of-data 398 } 399 344 400 if test x$1 = x1; then 345 401 . ${SCRIPTDIR}/testcompile.sh … … 385 441 exit $? 386 442 fi 443 if test x$1 = x8; then 444 . ${SCRIPTDIR}/testrun_1.sh 445 . ${SCRIPTDIR}/testrun_1c.sh 446 testrun1c 447 print_summary 448 exit $? 449 fi 387 450 if test x$1 = x10; then 388 451 . ${SCRIPTDIR}/testrun_2.sh … … 434 497 . ${SCRIPTDIR}/testrun_1b.sh 435 498 let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null 499 . ${SCRIPTDIR}/testrun_1c.sh 500 let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null 436 501 . ${SCRIPTDIR}/testrun_2.sh 437 502 let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null … … 471 536 MAXTEST=${TEST_MAX}; export MAXTEST 472 537 testrun1b 538 # 539 . ${SCRIPTDIR}/testrun_1.sh 540 . ${SCRIPTDIR}/testrun_1c.sh 541 MAXTEST=${TEST_MAX}; export MAXTEST 542 testrun1c 473 543 # 474 544 . ${SCRIPTDIR}/testrun_2.sh -
trunk/test/testcompile.sh
r19 r22 1 1 #! /bin/sh 2 2 3 MAXTEST=28; export MAXTEST 3 MAXTEST=56; export MAXTEST 4 5 run_smatch () 6 { 7 export CDIR=`pwd`; 8 9 if [ -z "$doall" ]; then 10 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)"; 11 return 0 12 fi 13 14 if [ "x$3" = "xdebug" ]; then memcheck=debug; else memcheck=simple; fi 15 if [ -f ../sm_scripts/smatch.pm ]; then 16 ( 17 cd ../sm_scripts; 18 19 for i in ${CDIR}/*.c.sm ; do 20 # echo $i; 21 cat $i | ./unreached_code.pl; 22 cat $i | ./ampersand_missing.sh; 23 cat $i | ./uninitialized.pl; 24 cat $i | ./eqeq.pl; 25 cat $i | ./for_bounds.pl; 26 cat $i | ./unchecked_returns.pl; 27 cat $i | ./unreached_code.pl; 28 cat $i | ./uninitialized.pl; 29 # from http://people.redhat.com/mstefani/wine/smatch/ 30 if [ -f ./while_for_check.pl ]; then 31 cat $i | ./while_for_check.pl; 32 fi 33 # --> end wine <-- 34 # samhain specific 35 if [ $memcheck = xsimple ]; then 36 if [ -f ./samhain_unfree.pl ]; then 37 cat $i | ./samhain_unfree.pl | \ 38 egrep -v 'x_cutest_.*Test_' | \ 39 egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 40 fi 41 fi 42 if [ $memcheck = xdebug ]; then 43 if [ -f ./samhain_unfree_debug.pl ]; then 44 cat $i | ./samhain_unfree_debug.pl | \ 45 egrep -v 'x_cutest_.*Test_' | \ 46 egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 47 fi 48 fi 49 # --> end samhain specific <-- 50 #cat $i | ./unfree.pl | \ 51 # egrep -v 'x_cutest_.*Test_' | \ 52 # grep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 53 touch list_null_funcs_uniq; 54 cat $i | ./deference_check.pl; 55 rm -f list_null_funcs_uniq; 56 rm -f $i 57 done 58 ) >test_log_smatch 2>&1 59 if [ -f test_log_smatch ]; then 60 lines=`cat test_log_smatch | wc -l` 61 if [ $lines -ne 0 ]; then 62 cat test_log_smatch 63 rm -f test_log_smatch 64 [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST (smatch)"; 65 return 1 66 fi 67 fi 68 [ -z "$quiet" ] && log_ok $2 ${MAXTEST} "$TEST (smatch)"; 69 return 0 70 fi 71 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)"; 72 return 0 73 } 4 74 5 75 testmake () … … 8 78 if test x$1 = x0; then 9 79 [ -z "$verbose" ] || log_msg_ok "configure... $TEST"; 10 $MAKE cutest > /dev/null 2>> test_log80 $MAKE ${SMATCH} cutest > /dev/null 2>> test_log 11 81 if test x$? = x0; then 12 82 [ -z "$verbose" ] || log_msg_ok "make cutest... $TEST"; … … 34 104 log_start "COMPILE" 35 105 106 if [ -f /usr/local/gcc-smatch/bin/gcc ]; then 107 SAVE_CC="${CC}" 108 SMATCH="DBGDEF=--smatch"; export SMATCH 109 CC="/usr/local/gcc-smatch/bin/gcc"; export CC 110 fi 111 36 112 num=0 37 113 numfail=0 … … 40 116 # test standalone compilation 41 117 # 42 TEST="${S}standalone agentw/suidcheck${E}"118 TEST="${S}standalone w/suidcheck${E}" 43 119 # 44 120 if test -r "Makefile"; then … … 50 126 let "num = num + 1" >/dev/null 51 127 testmake $? $num || let "numfail = numfail + 1" >/dev/null 128 let "num = num + 1" >/dev/null 129 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 52 130 53 131 # 54 132 # test standalone compilation 55 133 # 56 TEST="${S}standalone agent w/mounts-check andw/userfiles${E}"134 TEST="${S}standalone w/mounts-check w/userfiles${E}" 57 135 # 58 136 if test -r "Makefile"; then … … 64 142 let "num = num + 1" >/dev/null 65 143 testmake $? $num || let "numfail = numfail + 1" >/dev/null 144 let "num = num + 1" >/dev/null 145 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 66 146 67 147 … … 69 149 # test standalone compilation 70 150 # 71 TEST="${S}standalone agent w/timeserver and w/message-queue${E}"151 TEST="${S}standalone w/timeserver and w/msgqueue${E}" 72 152 # 73 153 if test -r "Makefile"; then … … 79 159 let "num = num + 1" >/dev/null 80 160 testmake $? $num || let "numfail = numfail + 1" >/dev/null 161 let "num = num + 1" >/dev/null 162 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 81 163 82 164 # 83 165 # test standalone compilation with --with-nocl=PW 84 166 # 85 TEST="${S}standalone agentw/nocl${E}"167 TEST="${S}standalone w/nocl${E}" 86 168 # 87 169 if test -r "Makefile"; then … … 93 175 let "num = num + 1" >/dev/null 94 176 testmake $? $num || let "numfail = numfail + 1" >/dev/null 177 let "num = num + 1" >/dev/null 178 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 95 179 96 180 # 97 181 # test standalone compilation w/ debug 98 182 # 99 TEST="${S}standalone agentw/debug${E}"183 TEST="${S}standalone w/debug${E}" 100 184 # 101 185 if test -r "Makefile"; then … … 107 191 let "num = num + 1" >/dev/null 108 192 testmake $? $num || let "numfail = numfail + 1" >/dev/null 193 let "num = num + 1" >/dev/null 194 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 109 195 110 196 # 111 197 # test standalone compilation w/ gpg 112 198 # 113 TEST="${S}standalone agentw/gpg${E}"199 TEST="${S}standalone w/gpg${E}" 114 200 # 115 201 GPG=`find_path gpg` … … 126 212 # 127 213 testmake $? $num || let "numfail = numfail + 1" >/dev/null 214 let "num = num + 1" >/dev/null 215 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 128 216 fi 129 217 … … 131 219 # test standalone compilation w/stealth 132 220 # 133 TEST="${S}standalone agentw/stealth${E}"221 TEST="${S}standalone w/stealth${E}" 134 222 # 135 223 if test -r "Makefile"; then … … 141 229 let "num = num + 1" >/dev/null 142 230 testmake $? $num || let "numfail = numfail + 1" >/dev/null 231 let "num = num + 1" >/dev/null 232 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 143 233 144 234 # 145 235 # test standalone compilation w/logwatch 146 236 # 147 TEST="${S}standalone agentw/login-watch${E}"237 TEST="${S}standalone w/login-watch${E}" 148 238 # 149 239 if test -r "Makefile"; then … … 155 245 let "num = num + 1" >/dev/null 156 246 testmake $? $num || let "numfail = numfail + 1" >/dev/null 247 let "num = num + 1" >/dev/null 248 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 157 249 158 250 # 159 251 # test standalone compilation w/mysql 160 252 # 161 TEST="${S}standalone agentw/mysql${E}"253 TEST="${S}standalone w/mysql${E}" 162 254 # 163 255 if test -r "Makefile"; then … … 169 261 let "num = num + 1" >/dev/null 170 262 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 263 let "num = num + 1" >/dev/null 264 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 171 265 172 266 # 173 267 # test standalone compilation w/postgresql 174 268 # 175 TEST="${S}standalone agentw/postgresql${E}"269 TEST="${S}standalone w/postgresql${E}" 176 270 # 177 271 if test -r "Makefile"; then … … 183 277 let "num = num + 1" >/dev/null 184 278 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 279 let "num = num + 1" >/dev/null 280 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 185 281 186 282 # 187 283 # test standalone compilation 188 284 # 189 TEST="${S}standalone agentw/o mail${E}"285 TEST="${S}standalone w/o mail${E}" 190 286 # 191 287 if test -r "Makefile"; then … … 197 293 let "num = num + 1" >/dev/null 198 294 testmake $? $num || let "numfail = numfail + 1" >/dev/null 295 let "num = num + 1" >/dev/null 296 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 199 297 200 298 # 201 299 # test standalone compilation 202 300 # 203 TEST="${S}standalone agent w/o external scripts${E}"301 TEST="${S}standalone w/o external${E}" 204 302 # 205 303 if test -r "Makefile"; then … … 211 309 let "num = num + 1" >/dev/null 212 310 testmake $? $num || let "numfail = numfail + 1" >/dev/null 311 let "num = num + 1" >/dev/null 312 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 213 313 214 314 # echo; echo "${S}__ TEST CLIENT/SERVER __${E}"; echo; … … 227 327 let "num = num + 1" >/dev/null 228 328 testmake $? $num || let "numfail = numfail + 1" >/dev/null 329 let "num = num + 1" >/dev/null 330 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 229 331 230 332 if test -r "Makefile"; then … … 236 338 let "num = num + 1" >/dev/null 237 339 testmake $? $num || let "numfail = numfail + 1" >/dev/null 340 let "num = num + 1" >/dev/null 341 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 238 342 239 343 # … … 257 361 # 258 362 testmake $? $num || let "numfail = numfail + 1" >/dev/null 363 let "num = num + 1" >/dev/null 364 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 259 365 # 260 366 if test -r "Makefile"; then … … 266 372 let "num = num + 1" >/dev/null 267 373 testmake $? $num || let "numfail = numfail + 1" >/dev/null 374 let "num = num + 1" >/dev/null 375 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 268 376 fi 269 377 … … 282 390 let "num = num + 1" >/dev/null 283 391 testmake $? $num || let "numfail = numfail + 1" >/dev/null 392 let "num = num + 1" >/dev/null 393 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 284 394 # 285 395 if test -r "Makefile"; then … … 291 401 let "num = num + 1" >/dev/null 292 402 testmake $? $num || let "numfail = numfail + 1" >/dev/null 403 let "num = num + 1" >/dev/null 404 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 293 405 294 406 # … … 305 417 let "num = num + 1" >/dev/null 306 418 testmake $? $num || let "numfail = numfail + 1" >/dev/null 419 let "num = num + 1" >/dev/null 420 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 307 421 # 308 422 if test -r "Makefile"; then … … 314 428 let "num = num + 1" >/dev/null 315 429 testmake $? $num || let "numfail = numfail + 1" >/dev/null 430 let "num = num + 1" >/dev/null 431 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 316 432 317 433 # … … 328 444 let "num = num + 1" >/dev/null 329 445 testmake $? $num || let "numfail = numfail + 1" >/dev/null 446 let "num = num + 1" >/dev/null 447 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 330 448 # 331 449 if test -r "Makefile"; then … … 337 455 let "num = num + 1" >/dev/null 338 456 testmake $? $num || let "numfail = numfail + 1" >/dev/null 457 let "num = num + 1" >/dev/null 458 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 339 459 340 460 # … … 351 471 let "num = num + 1" >/dev/null 352 472 testmake $? $num || let "numfail = numfail + 1" >/dev/null 473 let "num = num + 1" >/dev/null 474 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 353 475 # 354 476 if test -r "Makefile"; then … … 360 482 let "num = num + 1" >/dev/null 361 483 testmake $? $num || let "numfail = numfail + 1" >/dev/null 484 let "num = num + 1" >/dev/null 485 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 362 486 363 487 # … … 374 498 let "num = num + 1" >/dev/null 375 499 testmake $? $num || let "numfail = numfail + 1" >/dev/null 500 let "num = num + 1" >/dev/null 501 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 376 502 # 377 503 if test -r "Makefile"; then … … 383 509 let "num = num + 1" >/dev/null 384 510 testmake $? $num || let "numfail = numfail + 1" >/dev/null 511 let "num = num + 1" >/dev/null 512 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 385 513 386 514 # 387 515 # test client/server compilation 388 516 # 389 TEST="${S}client/server application w/o external scripts${E}"517 TEST="${S}client/server application w/o external${E}" 390 518 # 391 519 if test -r "Makefile"; then … … 397 525 let "num = num + 1" >/dev/null 398 526 testmake $? $num || let "numfail = numfail + 1" >/dev/null 527 let "num = num + 1" >/dev/null 528 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 399 529 # 400 530 if test -r "Makefile"; then … … 406 536 let "num = num + 1" >/dev/null 407 537 testmake $? $num || let "numfail = numfail + 1" >/dev/null 538 let "num = num + 1" >/dev/null 539 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 540 541 [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; } 408 542 409 543 log_end "COMPILE" -
trunk/test/testext.sh
r19 r22 79 79 rm -f $PW_DIR/pdbg.child 80 80 rm -f $PW_DIR/pdbg.main 81 ./samhain -p none 81 ./samhain -p none 82 82 83 83 # The shell is too fast ... -
trunk/test/testrc_2.in
r19 r22 130 130 131 131 SetUseSocket = yes 132 SetSocketAllowUid=0 133 SetSocketPassword=samhain 132 134 133 135 SetClientFromAccept = yes -
trunk/test/testrun_1.sh
r19 r22 749 749 run_init () 750 750 { 751 ./samhain -t init -p none 751 rm -f test_log_valgrind 752 753 ${VALGRIND} ./samhain -t init -p none 2>>test_log_valgrind 752 754 753 755 if test x$? = x0; then … … 761 763 run_check () 762 764 { 763 ./samhain -t check -p none -l debug765 ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind 764 766 765 767 if test x$? = x0; then … … 778 780 run_update () 779 781 { 780 ./samhain -t update -p none -l debug782 ${VALGRIND} ./samhain -t update -p none -l debug 2>>test_log_valgrind 781 783 782 784 if test x$? = x0; then … … 792 794 rm -rf $LOGFILE 793 795 794 ./samhain -t check -p none -l debug796 ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind 795 797 796 798 if test x$? = x0; then … … 807 809 fi 808 810 # 811 [ -z "$VALGRIND" ] || { 812 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 813 if [ $tmp -ne 0 ]; then 814 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 815 cat test_log_valgrind 816 return 1; 817 fi; 818 } 819 # 809 820 [ -z "$verbose" ] || log_msg_ok "check(2)..."; 810 821 else … … 816 827 prep_testdata () 817 828 { 818 chmod -R 0700 "${BASE}" || { 819 [ -z "$quiet" ] && log_msg_fail "chmod -R 0700 ${BASE}"; 820 return 1; 821 } 829 if [ -d "${BASE}" ]; then 830 chmod -R 0700 "${BASE}" || { 831 [ -z "$quiet" ] && log_msg_fail "chmod -R 0700 ${BASE}"; 832 return 1; 833 } 834 fi 822 835 823 836 rm -rf "${BASE}" || { -
trunk/test/testrun_1b.sh
r20 r22 15 15 # 16 16 if test -r "Makefile"; then 17 $MAKE distclean >/dev/null 17 $MAKE distclean >/dev/null >&1 18 18 fi 19 19 # … … 24 24 if test x$? = x0; then 25 25 [ -z "$verbose" ] || log_msg_ok "configure..."; 26 $MAKE > /dev/null 26 $MAKE > /dev/null 2>&1 27 27 if test x$? = x0; then 28 28 [ -z "$verbose" ] || log_msg_ok "make..."; -
trunk/test/testrun_2.sh
r19 r22 3 3 LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE 4 4 RCFILE="$PW_DIR/testrc_2"; export RCFILE 5 HTML="$PW_DIR/yule.html"; export HTML 5 6 6 7 … … 12 13 echo; 13 14 } 14 ./yule -l info -p none >/dev/null 2>&1 & 15 16 rm -f test_log_valgrind 17 18 ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind & 15 19 PROC_Y=$! 16 20 sleep 5 … … 22 26 } 23 27 24 ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>&128 ${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind 25 29 if test x$? = x0; then 26 30 [ -z "$verbose" ] || log_msg_ok "samhain.new -t check"; … … 59 63 return 1 60 64 fi 61 65 66 [ -z "$VALGRIND" ] || { 67 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 68 if [ $tmp -ne 0 ]; then 69 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 70 cat test_log_valgrind 71 return 1; 72 fi; 73 } 62 74 63 75 return 0 … … 81 93 82 94 rm -f $LOGFILE 83 84 ./yule -l info -p none >/dev/null 2>&1 & 95 rm -f test_log_valgrind 96 97 ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind & 85 98 PROC_Y=$! 86 99 sleep 5 … … 92 105 } 93 106 94 ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>&1107 ${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind 95 108 if test x$? = x0; then 96 109 [ -z "$verbose" ] || log_msg_ok "samhain.new -t check"; … … 112 125 CLIENTLOG="${LOGFILE}.${remhost}" 113 126 else 114 CLIENTLOG=`ls -1 ${LOGFILE}.* | tail -n 1`127 CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -n 1` 115 128 fi 116 129 … … 140 153 return 1 141 154 fi 155 156 [ -z "$VALGRIND" ] || { 157 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 158 if [ $tmp -ne 0 ]; then 159 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 160 cat test_log_valgrind 161 return 1; 162 fi; 163 } 142 164 143 165 rm -f ${LOGFILE}.${remhost} … … 171 193 172 194 rm -f $LOGFILE 173 174 ./yule -p none >/dev/null 2>&1 & 195 rm -f test_log_valgrind 196 197 ${VALGRIND} ./yule -p none >/dev/null 2>>test_log_valgrind & 175 198 PROC_Y=$! 176 199 sleep 5 … … 182 205 } 183 206 184 ./samhain.new -t check -p none -l none --forever --bind-address=127.0.0.1 >/dev/null 2>&1&207 ${VALGRIND} ./samhain.new -t check -p none -l none --forever --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind & 185 208 if test x$? = x0; then 186 209 PROC_S=$! … … 231 254 return 1 232 255 fi 256 257 [ -z "$VALGRIND" ] || { 258 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 259 if [ $tmp -ne 0 ]; then 260 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 261 cat test_log_valgrind 262 return 1; 263 fi; 264 } 233 265 234 rm -f ${LOGFILE} .${remhost}266 rm -f ${LOGFILE} 235 267 return 0 236 268 } 269 270 do_test_4 () { 271 272 # don't know what is supported on the test platform, so 273 # prepare for both (password and socket credential) 274 275 # 'id -u' is posix 276 me=`id -u` 277 278 ORIGINAL_1="SetSocketAllowUid=0" 279 REPLACEMENT_1="SetSocketAllowUid=$me" 280 ex $RCFILE <<EOF 281 :%s/${ORIGINAL_1}/${REPLACEMENT_1}/g 282 :wq 283 EOF 284 285 [ -z "$verbose" ] || { 286 echo; 287 echo "${S}Start Server${E}: ./yule -l info -p none &"; 288 echo; 289 } 290 291 rm -f $LOGFILE 292 rm -f test_log_valgrind 293 294 ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind & 295 PROC_Y=$! 296 sleep 5 297 298 [ -z "$verbose" ] || { 299 echo; 300 echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 301 echo; 302 } 303 304 $MAKE yulectl >/dev/null 305 if [ $? -ne 0 ]; then 306 [ -z "$verbose" ] || log_msg_fail "make yulectl"; 307 kill $PROC_Y 308 return 1 309 fi 310 311 312 ./yulectl -v -c RELOAD foobar1 >test_log_yulectl 2>/dev/null 313 314 if [ $? -ne 0 ]; then 315 YULECTL_PASSWORD=samhain; export YULECTL_PASSWORD 316 ./yulectl -v -c RELOAD foobar1 >test_log_yulectl 317 if [ $? -ne 0 ]; then 318 kill ${PROC_Y} 319 [ -z "$verbose" ] || log_msg_fail "yulectl"; 320 return 1 321 fi 322 fi 323 324 ./yulectl -v -c RELOAD foobar2 >test_yulectl_log 325 326 if [ $? -ne 0 ]; then 327 kill ${PROC_Y} 328 [ -z "$verbose" ] || log_msg_fail "yulectl"; 329 return 1 330 fi 331 332 ./yulectl -v -c RELOAD foobar3 >test_log_yulectl 333 334 if [ $? -ne 0 ]; then 335 kill ${PROC_Y} 336 [ -z "$verbose" ] || log_msg_fail "yulectl"; 337 return 1 338 fi 339 340 ./yulectl -v -c LISTALL dummy >test_log_yulectl 341 342 if [ $? -ne 0 ]; then 343 kill ${PROC_Y} 344 [ -z "$verbose" ] || log_msg_fail "yulectl"; 345 return 1 346 fi 347 348 tmp=`cat test_log_yulectl | grep RELOAD | wc -l` 349 if [ $tmp -ne 3 ]; then 350 kill ${PROC_Y} 351 [ -z "$verbose" ] || log_msg_fail "command confirmation"; 352 return 1 353 fi 354 355 ./yulectl -v -c CANCEL foobar3 >test_log_yulectl 356 357 if [ $? -ne 0 ]; then 358 kill ${PROC_Y} 359 [ -z "$verbose" ] || log_msg_fail "yulectl"; 360 return 1 361 fi 362 363 ./yulectl -v -c LISTALL dummy >test_log_yulectl 364 365 if [ $? -ne 0 ]; then 366 kill ${PROC_Y} 367 [ -z "$verbose" ] || log_msg_fail "yulectl"; 368 return 1 369 fi 370 371 tmp=`cat test_log_yulectl | grep RELOAD | wc -l` 372 if [ $tmp -ne 2 ]; then 373 kill ${PROC_Y} 374 [ -z "$verbose" ] || log_msg_fail "command confirmation"; 375 return 1 376 fi 377 378 kill ${PROC_Y} 379 380 [ -z "$VALGRIND" ] || { 381 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 382 if [ $tmp -ne 0 ]; then 383 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 384 cat test_log_valgrind 385 return 1; 386 fi; 387 } 388 389 return 0 390 } 391 392 do_test_5 () { 393 394 [ -z "$verbose" ] || { 395 echo; 396 echo "${S}Start Server${E}: ./yule -l info -p none &"; 397 echo; 398 } 399 400 ( cat <<EOF 401 <!-- head --> 402 <html><head><title>test</title></head> 403 <body> 404 Current time: %T <br> 405 <table> 406 <!-- ehead --> 407 EOF 408 ) >head.html 409 410 ( cat <<EOF 411 <!-- foot --> 412 </table> 413 </body> 414 <!-- efoot --> 415 EOF 416 ) >foot.html 417 418 ( cat <<EOF 419 <!-- entry --> 420 <tr> 421 <td>%H</td> 422 <td>%S</td> 423 <td>%T</td> 424 </tr> 425 <!-- eentry --> 426 EOF 427 ) >entry.html 428 429 ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind & 430 PROC_Y=$! 431 sleep 5 432 433 egrep '<!-- head -->' $HTML >/dev/null 2>&1 434 if [ $? -ne 0 ]; then 435 rm -f head.html; rm -f foot.html; rm -f entry.html; 436 kill $PROC_Y 437 [ -z "$verbose" ] || log_msg_fail "head.html"; 438 return 1 439 fi 440 441 egrep '<!-- foot -->' $HTML >/dev/null 2>&1 442 if [ $? -ne 0 ]; then 443 rm -f head.html; rm -f foot.html; rm -f entry.html; 444 kill $PROC_Y 445 [ -z "$verbose" ] || log_msg_fail "foot.html"; 446 return 1 447 fi 448 449 [ -z "$verbose" ] || { 450 echo; 451 echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check"; 452 echo; 453 } 454 455 ${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind 456 if test x$? = x0; then 457 [ -z "$verbose" ] || log_msg_ok "samhain.new -t check"; 458 else 459 kill $PROC_Y 460 [ -z "$quiet" ] && log_msg_fail "samhain.new -t check"; 461 return 1 462 fi 463 464 kill $PROC_Y 465 sleep 5 466 467 # rm -f head.html; rm -f foot.html; rm -f entry.html; 468 469 egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1 470 if [ $? -ne 0 ]; then 471 [ -z "$verbose" ] || log_msg_fail "Server start"; 472 return 1 473 fi 474 egrep "NEW CLIENT" $LOGFILE >/dev/null 2>&1 475 if [ $? -ne 0 ]; then 476 [ -z "$verbose" ] || log_msg_fail "Client connect"; 477 return 1 478 fi 479 egrep "remote_host.*Checking.*/bin" $LOGFILE >/dev/null 2>&1 480 if [ $? -ne 0 ]; then 481 [ -z "$verbose" ] || log_msg_fail "Client file check"; 482 return 1 483 fi 484 egrep "remote_host.*EXIT.*Samhain" $LOGFILE >/dev/null 2>&1 485 if [ $? -ne 0 ]; then 486 [ -z "$verbose" ] || log_msg_fail "Client exit"; 487 return 1 488 fi 489 egrep "EXIT.*Yule.*SIGTERM" $LOGFILE >/dev/null 2>&1 490 if [ $? -ne 0 ]; then 491 [ -z "$verbose" ] || log_msg_fail "Server exit"; 492 return 1 493 fi 494 495 egrep '<!-- head -->' $HTML >/dev/null 2>&1 496 if [ $? -ne 0 ]; then 497 [ -z "$verbose" ] || log_msg_fail "head.html"; 498 return 1 499 fi 500 egrep '<!-- ehead -->' $HTML >/dev/null 2>&1 501 if [ $? -ne 0 ]; then 502 [ -z "$verbose" ] || log_msg_fail "head.html"; 503 return 1 504 fi 505 506 egrep '<!-- entry -->' $HTML >/dev/null 2>&1 507 if [ $? -ne 0 ]; then 508 [ -z "$verbose" ] || log_msg_fail "entry.html"; 509 return 1 510 fi 511 egrep '<!-- eentry -->' $HTML >/dev/null 2>&1 512 if [ $? -ne 0 ]; then 513 [ -z "$verbose" ] || log_msg_fail "entry.html"; 514 return 1 515 fi 516 517 egrep '<!-- foot -->' $HTML >/dev/null 2>&1 518 if [ $? -ne 0 ]; then 519 [ -z "$verbose" ] || log_msg_fail "foot.html"; 520 return 1 521 fi 522 egrep '<!-- efoot -->' $HTML >/dev/null 2>&1 523 if [ $? -ne 0 ]; then 524 [ -z "$verbose" ] || log_msg_fail "foot.html"; 525 return 1 526 fi 527 528 [ -z "$VALGRIND" ] || { 529 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 530 if [ $tmp -ne 0 ]; then 531 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 532 cat test_log_valgrind 533 return 1; 534 fi; 535 } 536 537 return 0 538 } 539 237 540 238 541 testrun2_internal () … … 273 576 make clean >/dev/null || return 1 274 577 275 ${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-data-file=$PW_DIR/.samhain_file -- enable-identity=rainer--enable-encrypt=2578 ${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-data-file=$PW_DIR/.samhain_file --with-html-file=$HTML --enable-encrypt=2 276 579 # 277 580 if test x$? = x0; then … … 353 656 do_test_2 354 657 if [ $? -eq 0 ]; then 355 [ -z "$quiet" ] && log_ok 2 ${MAXTEST} "Client logging, sep erate logfiles";356 else 357 [ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Client logging, sep erate logfiles";658 [ -z "$quiet" ] && log_ok 2 ${MAXTEST} "Client logging, separate logfiles"; 659 else 660 [ -z "$quiet" ] && log_fail 2 ${MAXTEST} "Client logging, separate logfiles"; 358 661 fi 359 662 … … 365 668 fi 366 669 670 do_test_4 671 if [ $? -eq 0 ]; then 672 [ -z "$quiet" ] && log_ok 4 ${MAXTEST} "Server command socket"; 673 else 674 [ -z "$quiet" ] && log_fail 4 ${MAXTEST} "Server command socket"; 675 fi 676 677 do_test_5 678 if [ $? -eq 0 ]; then 679 [ -z "$quiet" ] && log_ok 5 ${MAXTEST} "Server status file"; 680 else 681 [ -z "$quiet" ] && log_fail 5 ${MAXTEST} "Server status file"; 682 fi 683 367 684 return $? 368 685 } 369 686 370 MAXTEST= 3; export MAXTEST687 MAXTEST=5; export MAXTEST 371 688 372 689 testrun2 () -
trunk/test/testrun_2a.sh
r19 r22 15 15 echo; 16 16 } 17 ./yule -l info -p none >/dev/null 2>&1 & 17 rm -f test_log_valgrind 18 19 ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind & 18 20 PROC_Y=$! 19 21 sleep 5 … … 25 27 } 26 28 27 ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>&129 ${VALGRIND} ./samhain.new -t check -p none -l none -e info --bind-address=127.0.0.1 >/dev/null 2>>test_log_valgrind 28 30 if test x$? = x0; then 29 31 [ -z "$verbose" ] || log_msg_ok "samhain.new -t check"; … … 63 65 fi 64 66 67 [ -z "$VALGRIND" ] || { 68 tmp=`cat test_log_valgrind 2>/dev/null | wc -l`; 69 if [ $tmp -ne 0 ]; then 70 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors"; 71 cat test_log_valgrind 72 return 1; 73 fi; 74 } 65 75 66 76 return 0 -
trunk/test/testrun_2b.sh
r19 r22 140 140 141 141 ALTHOST=`find_hostname` 142 cp ./testrc_2"./rc.${ALTHOST}"142 cp "${RCFILE_C}" "./rc.${ALTHOST}" 143 143 cp ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null 144 144 } … … 166 166 167 167 testrun2b_internal "$GPG" 168 168 169 SAVE_VALGRIND="${VALGRIND}"; VALGRIND=''; export VALGRIND 169 170 do_test_1_a 171 VALGRIND="${SAVE_VALGRIND}"; export VALGRIND 170 172 if [ $? -eq 0 ]; then 171 173 [ -z "$quiet" ] && log_ok 1 ${MAXTEST} "Client download+logging w/gpg"; -
trunk/test/testrun_2d.sh
r19 r22 80 80 # 81 81 do_test_1_a 82 # 82 83 if [ $? -ne 0 ]; then 83 84 [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/postgresql";
Note:
See TracChangeset
for help on using the changeset viewer.