Changeset 170 for trunk/test


Ignore:
Timestamp:
Apr 30, 2008, 11:56:45 PM (17 years ago)
Author:
katerina
Message:

Plenty of compiler warnings fixed, SQL query length fixed, doc update.

Location:
trunk/test
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test.sh

    r128 r170  
    296296MAKE=`which gmake`
    297297if test "x$?" = x1 ; then
    298     MAKE="make -s"
     298    MAKE="make -s -j 3"
    299299else
    300300    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"`
  • trunk/test/testcompile.sh

    r147 r170  
    4141    if [ -z "$doall" ]; then
    4242        [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)";
     43        return 0
     44    fi
     45
     46    if [ ! -f "./x_samhain.c.sm" ]; then
     47        [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (skip smatch)";
    4348        return 0
    4449    fi
     
    140145            SAVE_CC="${CC}"
    141146            SMATCH="DBGDEF=--smatch"; export SMATCH
     147            SAVE_SMATCH="${SMATCH}"; export SAVE_SMATCH
    142148            CC="/usr/local/gcc-smatch/bin/gcc"; export CC
     149            SMATCH_CC="${CC}"
    143150        fi
    144151
     
    187194        fi
    188195        #
     196        [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }
     197        #
    189198        ${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-static --enable-suidcheck --enable-process-check > /dev/null 2>> test_log
    190199        #
     
    193202        let "num = num + 1" >/dev/null
    194203        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    195 
     204        #
     205        [ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; }
    196206        #
    197207        # test standalone compilation
     
    481491        fi
    482492        #
     493        [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }
     494        #
    483495        ${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-static --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-timeserver=127.0.0.1 > /dev/null 2>> test_log   
    484496        #
     
    498510        let "num = num + 1" >/dev/null
    499511        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    500 
     512        #
     513        [ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; }
    501514        #
    502515        # test c/s compilation w/ gpg
  • trunk/test/testrun_1b.sh

    r169 r170  
    2020#
    2121
    22 MAXTEST=6; export MAXTEST
     22MAXTEST=7; export MAXTEST
    2323LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
    2424RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
     25
     26testrun1b_modrc ()
     27{
     28        ORIGINAL="\[EOF\]"
     29        REPLACEMENT="\[PortCheck\]"
     30        ex -s $RCFILE <<EOF
     31%s/$ORIGINAL/$REPLACEMENT/g
     32wq
     33EOF
     34
     35        echo "PortCheckActive = yes" >>"$RCFILE"
     36        echo "PortCheckInterface = 127.0.0.1" >>"$RCFILE"
     37}
    2538
    2639testrun1b_internal ()
     
    173186
    174187        cp "${SCRIPTDIR}/testrc_1" "${RCFILE}"
     188
     189        if test "x$2" = "xmodrc"; then
     190            [ -z "$verbose" ] || log_msg_ok    "mod rc...";
     191            testrun1b_modrc
     192        fi
    175193
    176194        ./samhain -t init -p none -l info
     
    253271        [ -z "$verbose" ] || log_msg_fail "checking";
    254272    fi
    255     tmp=`egrep 'Classification text: Checking' test_log_prelude 2>/dev/null | wc -l`
    256     if [ $tmp -lt 1 ]; then
    257         [ -z "$verbose" ] || log_msg_fail "checking";
     273    #
     274    if test "x$2" = "xmodrc"; then
     275        tmp=`egrep 'Classification text: Service opened' test_log_prelude 2>/dev/null | wc -l`
     276        if [ $tmp -lt 1 ]; then
     277            [ -z "$verbose" ] || log_msg_fail "service";
     278        fi
     279        tmp=`egrep 'Service: port=5500' test_log_prelude 2>/dev/null | wc -l`
     280        if [ $tmp -lt 1 ]; then
     281            [ -z "$verbose" ] || log_msg_fail "port 5500";
     282        fi
    258283    fi
    259284    #
     
    270295        log_skip 2 $MAXTEST 'gpg not found in $PATH'
    271296        log_skip 3 $MAXTEST 'gpg not found in $PATH'
     297        log_skip 4 $MAXTEST 'gpg not found in $PATH'
     298        log_skip 5 $MAXTEST 'gpg not found in $PATH'
     299        log_skip 6 $MAXTEST 'gpg not found in $PATH'
     300        log_skip 7 $MAXTEST 'gpg not found in $PATH'
    272301    else
    273302        eval "$GPG" --list-keys 0F571F6C >/dev/null 2>/dev/null
     
    278307            log_skip 4 $MAXTEST 'public PGP key 0x0F571F6C not present'
    279308            log_skip 5 $MAXTEST 'public PGP key 0x0F571F6C not present'
     309            log_skip 6 $MAXTEST 'public PGP key 0x0F571F6C not present'
     310            log_skip 7 $MAXTEST 'public PGP key 0x0F571F6C not present'
    280311        else
    281312            #
     
    342373            # -------------  fifth test -------------
    343374            #
    344             if test -f /usr/local/lib/libprelude.so
     375            if ! test -d /var/run/prelude-manager
    345376            then
    346                     LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
    347                     export LD_LIBRARY_PATH
     377                    [ -z "$verbose" ] || log_msg_ok    "create /var/run/prelude-manager...";
     378                    sudo mkdir /var/run/prelude-manager
     379                    sudo chown prelude:rainer /var/run/prelude-manager
     380                    sudo chmod 770 /var/run/prelude-manager
    348381            fi
    349382            #
     
    367400            # -------------  sixth test -------------
    368401            #
    369             if test -f /usr/local/lib/libprelude.so
     402            if ! test -d /var/run/prelude-manager
    370403            then
    371                     LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
    372                     export LD_LIBRARY_PATH
     404                    [ -z "$verbose" ] || log_msg_ok    "create /var/run/prelude-manager...";
     405                    sudo mkdir /var/run/prelude-manager
     406                    sudo chown prelude:rainer /var/run/prelude-manager
     407                    sudo chmod 770 /var/run/prelude-manager
    373408            fi
    374409            #
     
    389424            fi
    390425
     426            #
     427            # -------------  seventh test -----------
     428            #
     429            if ! test -d /var/run/prelude-manager
     430            then
     431                    [ -z "$verbose" ] || log_msg_ok    "create /var/run/prelude-manager...";
     432                    sudo mkdir /var/run/prelude-manager
     433                    sudo chown prelude:rainer /var/run/prelude-manager
     434                    sudo chmod 770 /var/run/prelude-manager
     435            fi
     436            #
     437            PM=`find_path prelude-manager`
     438            if [ -z "$PM" ]; then
     439                log_skip 7 $MAXTEST 'prelude-manager not found in $PATH'
     440            elif [ -z "$doall" ]; then
     441                log_skip 7 $MAXTEST 'logging to prelude (or use --really-all)'
     442            else
     443                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"
     444                testrun1b_nogpg "${BUILDOPTS} CFLAGS=-DSH_NOFAILOVER=1" "modrc"
     445                do_test_1b_2
     446                if [ $? -eq 0 ]; then
     447                    log_ok   7 $MAXTEST 'logging to prelude'
     448                else
     449                    log_fail 7 $MAXTEST 'logging to prelude'
     450                fi
     451            fi
     452
    391453        fi
    392454    fi
  • trunk/test/testrun_2d.sh

    r51 r170  
    2424CLIENT_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
     26create_pgpass () {
     27touch ~/.pgpass
     28chmod 600 ~/.pgpass
     29cat > ~/.pgpass << EOF
     30localhost:*:samhain:samhain:samhain
     31EOF
     32}
     33
    2634check_psql_log () {
    2735    DATE="$1"
    2836
    2937    rm -f test_log_db
    30     PGPASSWORD=samhain; export PGPASSWORD
     38    # PGPASSWORD=samhain; export PGPASSWORD
     39    create_pgpass
    3140    psql -U samhain -d samhain -c "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '${DATE}';" >test_log_db
    3241    #
     
    7786        return 1
    7887    else
    79         PGPASSWORD="samhain"; export PGPASSWORD
     88        # PGPASSWORD="samhain"; export PGPASSWORD
     89        create_pgpass
    8090        TEST=`psql -U samhain -d samhain -c "SELECT * FROM log LIMIT 1;" 2>/dev/null`
    8191        if [ $? -ne 0 -o -z "$TEST" ]; then
Note: See TracChangeset for help on using the changeset viewer.