4
test -f /tmp/clamd-test.pid || return
5
pid=`cat /tmp/clamd-test.pid`
6
kill -0 $pid && kill $pid
8
while test -f /tmp/clamd-test.pid; do
10
pippo=`expr $pippo + 1`
11
if test $pippo -gt 9; then
13
rm /tmp/clamd-test.pid
19
rm -rf test-db test-clamd-viraction.conf test-clamd.log test-clamd-heur-pred.conf clamd-test.socket
26
../clamd/clamd -c $conf_file || { echo "Failed to start clamd!" >&2; die 1;}
27
../clamdscan/clamdscan --version --config-file $conf_file 2>&1|grep "^ClamAV" >/dev/null || { echo "clamdscan can't get version of clamd!" >&2; die 2;}
28
../clamdscan/clamdscan --quiet --config-file $conf_file $* --log=clamdscan.log
30
echo "Failed to run clamdscan!" >&2;
36
run_clamd_fdpass_test() {
40
../clamd/clamd -c $conf_file || { echo "Failed to start clamd!" >&2; die 1;}
41
../clamdscan/clamdscan --quiet --fdpass --config-file $conf_file - <$1 --log=clamdscan.log
43
echo "Failed to run clamdscan!" >&2;
50
cat <<EOF >test-db/test.hdb
51
aa15bcf478d165efd2065190eb473bcb:544:ClamAV-Test-File
53
cp $srcdir/input/daily.ftm test-db/
54
cp $srcdir/input/daily.pdb test-db/
56
# Test that all testfiles are detected
58
run_clamd_test $srcdir/test-clamd.conf $FILES
59
NFILES=`ls -1 $FILES | wc -l`
60
NINFECTED=`grep "Infected files" clamdscan.log | cut -f2 -d:|sed -e 's/ //g'`
61
if test "$NFILES" -ne "0$NINFECTED"; then
62
echo "clamd did not detect all testfiles correctly!" >&2;
63
grep OK clamdscan.log >&2;
67
# Test VirusEvent feature
68
cat <$srcdir/test-clamd.conf >test-clamd-viraction.conf
69
echo "VirusEvent `pwd`/$srcdir/virusaction-test.sh `pwd` \"Virus found: %v\"" >>test-clamd-viraction.conf
71
run_clamd_test test-clamd-viraction.conf ../test/clam.exe
72
grep "Virus found: ClamAV-Test-File.UNOFFICIAL" test-clamd.log >/dev/null 2>/dev/null;
74
echo "Virusaction test failed!"
79
# Test HeuristicScanPrecedence feature
80
cat <$srcdir/test-clamd.conf >test-clamd-heur-pred.conf
81
run_clamd_test test-clamd-heur-pred.conf clam-phish-exe
82
grep "ClamAV-Test-File" clamdscan.log >/dev/null 2>/dev/null;
84
echo "HeuristicScanPrecedence off test failed!" >&2;
88
echo "HeuristicScanPrecedence yes" >>test-clamd-heur-pred.conf
89
run_clamd_test test-clamd-heur-pred.conf clam-phish-exe
90
grep "Phishing.Heuristics.Email.SpoofedDomain" clamdscan.log >/dev/null 2>/dev/null;
92
echo "HeuristicScanPrecedence on test failed!" >&2;
97
if grep "^#define HAVE_FD_PASSING 1" ../clamav-config.h >/dev/null; then
98
run_clamd_fdpass_test $srcdir/test-clamd.conf ../test/clam.exe
99
grep "ClamAV-Test-File" clamdscan.log >/dev/null 2>/dev/null;
101
echo "FDpassing test failed!" >&2;
106
echo "No FD passing support, skipping test"