Mailing List Archive

[Bug 3513] spamc tests hang in Windows using Cygwin spamd
http://bugzilla.spamassassin.org/show_bug.cgi?id=3513





------- Additional Comments From sidney@sidney.com 2004-06-16 17:01 -------
I'm not sure how it ever seemed to work :-)

Here are various issues related to the problem:

There are two types of tests that use spamd. The tests with names beginning with
"spamd" are testing spamd itself. They should only be run when spamd is being
installed on the system being tested. It does not make sense to run these on a
Windows system that is using SPAMD_SCRIPT to make use of spamd running elsewhere.

Some of the tests with names beginning with spamc require an instance of spamd
running for spamc to talk to. Those can run when spamd is not installed on the
machine being tested as long as the tests make few or no assumptions about any
custom configuration of the system running spamd.

Currently the only systems on which we do not install spamd are Windows.
SATest.pm sets a variable $SKIP_SPAMD_TESTS to true when the test is running on
Windows and there is no SPAMD_SCRIPT environment variable to override that.

One problem is that would cause the spamd* tests to run if SPAMD_SCRIPT is set,
which is not correct. They should always be skipped under Windows.

Another problem, the direct cause of this bug report, is that the spamc tests
are written assuming that the test machine can start and stop spamd. Under
Windows, SPAMD_SCRIPT lets the user of the machine specify a way of starting
spamd, but there is no reason to believe that the stop_spamd() subroutine will
work with it, or even that it canbe made to work.

This is fundamentally broken. If, for example, spamd is runnning on another
computer on the network, what we want to have happen is that the spamc tests
contact that spamd and no attempt is made to start and stop it.

A flaw in the current setup is that I tried to make testing seamlessly include
tests of spamc but I did it by trying to make it work with a fully installed
SpamAssassin existing on the same physical computer under Cygwin. That is not
seamless, and doesn't even really make sense. Why do a full install under Cygwin
just to be able to run a test on a Windows install?

I have two proposals. I'm in favor of the first, but I'll put out the second as
a possiblity for consideration.

Both proposals start with separating the two cases. $SKIP_SPAMD_TESTS would
always be true under Windows and would only affect the spamd* tests.

In the first proposal, $SKIP_SPAMD_TESTS would suppress the spamc tests that
require spamd unless an environment variable indicated the host name and port of
a spamd to use. It is up to the person running the tests to make sure that spamd
is running on that host and port, properly configured for the tests. If
$SKIP_SPAMD_TESTS is true, then start_spamd and stop_spamd return doing nothing.

I think that's the easiest to implement and easiest to understand for the person
installing SpamAssassinon a Windows machine.

The second proposal is to write a test framework daemon for spamc that produces
the proper responses that spamd would for the specific test cases we are using
to test spamc. The advantage is that it would allow running tests of spamc under
Windows without requiring access to spamd running under Cygwin or on another
machine. (On the other hand, the installation will do no good without access to
some spamd when you want to use it). The disadvantage is that someone would have
to write it. I only mention this as an alternative in case somebody thinks it is
the way to go.

I think the first proposal can go into 3.0. It changes only the tests, and it
only affects the test under Windows which currently does not work right anyway
if you try to include tests of spamc.

I'll work up a patch for the first proposal after leaving some time for
discussion here.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 3513] spamc tests hang in Windows using Cygwin spamd [ In reply to ]
http://bugzilla.spamassassin.org/show_bug.cgi?id=3513





------- Additional Comments From jm@jmason.org 2004-06-16 17:10 -------
+1 on the first suggestion.




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 3513] spamc tests hang in Windows using Cygwin spamd [ In reply to ]
http://bugzilla.spamassassin.org/show_bug.cgi?id=3513

sidney@sidney.com changed:

What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|spamassassin- |sidney@sidney.com
|dev@incubator.apache.org |



------- Additional Comments From sidney@sidney.com 2004-06-17 12:34 -------
I'm taking the bug, working on a patch




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 3513] spamc tests hang in Windows using Cygwin spamd [ In reply to ]
http://bugzilla.spamassassin.org/show_bug.cgi?id=3513

spamassassin-contrib@msquadrat.de changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |spamassassin-
| |dev@incubator.apache.org





------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
[Bug 3513] spamc tests hang in Windows using Cygwin spamd [ In reply to ]
http://bugzilla.spamassassin.org/show_bug.cgi?id=3513





------- Additional Comments From sidney@sidney.com 2004-06-17 20:55 -------
Created an attachment (id=2050)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2050&action=view)
patch with proposed fix

I'm posting the attached patch for review. In addition to this bug it fixes the
following minor things I found while working on it:

removed a check for a -o option to spamc which I assume once existed but no
longer does.
- if($args !~ /\b(?:-p\s*[0-9]+|-o|-U)\b/)
+ if($args !~ /\b(?:-p\s*[0-9]+|-U)\b/)

removed all references to $spamd_never_started which did not do anything
because the one place that checks it is never called under any conditions in
which it was set.

With this patch there is no longer a SPAMD_SCRIPT environment variable. If you
want to run make test of the spamc_* tests on a system that does not have its
own spamd, set the environment variable SPAMD_HOST to the hostname where spamd
is listening. If the variable is not set, make test will spawn a spamd when it
needs one and kill it at the end of the test case. SPAMD_PORT should be set to
the port number if it is not the test default of 48373. The spamd daemon should
be running on the specified host before make test is started, and should be
started with at least the options -x -p ${SPAMD_PORT} -L. It is ok to use -D.

I think the above information needs to be put in a documentation file. I would
appreciate suggestions as to a good place to put it.




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.