Changes in trunk/test/test.sh [19:30]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/test.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 # 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 2 110 3 111 isok=`test -t 1 2>&1 | wc -c` … … 40 148 echo " ${S}test.sh 6${E} -- Controlling the daemon" 41 149 echo " ${S}test.sh 7${E} -- GnuPG signed files / prelude log" 150 echo " ${S}test.sh 8${E} -- Suidcheck" 42 151 43 152 echo " ${S}test.sh 10${E} -- Test c/s init/check (testrc_2.in)" … … 46 155 echo " ${S}test.sh 13${E} -- Test full c/s w/mysql (testrc_2.in)" 47 156 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 157 echo " ${S}test.sh all${E} -- All tests" 158 } 159 scripts () { 50 160 echo 51 echo "Scripts used by tests (located in ${SCRIPTDIR}):"161 echo "Scripts used by tests:" 52 162 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" 163 echo " (5) testext.sh (6) testtimesrv.sh (7) testrun_1b.sh (8) testrun_1c.sh" 164 echo " (10) testrun_2.sh (11) testrun_2a.sh (12) testrun_2b.sh (13) testrun_2c.sh" 165 echo " (14) testrun_2d.sh" 55 166 } 56 167 … … 64 175 cleanup=on 65 176 doall= 177 usevalgrind= 66 178 67 179 while [ $# -gt 0 ] … … 69 181 case "$1" in 70 182 -h|--help) usage; exit 0;; 183 --scripts) usage; scripts; exit 0;; 71 184 -v|--verbose) verbose=on; quiet= ;; 72 185 -q|--quiet) quiet=on; verbose= ;; … … 74 187 --no-cleanup) cleanup= ;; 75 188 --really-all) doall=on;; 189 --valgrind) usevalgrind=on;; 76 190 --srcdir=*) TOP_SRCDIR=`echo $1 | sed s,--srcdir=,,`; export TOP_SRCDIR;; 77 191 --color=*) … … 160 274 161 275 PW_DIR=`pwd`; export PW_DIR 276 277 # 278 # group/world writeable will cause problems 279 # 280 chmod go-w . 162 281 # 163 282 # … … 282 401 rm -f testrc_1.dyn 283 402 rm -f testrc_2 403 rm -f testrc_22 284 404 rm -f ./.samhain_file 285 405 rm -f ./.samhain_log* 286 rm -f ./.samhain_lock 287 test -d testrun_data && chmod -R 0700 testrun_data 288 rm -rf testrun_data 406 rm -f ./.samhain_lock* 407 test -d testrun_testdata && chmod -R 0700 testrun_testdata 408 test -d .quarantine && rm -rf .quarantine 409 rm -rf testrun_testdata 289 410 rm -f test_log_db 290 411 rm -f test_log_prelude 412 rm -f test_log_valgrind* 413 rm -f test_log_yulectl 414 rm -f yule.html 415 rm -f yule.html2 291 416 } 292 417 … … 330 455 tmp="localhost" 331 456 fi 332 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 333 466 } 334 467 … … 341 474 hostname="127.0.0.1" 342 475 fi 476 477 # Seems that 'valgrind' causes random hangs :-( 478 # 479 if [ -z "$usevalgrind" ]; then 480 VALGRIND= 481 else 482 VALGRIND=`find_path valgrind`; 483 fi 484 [ -z "$VALGRIND" ] || { 485 VALGRIND="$VALGRIND --quiet --tool=memcheck --suppressions=.test.supp"; 486 export VALGRIND; 487 [ -z "$verbose" ] || log_msg_ok "using valgrind" 488 cat > ".test.supp" <<End-of-data 489 # 490 # there are unitialized bytes in the struct... 491 # 492 { 493 pushdata_01 494 Memcheck:Param 495 write(buf) 496 obj:/lib/ld-*.so 497 fun:sh_hash_pushdata 498 fun:sh_files_filecheck 499 fun:sh_dirs_chk 500 } 501 { 502 pushdata_02 503 Memcheck:Param 504 write(buf) 505 obj:/lib/ld-*.so 506 fun:sh_hash_pushdata 507 fun:sh_files_filecheck 508 fun:sh_files_checkdir 509 } 510 { 511 pushdata_03 512 Memcheck:Param 513 write(buf) 514 obj:/lib/ld-*.so 515 fun:sh_hash_pushdata 516 fun:sh_hash_writeout 517 fun:main 518 } 519 520 End-of-data 521 } 343 522 344 523 if test x$1 = x1; then … … 385 564 exit $? 386 565 fi 566 if test x$1 = x8; then 567 . ${SCRIPTDIR}/testrun_1.sh 568 . ${SCRIPTDIR}/testrun_1c.sh 569 testrun1c 570 print_summary 571 exit $? 572 fi 387 573 if test x$1 = x10; then 388 574 . ${SCRIPTDIR}/testrun_2.sh … … 434 620 . ${SCRIPTDIR}/testrun_1b.sh 435 621 let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null 622 . ${SCRIPTDIR}/testrun_1c.sh 623 let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null 436 624 . ${SCRIPTDIR}/testrun_2.sh 437 625 let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null … … 471 659 MAXTEST=${TEST_MAX}; export MAXTEST 472 660 testrun1b 661 # 662 . ${SCRIPTDIR}/testrun_1.sh 663 . ${SCRIPTDIR}/testrun_1c.sh 664 MAXTEST=${TEST_MAX}; export MAXTEST 665 testrun1c 473 666 # 474 667 . ${SCRIPTDIR}/testrun_2.sh
Note:
See TracChangeset
for help on using the changeset viewer.