[rbldnsd] Disabling ipv6-specific tests

Michael Orlitzky michael at orlitzky.com
Mon Jul 29 00:30:55 MSK 2013


On Gentoo, users can enable tests globally, but may have ipv6 disabled in,

  * The kernel
  * Python
  * rbldnsd

Most of the tests in the new test suite rely on ipv6, but four do not.
I'd like to make it so the test suite doesn't fail on people without
ipv6. How do you feel about this approach?

  1. Define a new decorator, @requires_ipv6, that checks for ipv6 in
     those three locations. Checking python is easy with
     socket.has_ipv6. Checking rbldnsd is a little less easy -- the best
     way I've got so far is to check config.h if it exists. The kernel,
     I'll need to play around with. If ipv6 isn't present, we skip the
     test.

  2. Apply the decorator to any tests requiring ipv6. Example:

       @requires_ipv6
       def test_parents_internal_data(self):
           prefixes = [
           ...

  3. Use '127.0.0.1' instead of 'localhost' in test_ip4trie.py, in case
     the host has ipv6 but rbldnsd/python do not.

I haven't dug too deep yet, but my prototype works with ipv6 disabled in
rbldnsd:

  $ make check
  =============================================================
  Running btrie.test
  ......................
  OK
  =============================================================
  Running tests.py
  test_merge skipped due to lack of IPv6 in rbldnsd.
  test_steal_bits skipped due to lack of IPv6 in rbldnsd.
  ...
  test_refuse_ipv6 skipped due to lack of IPv6 in rbldnsd.
  test_pass_ipv6 skipped due to lack of IPv6 in rbldnsd.
  ....
  ----------------------------------------------------------------------
  Ran 4 tests in 0.841s

  OK


If the approach is acceptable, I could go back and do it right.


More information about the rbldnsd mailing list