Ignore:
Timestamp:
Apr 13, 2008, 9:59:55 PM (17 years ago)
Author:
katerina
Message:

Fixes for tickes #93 to #104 (yes, big commit, bad, bad,...).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/testrun_1.sh

    r138 r169  
    4141testrun1_setup=0
    4242
    43 MAXTEST=13; export MAXTEST
     43MAXTEST=15; export MAXTEST
    4444
    4545test_dirs () {
     
    6565        fi
    6666    done
     67}
     68
     69
     70TESTPOLICY_15="
     71[Misc]
     72DigestAlgo=SHA1
     73RedefReadOnly = +TXT
     74[ReadOnly]
     75dir=${BASE}
     76"
     77mod_testdata_15 () {
     78    mod_testdata_1
     79}
     80chk_testdata_15 () {
     81    chk_testdata_1
     82}
     83
     84TESTPOLICY_14="
     85[Misc]
     86DigestAlgo=MD5
     87RedefReadOnly = +TXT
     88[ReadOnly]
     89dir=${BASE}
     90"
     91mod_testdata_14 () {
     92    mod_testdata_1
     93}
     94chk_testdata_14 () {
     95    chk_testdata_1
    6796}
    6897
     
    455484mod_testdata_5 () {
    456485    mod_testdata_4
    457     echo "This is a xxxx file"  > "${BASE}/a/a/b/x"    # GrowingLogFiles
    458     echo "This is a test file" > "${BASE}/a/a/b/y"     # GrowingLogFiles
    459     echo "This is a xxxx file bad" > "${BASE}/a/a/b/z" # GrowingLogFiles
     486    echo "1 This is a xxxx file" > "${BASE}/a/a/b/x"     # GrowingLogFiles
     487    echo "1 This is a test file" > "${BASE}/a/a/b/y"     # GrowingLogFiles
     488    echo "2 This is a test file" >> "${BASE}/a/a/b/y"    # GrowingLogFiles
     489    echo "1 This is a xxxx file bad" > "${BASE}/a/a/b/z" # GrowingLogFiles
     490    echo "2 This is a xxxx file bad" >>"${BASE}/a/a/b/z" # GrowingLogFiles
     491    echo "3 This is a xxxx file bad" >>"${BASE}/a/a/b/z" # GrowingLogFiles
    460492}
    461493
     
    716748"
    717749mod_testdata_2 () {
    718     mod_testdata_1;
     750    # mod_testdata_1;
     751    one_sec_sleep
     752    touch "${BASE}/a/a/x"
     753    chmod 0555 "${BASE}/a/a/y"
     754    mv "${BASE}/a/b/y" "${BASE}/a/b/yy";
     755    echo "1 This is a test file" >  "${BASE}/a/b/y";
     756    echo "2 This is a test file" >> "${BASE}/a/b/y";
     757    echo "4 This is a test file" >> "${BASE}/a/b/z";
     758    rm "${BASE}/a/b/yy"; # mv/rm to force new inode
     759    rm "${BASE}/a/b/l_y";
     760    ln -s "${BASE}/a/b/x" "${BASE}/a/b/l_y";
     761    echo "foobar" > "${BASE}/a/c/y"
    719762    rm "${BASE}/a/a/c/y"
    720763    echo "foobar" > "${BASE}/a/a/c/foo"
     
    762805    fi
    763806    tmp=`grep CRIT $LOGFILE | wc -l`
    764     if [ $tmp -ne 8 ]; then
     807    if [ $tmp -ne 10 ]; then
    765808        [ -z "$verbose" ] || log_msg_fail "policy count";
    766809        return 1
     
    769812
    770813TESTPOLICY_1="
     814[Misc]
     815RedefReadOnly = +TXT
    771816[ReadOnly]
    772817dir=${BASE}
     
    777822    touch "${BASE}/a/a/x"
    778823    chmod 0555 "${BASE}/a/a/y"
    779     mv "${BASE}/a/b/y"  "${BASE}/a/b/yy"; echo "This is a test file" > "${BASE}/a/b/y"; rm "${BASE}/a/b/yy"
     824    mv "${BASE}/a/b/y" "${BASE}/a/b/yy";
     825    echo "1 This is a test file" >  "${BASE}/a/b/y";
     826    echo "2 This is a test file" >> "${BASE}/a/b/y";
     827    echo "4 This is a test file" >> "${BASE}/a/b/z";
     828    rm "${BASE}/a/b/yy"; # mv/rm to force new inode
     829    rm "${BASE}/a/b/l_y";
     830    ln -s "${BASE}/a/b/x" "${BASE}/a/b/l_y";
    780831    echo "foobar" > "${BASE}/a/c/y"
     832    #
     833    mv "${BASE}/b/x" "${BASE}/b/xx"; # mv/rm to force new inode
     834    mkdir "${BASE}/b/x"
     835    rm "${BASE}/b/xx";
     836    #
     837    mv "${BASE}/b/y" "${BASE}/b/yy"; # mv/rm to force new inode
     838    ln -s  "${BASE}/b/z" "${BASE}/b/y"
     839    rm "${BASE}/b/yy";
     840    #
     841    rm "${BASE}/b/l_x";  echo "1 This is a test file" >  "${BASE}/b/l_x";
    781842}
    782843
     
    792853        if [ $tmp -ne 1 ]; then
    793854            [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff} (multiple)";
     855            return 1
    794856        fi
    795857        #
     
    797859            egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE >/dev/null 2>&1
    798860            if [ $? -ne 0 ]; then
    799                 [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checking)";
    800                 return 1
     861                if [ "${BASE}/${ff}" != "${BASE}/b" ]; then
     862                    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (checksum)";
     863                    return 1
     864                fi
    801865            fi
    802866            tmp=`egrep "Checksum.*${BASE}/${ff}/${gg}" $LOGFILE 2>/dev/null | wc -l`
    803867            if [ $tmp -ne 1 ]; then
    804                 [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)";
     868                if [ "${BASE}/${ff}" != "${BASE}/b" ]; then
     869                    [ -z "$verbose" ] || log_msg_fail "${BASE}/${ff}/${gg} (multiple)";
     870                    return 1
     871                fi
    805872            fi
    806873        done
    807874    done
     875    #
     876    #
     877    #
     878    egrep "CRIT.*POLICY \[ReadOnly\] ----H---T-.*${BASE}/b" $LOGFILE >/dev/null 2>&1
     879    if [ $? -ne 0 ]; then
     880        [ -z "$verbose" ] || log_msg_fail "${BASE}/b";
     881        return 1
     882    fi
     883    egrep "CRIT.*POLICY \[ReadOnly\] CL-I-M--TS.*${BASE}/b/y" $LOGFILE >/dev/null 2>&1
     884    if [ $? -ne 0 ]; then
     885        [ -z "$verbose" ] || log_msg_fail "${BASE}/b/y";
     886        return 1
     887    fi
     888    egrep "CRIT.*POLICY \[ReadOnly\] CL---M--TS.*${BASE}/b/l_x" $LOGFILE >/dev/null 2>&1
     889    if [ $? -ne 0 ]; then
     890        [ -z "$verbose" ] || log_msg_fail "${BASE}/b/l_x";
     891        return 1
     892    fi
     893    egrep "CRIT.*POLICY \[ReadOnly\] C--IHM--TS.*${BASE}/b/x" $LOGFILE >/dev/null 2>&1
     894    if [ $? -ne 0 ]; then
     895        [ -z "$verbose" ] || log_msg_fail "${BASE}/b/x";
     896        return 1
     897    fi
     898    #
     899    #
     900    #
    808901    egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/a/a/x" $LOGFILE >/dev/null 2>&1
    809902    if [ $? -ne 0 ]; then
     
    821914        return 1
    822915    fi
     916    egrep "CRIT.*POLICY \[ReadOnly\] -L-I----T-.*${BASE}/a/b/l_y" $LOGFILE >/dev/null 2>&1
     917    if [ $? -ne 0 ]; then
     918        [ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/l_y";
     919        return 1
     920    fi
    823921    egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/a/b" $LOGFILE >/dev/null 2>&1
    824922    if [ $? -ne 0 ]; then
     
    826924        return 1
    827925    fi
     926    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/b/z" $LOGFILE >/dev/null 2>&1
     927    if [ $? -ne 0 ]; then
     928        [ -z "$verbose" ] || log_msg_fail "${BASE}/a/b/z";
     929        return 1
     930    fi
    828931    egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/a/c/y" $LOGFILE >/dev/null 2>&1
    829932    if [ $? -ne 0 ]; then
     
    832935    fi
    833936    tmp=`grep CRIT $LOGFILE | wc -l`
    834     if [ $tmp -ne 5 ]; then
     937    if [ $tmp -ne 11 ]; then
    835938        [ -z "$verbose" ] || log_msg_fail "policy count";
    836939        return 1
    837940    fi
     941    for ff in x y z; do
     942        ./samhain --list-file "${BASE}/a/a/${ff}" -d "$PW_DIR/.samhain_file" > "$PW_DIR/.samhain_tmp"
     943        diff "$PW_DIR/.samhain_tmp" "${BASE}/a/a/${ff}" >/dev/null
     944        if [ $? -ne 0 ]; then
     945            [ -z "$verbose" ] || log_msg_fail "diff $PW_DIR/.samhain_tmp ${BASE}/a/a/${ff}"
     946            return 1
     947        fi
     948    done
     949
    838950    return 0
    839951}
     
    10281140        chmod 0755 "${BASE}/${ff}"
    10291141        for gg in $TFILES; do
    1030             echo "This is a test file" > "${BASE}/${ff}/${gg}"
     1142            echo "1 This is a test file" > "${BASE}/${ff}/${gg}"
    10311143            chmod 0644 "${BASE}/${ff}/${gg}"
     1144            ln -s "${BASE}/${ff}/${gg}" "${BASE}/${ff}/l_${gg}"
    10321145        done
     1146        echo "2 This is a test file" >> "${BASE}/${ff}/y"
     1147        echo "2 This is a test file" >> "${BASE}/${ff}/z"
     1148        echo "3 This is a test file" >> "${BASE}/${ff}/z"
    10331149    done
    10341150}
Note: See TracChangeset for help on using the changeset viewer.