
 [This test suite needs a complete overhaul. As the client will always return
  0 or EX_TEMPFAIL, checking its exit status as an indication of success makes
  no more sense. Possible solution: make daemon log into current dir and
  examine the logs.]

 [Update: I have semi-reactivated the test suite. Instructions:
  - make distclean
  - configure --with-runtime-dir=/tmp/amavis --with-sockname=/tmp/amavis/amavisd.sock
  - make
  - mkdir /tmp/amavis && chmod 700 /tmp/amavis
  - cd tests
  - ./amavisd-test
    (starts the test daemon and sends full debug output to stderr)
  - in a different window/console: cd tests && make check
  - monitor the debug output by amavisd-test, and the output of make check;
    the tests will report a failure, but this is ok.
     o the novirus-msg test will result in something like this:

Aug  7 16:02:22 localhost amavisd[24059]: forked off -- child running...
Aug  7 16:02:22 localhost amavisd[24059]: /tmp/amavis/amavis-XXdlai_U: from=<useer@localhost>, to=<user@localhost>
Aug  7 16:02:22 localhost amavisd[24059]: Extracting mime components
Aug  7 16:02:22 localhost amavisd[24059]: Level: 1, parts: 1
Aug  7 16:02:22 localhost amavisd[24059]: File-type of msg-24059-1.txt: ASCII text
Aug  7 16:02:22 localhost amavisd[24059]: msg-24059-1.txt is atomic
Aug  7 16:02:25 localhost amavisd[24059]: Testing mode - no email sent. X-Header: yes
Aug  7 16:02:25 localhost amavisd[24059]: do_exit:475 - ending execution with 0
Aug  7 16:02:25 localhost amavisd[24059]: socket shut down

     o the virus-msg test will result in something like this:

Aug  7 16:03:34 localhost amavisd[24100]: forked off -- child running...
Aug  7 16:03:34 localhost amavisd[24100]: /tmp/amavis/amavis-XXJNaqeV: from=<lhecking@localhost>, to=<lhecking@localhost>
Aug  7 16:03:34 localhost amavisd[24100]: Extracting mime components
Aug  7 16:03:34 localhost amavisd[24100]: Level: 1, parts: 2
Aug  7 16:03:34 localhost amavisd[24100]: File-type of msg-24100-1.txt: ASCII text
Aug  7 16:03:34 localhost amavisd[24100]: msg-24100-1.txt is atomic
Aug  7 16:03:34 localhost amavisd[24100]: File-type of msg-24100-2.arc: ARC archive data, packed
Aug  7 16:03:34 localhost amavisd[24100]: Unarcing msg-24100-2.arc
Aug  7 16:03:34 localhost amavisd[24100]: Level: 2, parts: 2
Aug  7 16:03:34 localhost amavisd[24100]: File-type of part-00001: Zoo archive data, v2.10, modify: v2.0+, extract: v1.0+
Aug  7 16:03:34 localhost amavisd[24100]: Expanding ZOO archive part-00001
Aug  7 16:03:34 localhost amavisd[24100]: Level: 3, parts: 2
Aug  7 16:03:34 localhost amavisd[24100]: File-type of part-00002: LHarc 1.x archive data [lh0]
Aug  7 16:03:34 localhost amavisd[24100]: Expanding LHA archive part-00002
Aug  7 16:03:34 localhost amavisd[24100]: Level: 4, parts: 2
Aug  7 16:03:34 localhost amavisd[24100]: File-type of part-00003: ARJ archive data, v8, slash-switched, original name: TEST.ARJ, os: MS-DOS
Aug  7 16:03:34 localhost amavisd[24100]: Expanding ARJ archive part-00003
Aug  7 16:03:35 localhost amavisd[24100]: Level: 5, parts: 2
Aug  7 16:03:35 localhost amavisd[24100]: File-type of part-00004: RAR archive data
Aug  7 16:03:35 localhost amavisd[24100]: Expanding RAR archive part-00004
Aug  7 16:03:35 localhost amavisd[24100]: Level: 6, parts: 2
Aug  7 16:03:35 localhost amavisd[24100]: File-type of part-00005: uuencoded or xxencoded text
Aug  7 16:03:35 localhost amavisd[24100]: Decoding part part-00005
Aug  7 16:03:35 localhost amavisd[24100]: Level: 7, parts: 2
Aug  7 16:03:35 localhost amavisd[24100]: File-type of part-00006: compress'd data 16 bits
Aug  7 16:03:35 localhost amavisd[24100]: Uncompressing part-00006
Aug  7 16:03:35 localhost amavisd[24100]: Level: 8, parts: 2
Aug  7 16:03:35 localhost amavisd[24100]: File-type of part-00007: GNU tar archive
Aug  7 16:03:35 localhost amavisd[24100]: Untarring part-00007
Aug  7 16:03:35 localhost amavisd[24100]: Level: 9, parts: 2
Aug  7 16:03:35 localhost amavisd[24100]: File-type of part-00008: Zip archive data, at least v2.0 to extract
Aug  7 16:03:35 localhost amavisd[24100]: Unzipping part-00008
Aug  7 16:03:35 localhost amavisd[24100]: Level: 10, parts: 2
Aug  7 16:03:35 localhost amavisd[24100]: File-type of part-00009: gzip compressed data, deflated, original filename, `test.tar', last modified: Thu Dec 16 17:58:41 1999, os: Unix
Aug  7 16:03:35 localhost amavisd[24100]: Inflating gzip archive part-00009
Aug  7 16:03:35 localhost amavisd[24100]: Level: 11, parts: 2
Aug  7 16:03:35 localhost amavisd[24100]: File-type of part-00010: GNU tar archive
Aug  7 16:03:35 localhost amavisd[24100]: Untarring part-00010
Aug  7 16:03:35 localhost amavisd[24100]: Level: 12, parts: 2
Aug  7 16:03:36 localhost amavisd[24100]: File-type of part-00011: bzip2 compressed data, block size = 900k
Aug  7 16:03:36 localhost amavisd[24100]: Expanding bzip2 archive part-00011
Aug  7 16:03:36 localhost amavisd[24100]: Level: 13, parts: 2
Aug  7 16:03:36 localhost amavisd[24100]: File-type of part-00012: ASCII text
Aug  7 16:03:36 localhost amavisd[24100]: part-00012 is atomic
Aug  7 16:03:39 localhost amavisd[24100]: >>> Virus 'EICAR-AV-Test' found in file /tmp/amavis/amavis-XXJNaqeV/parts/part-00012
Aug  7 16:03:39 localhost amavisd[24100]: do_exit:516 - ending execution with 0

     ie. the virus test pattern was found.

  - when finished Ctrl-C the daemon and rm -rf /tmp/amavis

  It still doesn't work with milter and qmail.
 ]

 The Amavis-Perl Test Suite
 ==========================

 To test the amavis daemon/client, the daemon must be started before
 running 'make check'. As the test daemon writes to STDERR instead of
 syslog, it should be started in a different terminal window.

 'make check' in the top level directory will run the test suite
 which consists of four short scripts in this directory. It does
 not work with qmail yet, due to the very non-standard way it
 communicates with amavis.

 The amavisd-test script here is identical with the generated amavisd
 script, except that all "$DEBUG" and "$TESTING" are set to "yes",
 "$LOGDIR" to the current directory, and "$X_HEADER" to "yes".
 If TESTING is yes, no emails are sent, but all steps necessary for
 virus scanning are performed. In TESTING mode, amavis prints the
 forwarded email message to stdout (required for X-Virus-Scanned: header
 test), and, if a virus is found, returns an exit status of 2 (required
 for virus-msg test).

 Setting "$LOGDIR" to the current directory and "$DEBUG" to yes allows
 for running the tests under any user id, as no write permissions for
 logging and debugging directories are required, and at the same time
 create useful debugging output (the filename is "debug") in the current
 directory.

 The first test, config, checks whether amavis was configured correctly, ie.
 whether the necessary substitutions were made.

 The second test, novirus-msg, runs a short, plain text email message
 through amavis-test, and should pass with no problem.

 The third test, virus-msg, creates an email message with a multiply
 decoded file which contains the EICAR.COM virus checker test pattern.
 It tests amavis for MIME decoding, plus a bunch of archive formats
 (which is bad: there should be separate tests for separate features).

 The last test, xheader, checks whether the "X-Virus-Scanned:" header
 is really added to the processed mail message. It seemed necessary
 to test this after I broke it in amavis-perl-7 ...

 For your convenience, "make EICAR.COM" in this directory creates a
 file EICAR.COM with the virus checker test pattern.

 More tests will be added if necessary.


