Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/testrun_1.sh

    r30 r19  
    11#! /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 #
    212
    223RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
     
    4122testrun1_setup=0
    4223
    43 MAXTEST=11; export MAXTEST
     24MAXTEST=10; export MAXTEST
    4425
    4526test_dirs () {
     
    6546        fi
    6647    done
    67 }
    68 
    69 #
    70 # combine file check schedule with one-shot mode
    71 #
    72 TESTPOLICY_11="
    73 [ReadOnly]
    74 dir=99${BASE}
    75 "
    76 
    77 mod_testdata_11 () {
    78     sleep 1
    79     echo "foobar" >"${BASE}/c/x"; # bad
    80     chmod 0555  "${BASE}/a/y";    # bad
    81     ORIGINAL='SetFilecheckTime=60'
    82     REPLACEMENT='FileCheckScheduleOne = 6 12 * * *'
    83     ex $RCFILE <<EOF
    84 %s/${ORIGINAL}/${REPLACEMENT}/g
    85 wq
    86 EOF
    87 }
    88 
    89 chk_testdata_11 () {
    90     # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
    91     tmp=`grep CRIT $LOGFILE | wc -l`
    92     if [ $tmp -ne 2 ]; then
    93         [ -z "$verbose" ] || log_msg_fail "policy count";
    94         return 1
    95     fi
    96     egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1
    97     if [ $? -ne 0 ]; then
    98         [ -z "$verbose" ] || log_msg_fail "${BASE}/c/x";
    99         return 1
    100     fi
    101     egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/a/y" $LOGFILE >/dev/null 2>&1
    102     if [ $? -ne 0 ]; then
    103         [ -z "$verbose" ] || log_msg_fail "${BASE}/a/y";
    104         return 1
    105     fi
    106     CDIRS="a a/a a/b a/c c b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c";
    107     NDIRS="";
    108     test_dirs;
    109     return $?
    11048}
    11149
     
    811749run_init ()
    812750{
    813     rm -f test_log_valgrind
    814 
    815     ${VALGRIND} ./samhain -t init -p none 2>>test_log_valgrind
     751    ./samhain -t init -p none
    816752
    817753    if test x$? = x0; then
     
    825761run_check ()
    826762{
    827     ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind
     763    ./samhain -t check -p none -l debug
    828764
    829765    if test x$? = x0; then
     
    842778run_update ()
    843779{
    844     ${VALGRIND} ./samhain -t update -p none -l debug 2>>test_log_valgrind
     780    ./samhain -t update -p none -l debug
    845781
    846782    if test x$? = x0; then
     
    856792    rm -rf $LOGFILE
    857793
    858     ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind
     794    ./samhain -t check -p none -l debug
    859795
    860796    if test x$? = x0; then
     
    865801            return 1
    866802        fi
    867         #
    868         # wtmp may not be readable
    869         #
    870         tmp=`./samhain -j -L $LOGFILE | grep ERR | grep -v wtmp | wc -l`
     803        tmp=`./samhain -j -L $LOGFILE | grep ERR | wc -l`
    871804        if [ $tmp -ne 0 ]; then
    872             [ -z "$verbose" ] || log_msg_fail "errors during check";
    873             return 1
    874         fi
    875         #
    876         [ -z "$VALGRIND" ] || {
    877             tmp=`cat test_log_valgrind 2>/dev/null | wc -l`;
    878             if [ $tmp -ne 0 ]; then
    879                 [ -z "$verbose" ] || log_msg_fail "valgrind reports errors";
    880                 cat test_log_valgrind
    881                 return 1;
    882             fi;
    883         }
     805            [ -z "$verbose" ] || log_msg_fail "update not successful(?)";
     806            return 1
     807        fi
    884808        #
    885809        [ -z "$verbose" ] || log_msg_ok    "check(2)...";
     
    892816prep_testdata ()
    893817{
    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
    901     fi
     818    chmod -R 0700 "${BASE}" || {
     819        [ -z "$quiet" ] &&   log_msg_fail "chmod -R 0700 ${BASE}";
     820        return 1;
     821    }
    902822
    903823    rm -rf "${BASE}" || {
     
    952872        if test x$? = x0; then
    953873                [ -z "$verbose" ] ||     log_msg_ok "configure...";
    954                 $MAKE  >/dev/null 2>>test_log
     874                $MAKE  > /dev/null
    955875                if test x$? = x0; then
    956876                    [ -z "$verbose" ] || log_msg_ok "make...";
Note: See TracChangeset for help on using the changeset viewer.