~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to unit_tests/check_common.sh

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
CLAMDSCAN=$TOP/clamdscan/clamdscan
14
14
TESTFILES=$TOP/test/clam*
15
15
NFILES=`ls -1 $TESTFILES | wc -l`
 
16
#CHECK_FPU_ENDIAN=$TOP/unit_tests/.libs/lt-check_fpu_endian
 
17
CHECK_FPU_ENDIAN=$TOP/unit_tests/check_fpu_endian
16
18
 
17
19
killclamd() {
18
20
    test -f clamd-test.pid &&
120
122
}
121
123
 
122
124
scan_failed() {
123
 
    if test "X$unrar_disabled" = "X1" && test `grep -v '\.rar' $1 | grep OK | wc -l` -eq 0
124
 
    then
125
 
        error "UNRAR is disabled, won't be able to detect unrar files!"
126
 
    else
127
 
        cat $1
128
 
        die "$2";
129
 
    fi
 
125
    cat $1
 
126
    die "$2";
130
127
}
131
128
 
132
129
# ----------- valgrind wrapper 
196
193
    if test_run 1 $CLAMSCAN --quiet -dtest-db $TESTFILES --log=clamscan4.log; then
197
194
        scan_failed clamscan4.log "clamscan didn't detect icons correctly"
198
195
    fi
 
196
    NINFECTED=`grep "Infected files" clamscan4.log | cut -f2 -d: | sed -e 's/ //g'`
199
197
    grep "clam.ea05.exe: ClamAV-Test-Icon-EA0X.UNOFFICIAL FOUND" clamscan4.log || die "icon-test1 failed"
200
 
    grep "clam.ea06.exe: ClamAV-Test-Icon-EA0X.UNOFFICIAL FOUND" clamscan4.log || die "icon-test2 failed"
 
198
 
 
199
    test_run_check $CHECK_FPU_ENDIAN
 
200
    if test $? -eq 3; then
 
201
        NEXPECT=3
 
202
    else
 
203
        grep "clam.ea06.exe: ClamAV-Test-Icon-EA0X.UNOFFICIAL FOUND" clamscan4.log || die "icon-test2 failed"
 
204
        NEXPECT=4
 
205
    fi
201
206
    grep "clam_IScab_ext.exe: ClamAV-Test-Icon-IScab.UNOFFICIAL FOUND" clamscan4.log || die "icon-test3 failed"
202
207
    grep "clam_IScab_int.exe: ClamAV-Test-Icon-IScab.UNOFFICIAL FOUND" clamscan4.log || die "icon-test4 failed"
203
 
    NINFECTED=`grep "Infected files" clamscan4.log | cut -f2 -d: | sed -e 's/ //g'`
204
 
    if test "x$NINFECTED" != x4; then
205
 
        scan_failed clamscan4.log "clamscan has detected spurious icons or whitlisting was not applier properly"
 
208
    if test "x$NINFECTED" != "x$NEXPECT"; then
 
209
        scan_failed clamscan4.log "clamscan has detected spurious icons or whitelisting was not applied properly"
206
210
    fi
207
211
 
208
212
cat <<EOF >test-db/test.ldb