add some minimal tests for new clamd/clamdscan features

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4747 77e5149b-7576-45b1-b177-96237e5ba77b
0.95
Török Edvin 17 years ago
parent 0115f12ffc
commit 97ff73f97a
  1. 5
      ChangeLog
  2. 31
      unit_tests/check_clamd.sh

@ -1,3 +1,8 @@
Thu Feb 12 12:44:55 EET 2009 (edwin)
------------------------------------
* unit_tests/check_clamd.sh: add some minimal tests for new
clamd/clamdscan features
Thu Feb 12 12:35:19 EET 2009 (edwin)
------------------------------------
* clamd/scanner.c, clamd/server-th.c, clamd/session.c,

@ -56,7 +56,7 @@ start_clamd()
{ error "Failed to start clamd!"; die 1; }
}
run_clamdscan() {
run_clamdscan_fileonly() {
rm -f clamdscan.log clamdscan-multiscan.log
$TOP/clamdscan/clamdscan --version --config-file=test-clamd.conf 2>&1|grep "^ClamAV" >/dev/null ||
{ error "clamdscan can't get version of clamd!"; die 1;}
@ -74,6 +74,23 @@ run_clamdscan() {
fi
}
run_clamdscan() {
run_clamdscan_fileonly $*
rm -f clamdscan-fdpass.log clamdscan-multiscan-fdpass.log
$TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* --fdpass --log=clamdscan-fdpass.log
if test $? = 2; then
error "Failed to run clamdscan (fdpass)!"
cat clamdscan-multiscan.log
die 1
fi
$TOP/clamdscan/clamdscan --quiet --config-file=test-clamd.conf $* -m --fdpass --log=clamdscan-multiscan-fdpass.log
if test $? = 2; then
error "Failed to run clamdscan (fdpass + multiscan)!"
cat clamdscan-multiscan.log
die 1
fi
}
run_reload_test()
{
rm -f reload-testfile
@ -160,6 +177,8 @@ run_clamdscan $FILES
NFILES=`ls -1 $FILES | wc -l`
NINFECTED=`grep "Infected files" clamdscan.log | cut -f2 -d:|sed -e 's/ //g'`
NINFECTED_MULTI=`grep "Infected files" clamdscan-multiscan.log | cut -f2 -d:|sed -e 's/ //g'`
NINFECTED_FDPASS=`grep "Infected files" clamdscan-fdpass.log | cut -f2 -d:|sed -e 's/ //g'`
NINFECTED_MULTI_FDPASS=`grep "Infected files" clamdscan-multiscan-fdpass.log | cut -f2 -d:|sed -e 's/ //g'`
if test "$NFILES" -ne "0$NINFECTED"; then
grep OK clamdscan.log
scan_failed clamdscan.log "clamd did not detect all testfiles correctly!"
@ -168,6 +187,14 @@ if test "$NFILES" -ne "0$NINFECTED_MULTI"; then
grep OK clamdscan-multiscan.log
scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in multiscan mode!"
fi
if test "$NFILES" -ne "0$NINFECTED_FDPASS"; then
grep OK clamdscan-fdpass.log
scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in fdpass mode!"
fi
if test "$NFILES" -ne "0$NINFECTED_MULTI_FDPASS"; then
grep OK clamdscan-multiscan-fdpass.log
scan_failed clamdscan-multiscan.log "clamd did not detect all testfiles correctly in fdpass+multiscan mode!"
fi
# Test HeuristicScanPrecedence off feature
run_clamdscan ../clam-phish-exe
@ -186,7 +213,7 @@ pid1=$!
start_clamd test-clamd.conf
# Test VirusEvent feature
run_clamdscan $TOP/test/clam.exe
run_clamdscan_fileonly $TOP/test/clam.exe
grep "Virus found: ClamAV-Test-File.UNOFFICIAL" test-clamd.log >/dev/null 2>/dev/null;
if test $? -ne 0; then
error "Virusaction test failed!"

Loading…
Cancel
Save