Categories
Uncategorized

Perl CruiseControl Integration

Today and yesterday have been spent fighting with CruiseControl (CC). It’s a nice bit of software for doing continuous builds, like Mozilla’s tinderbox. Anyway, I got it running with a single project, the Money example from Test Driven Development by Example. Things I have learned about cruisecontrol:

  • ant and junit suck. Suckage can be avoided by using the ant included with CC.
  • The latest release, 2.3.0.1 doesn’t pass its tests. So I used the prebuilt version instead.
  • The latest release also includes a builtin Jetty server, which is neat. However, it’s not perfect yet and you will need to symlink the webapps directory into your build area.
  • CC gives weird ClassCastException errors if you mistype element names in the config.xml because it tries to load classes dynamically based upon the element name.
  • The Junit ant task can output XML. This format is totally undocumented, but appears to be simple to understand. I need to double check the source to be certain there aren’t any weird edge cases. And what is it with people who stuff all their data into attributes?

Anyway, the ultimate aim of all this is to get Perl builds integrated into CC. In particular, I want CC to checkout my CPAN modules, build them and run the tests. And I want those tests reported in the same manner as the JUnit ones inside CC. That’s not too much to ask is it?

So. I need to knock up an enhancement to Test::Harness, which has the ability to save its results in XML format in a specified directory. Just like the JUnit formatter. For the classname I shall use the name of the test file that’s being executed and for the name of the test, just use the number (plus description if applicable). I don’t know how to handle SKIP and TODO tests (I don’t think that JUnit has them), but if I just put out the description, that should be enough for now.

Once I’ve got that, I need to be able to shoehorn it arbitrarily into the build process. Probably the easiest way to do that is to import it by saying PERL5OPT=-MMy::Test::Harness.

After that, we should be set. My main concern is that the xml log that cruisecontrol uses won’t be able to make much sense of the build process that Perl uses, but so long as it can understand stdout / stderr I don’t think it’ll be a problem.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s