[SPF home]

Wayne's Projects

Sender Policy Framework Test Suite

The SPF Testing System is a collection of perl scripts, unix shell scripts (used to run the perl scripts) and test data files. It is designed to see how well an SPF implementation conforms to the official SPF specification, how well it conforms to the common API used by several different SPF implementations, and to catch many common bugs. It is far from complete in all respects and more tests will likely be added in the future.


The complete SPF test suites can be downloaded at:
28K tests_v2.0.tar.gz
28K tests_v2.1.tar.gz

You can also browse the test suites at:

The ABNF for the SPF record from SPF -02 specification has been converted into a regular expression. This regular expression will match all valid SPF records, and not match invalid ones. This regular expression is available both in an egrep compatible form and in a ruby/perl extended form. (These are actually based on a slightly updated version of the ABNF.)


The developement of the SPF test suite has been a community effort. It started out as Meng Weng Wong's test suite for the perl implementaiton, more tests were added by others, such as Philip Gladstone. I (Wayne Schlitt) then ported the perl test.pl script so that it could be used by the libspf C implementation and then I rewrote the test script and test databases to be much more portable to other implementations. Others, such as Stuart Gathman (Python implementation) and Roger Fullerton (Java implementation), have since sent in more updates and corrections.

Sadly, I have failed to keep accurate records of everyone who has contributed to the SPF test suite. If you know someone who isn't mentioned, please let me know!

SPF Test Suite Documenation

There isn't a whole lot of documentation yet. Volunteers to improve the situation would be most welcome.   :->

There are two general kinds of tests in the test suite:

  • Parser/verification tests

    These tests are designed to make sure the SPF implementations correctly parse SPF records and detect syntax errors. This is the kind of thing that many of the web based "SPF wizards" and verifiers should be tested on.

  • SPF evaluation tests

    These tests are designed to make sure the SPF implementations correctly evaluate SPF records and DNS errors.

More details about how the test system works can be found in the README file and in the test.txt and test_parser.txt test databases.

SPF record regular expressions27 Jun 2005

Now that we have a reasonably stable SPF specification, I have started working on the test suite again to make sure everything matches.

The good news is that I have been able to take the ABNF for the SPF record from SPF specification and convert it into a regular expression that will match all valid SPF records, and not match invalid ones.

The bad news is that, by using this regular expression, I have found several bugs in the test suite already and some minor ones in the SPF specification.

SPF test suite v2.125 Apr 2004

I'm pleased to announce an update to the SPF test system. This version is mostly changes that I made while working on libspf-alt v0.4, but includes a few bug fixes that Stuart Gathman found while testing his python implementation and Meng Wong found while working on the perl implementation. The biggest change is that the RCPT TO checks (e.g. perl's result2() and libspf-alt's result_2mx()) now work.

This test system has support for the perl M:S:Q, the libspf and the libspf-alt SPF implementations. The test system is pretty much a superset of the tests done by the perl, libspf-alt and the PHP (infinitepenguins) implemenations. It is based on the test system I developed for the initial release of libspf-alt, but I've made it more general and was able to support some of the new tests on perl and libspf implementations.

Old news can be found in the archive.

While I'm not an expert, I believe the information on this page is correct. Please send suggestions and corrections to the webmaster.
This web site runs on 100% Open Source Software. This web page was last changed on 07/25/2005 at 19:49:39.