Browse code

add unit tests for the VI parser

aCaB authored on 2010/09/08 07:01:04
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Sep  8 00:00:18 CEST 2010 (acab)
2
+------------------------------------
3
+ * unit_tests: add VI unit tests
4
+
1 5
 Tue Sep  7 16:55:43 CEST 2010 (tk)
2 6
 ----------------------------------
3 7
  * libclamav: versioninfo hashset was not properly cached (bb#2065)
... ...
@@ -194,6 +194,20 @@ EOF
194 194
     if test "x$NINFECTED" != x4; then
195 195
 	scan_failed clamscan4.log "clamscan has detected spurious icons or whitlisting was not applier properly"
196 196
     fi
197
+
198
+cat <<EOF >test-db/test.ldb
199
+Clam-VI-Test:Target;Engine:52-255,Target:1;(0&1);VI:43006f006d00700061006e0079004e0061006d0065000000000063006f006d00700061006e007900;VI:500072006f0064007500630074004e0061006d0065000000000063006c0061006d00
200
+EOF
201
+    if test_run 1 $CLAMSCAN --quiet -dtest-db/test.ldb $TESTFILES --log=clamscan5.log; then
202
+	scan_failed clamscan5.log "clamscan didn't detect VI correctly"
203
+    fi
204
+    grep "clam_ISmsi_ext.exe: Clam-VI-Test:Target.UNOFFICIAL FOUND" clamscan5.log || die "VI-test1 failed"
205
+    grep "clam_ISmsi_int.exe: Clam-VI-Test:Target.UNOFFICIAL FOUND" clamscan5.log || die "VI-test2 failed"
206
+    NINFECTED=`grep "Infected files" clamscan5.log | cut -f2 -d: | sed -e 's/ //g'`
207
+    if test "x$NINFECTED" != x2; then
208
+	scan_failed clamscan4.log "clamscan has detected spurious VI's"
209
+    fi
210
+
197 211
     test_end $1
198 212
 }
199 213