RFC -- perl test subpackage macros

Chris Weyl cweyl at alumni.drew.edu
Sat Feb 6 01:45:52 UTC 2010


I've been meaning to do this for ages, but I've finally updated
/etc/macros.perl with an initial set macros to assist in the
near-automatic generation of -tests subpackages.  They can also be
found at:

http://gist.github.com/284409

(If we start needing to really fork/edit, I'll switch it to a real
repo rather than a gist.)

The point here is to be able to quickly and easily validate an
installed system, or to do smoke testing against upgrades.  Several of
the "modern perl" suites (e.g. Moose, Catalyst, DBIx::Class, etc) are
very interdependent, and an upgrade of one package can break another.
(e.g. Class::MOP and Moose, Moose and Catalyst::Runtime, etc, etc.)
Having these tests easily installable and executable seems to be a key
first step in any sort of validation framework like this.

These should be considered experimental at this point; they should
always be conditionalized like %perl_default_filter, and their
behavior may change based on feedback / actual usage.  That being
said, I've been using these locally for the last month or so with no
show-stopper issues I'm aware of.

A couple notes:

* The %perl_subpackage_tests or %perl_default_subpackage_tests must be
explicitly invoked.  They play no role in a build unless invoked.
* They should be invoked in the same way the filtering macros are,
that is conditionalized, and before the first %description.
* No tests subpackage dependency RPM metadata is currently generated,
and autoreq/prov for the subpackage is disabled.
* Executable bit is set on *.t, and
* Shbang lines are normalized using ExtUtils::MM_Unix->fixin().
* Tests are installed under %{_libexecdir}/perl5-tests/<Dist-Name>
* Noisy.  The macros, particularly fix_shbang_line, generate a great
deal of output.

I intend on creating a small helper package to assist in
testing/validating installed configurations, but wanted to get these
out there for feedback before doing so.  These macros are not perfect,
but are at a point where we can have constructive feedback on them.
In particular, I'm hoping to hear back on the choice of the tests
directory and RPM dependency metadata.

The perl-Moose, -Class-MOP, and the -SQL-Translator packages have been
(...are being) rebuilt to demo this.  Note that the tests are not 100%
good-to-go with this; some expect write permissions where they
execute, some expect other files to be around, etc, but this is to be
expected and can be handled with upstream...  Right now my main thrust
is to get a solid framework in place.  :)

                                           -Chris
-- 
Chris Weyl
Ex astris, scientia



More information about the perl-devel mailing list