Changeset 30 for trunk/test


Ignore:
Timestamp:
Apr 27, 2006, 10:40:32 PM (19 years ago)
Author:
rainer
Message:

Release candidate 3 for version 2.2.0

Location:
trunk/test
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test.sh

    r29 r30  
    1919# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    2020#
     21
     22# -----------------------------------------------------------------------
     23# Be Bourne compatible
     24# -----------------------------------------------------------------------
     25
     26if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
     27  emulate sh
     28  NULLCMD=:
     29elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
     30  set -o posix
     31fi
     32
     33# -----------------------------------------------------------------------
     34# Make sure we support functions (from the autoconf manual)
     35# -----------------------------------------------------------------------
     36
     37TSHELL="${TSHELL-/bin/sh}"
     38if test x"$1" = "x--re-executed"
     39then
     40    shift
     41elif "$TSHELL" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
     42then
     43    :
     44else
     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; }
     67fi
     68
     69# -----------------------------------------------------------------------
     70# Make sure we support 'let' (from the autoconf manual)
     71# -----------------------------------------------------------------------
     72
     73TSHELL="${TSHELL-/bin/sh}"
     74if test x"$1" = "x--re-run"
     75then
     76    shift
     77elif "$TSHELL" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1
     78then
     79    :
     80else
     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; }
     106fi
     107
     108
     109umask 0022
    21110
    22111isok=`test -t 1 2>&1 | wc -c`
     
    366455        tmp="localhost"
    367456    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
    369466}
    370467
  • trunk/test/testcompile.sh

    r29 r30  
    2020#
    2121
    22 MAXTEST=56; export MAXTEST
     22MAXTEST=57; export MAXTEST
     23
     24run_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}
    2336
    2437run_smatch ()
     
    133146
    134147        #
     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        #
    135164        # test standalone compilation
    136165        #
  • trunk/test/testext.sh

    r27 r30  
    5858        if test x$? = x0; then
    5959            [ -z "$verbose" ] ||     log_msg_ok "configure...";
    60             $MAKE  > /dev/null
     60            $MAKE  >/dev/null 2>>test_log
    6161            if test x$? = x0; then
    6262                [ -z "$verbose" ] || log_msg_ok "make...";
  • trunk/test/testrun_1.sh

    r27 r30  
    8282    REPLACEMENT='FileCheckScheduleOne = 6 12 * * *'
    8383    ex $RCFILE <<EOF
    84 :%s/${ORIGINAL}/${REPLACEMENT}/g
    85 :wq
     84%s/${ORIGINAL}/${REPLACEMENT}/g
     85wq
    8686EOF
    8787}
     
    865865            return 1
    866866        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`
    868871        if [ $tmp -ne 0 ]; then
    869             [ -z "$verbose" ] || log_msg_fail "update not successful(?)";
     872            [ -z "$verbose" ] || log_msg_fail "errors during check";
    870873            return 1
    871874        fi
     
    889892prep_testdata ()
    890893{
    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
    896901    fi
    897902
     
    947952        if test x$? = x0; then
    948953                [ -z "$verbose" ] ||     log_msg_ok "configure...";
    949                 $MAKE  > /dev/null
     954                $MAKE  >/dev/null 2>>test_log
    950955                if test x$? = x0; then
    951956                    [ -z "$verbose" ] || log_msg_ok "make...";
  • trunk/test/testrun_1c.sh

    r27 r30  
    255255        if test x$? = x0; then
    256256                [ -z "$verbose" ] ||     log_msg_ok "configure...";
    257                 $MAKE  'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' >/dev/null
     257                $MAKE  'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' >/dev/null 2>&1
    258258                if test x$? = x0; then
    259259                    [ -z "$verbose" ] || log_msg_ok "make...";
  • trunk/test/testrun_2.sh

    r29 r30  
    138138        REPLACEMENT="UseSeparateLogs=yes"
    139139        ex $RCFILE <<EOF
    140 :%s/$ORIGINAL/$REPLACEMENT/g
    141 :wq
     140%s/$ORIGINAL/$REPLACEMENT/g
     141wq
    142142EOF
    143143# :%s is the "ex" substitution command.
     
    182182            CLIENTLOG="${LOGFILE}.${remhost}"
    183183        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
    185190        fi
    186191
     
    235240        REPLACEMENT_4="SetClientTimeLimit=20"
    236241        ex $RCFILE <<EOF
    237 :%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
    238 :%s/${ORIGINAL_2}/${REPLACEMENT_2}/g
    239 :%s/${ORIGINAL_3}/${REPLACEMENT_3}/g
    240 :%s/${ORIGINAL_4}/${REPLACEMENT_4}/g
    241 :wq
     242%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
     246wq
    242247EOF
    243248# :%s is the "ex" substitution command.
     
    336341        REPLACEMENT_1="SetSocketAllowUid=$me"
    337342        ex $RCFILE <<EOF
    338 :%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
    339 :wq
     343%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
     344wq
    340345EOF
    341346
     
    435440
    436441        kill ${PROC_Y}
     442        sleep 2
     443        kill -9 ${PROC_Y} >/dev/null 2>&1
    437444
    438445        [ -z "$VALGRIND" ] || {
     
    633640        #
    634641        cp samhain samhain.build || return 1
    635         make clean >/dev/null || return 1
     642        $MAKE clean >/dev/null || return 1
    636643
    637644        ${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
     
    655662        #
    656663        cp yule yule.2 || return 1
    657         make clean >/dev/null || return 1
     664        $MAKE clean >/dev/null || return 1
    658665
    659666        ${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  
    2525SERVER_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
    2626
    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_BUILDOPTS
     27CLIENT_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
    2828
    2929do_test_1_a () {
     
    131131        #
    132132        cp samhain samhain.build || return 1
    133         make clean >/dev/null || return 1
     133        $MAKE clean >/dev/null || return 1
    134134
    135135        ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
  • trunk/test/testrun_2b.sh

    r29 r30  
    2626SERVER_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
    2727
    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_BUILDOPTS
     28CLIENT_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
    2929
    3030testrun2b_internal ()
     
    8080
    8181    cp samhain samhain.build || return 1
    82     make clean >/dev/null || return 1
     82    $MAKE clean >/dev/null || return 1
    8383   
    8484    ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
  • trunk/test/testrun_2c.sh

    r27 r30  
    2222SERVER_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
    2323
    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_BUILDOPTS
     24CLIENT_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
    2525
    2626check_mysql_log () {
     
    9292    REPLACEMENT="DatabaseSeverity=info"
    9393    ex $RCFILE <<EOF
    94 :%s/$ORIGINAL/$REPLACEMENT/g
    95 :wq
     94%s/$ORIGINAL/$REPLACEMENT/g
     95wq
    9696EOF
    9797    #
  • trunk/test/testrun_2d.sh

    r27 r30  
    2222SERVER_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
    2323
    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_BUILDOPTS
     24CLIENT_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
    2525
    2626check_psql_log () {
     
    9494    REPLACEMENT="DatabaseSeverity=info"
    9595    ex $RCFILE <<EOF
    96 :%s/$ORIGINAL/$REPLACEMENT/g
    97 :wq
     96%s/$ORIGINAL/$REPLACEMENT/g
     97wq
    9898EOF
    9999    #
  • trunk/test/testtimesrv.sh

    r27 r30  
    3030prep_testdata ()
    3131{
    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
    3638
    3739    rm -rf "${BASE}" || {
     
    140142        # standalone compilation
    141143        #
    142         [ -z "$verbose" ] || { echo; echo "${S}Building standalone agent w/timeserver${E}"; echo; }
     144        [ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
    143145        #
    144146        if test -r "Makefile"; then
     
    150152        if test x$? = x0; then
    151153                [ -z "$verbose" ] ||     log_msg_ok "configure...";
    152                 $MAKE  > /dev/null
     154                $MAKE  > /dev/null 2>>test_log
    153155                if test x$? = x0; then
    154156                    [ -z "$verbose" ] || log_msg_ok "make...";
Note: See TracChangeset for help on using the changeset viewer.