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.

Categories
Uncategorized

Subversion Charset

I’ve just noticed in the pugs::hack document a useful tip for informing subversion about the charset of a file.

svn propset svn:mime-type "text/plain; charset=UTF-8" myfile

A quick browse through the subversion list archives shows that it appears to be “not forbidden” even if not 100% officially sanctioned. It’ll certainly work for its intended purpose of displaying character sets correctly when browsing a repository via HTTP.

Categories
Uncategorized

trac now available

I’ve just finished setting up trac for my subversion repository. trac is a very cool wiki / bug tracker / subversion repository browser from the nice people at edgewall.com. It’s also nice and easy to install from the FreeBSD ports collection: www/trac. It doesn’t work 100% right for me, because I have multiple projects in my repository. But for my limited personal use, it should be fine.

Categories
Uncategorized

Ant & JUnit

I’ve just been tripped up by ant & JUnit. I’m appalled. All the proposed solutions are both hackish and ugly. I don’t actually care about the intricacies of ClassLoaders. I just want a simple way to tell ant “junit is over here” so that my build and tests will work on whatever system I check out on. I don’t want to have to install stuff into the ant directory on each system. I already have junit.jar in my codebase, and it should be able to use it.

I suppose I could get around it by writing a build.sh which sets the CLASSPATH correctly, but I thought ant was supposed to avoid all that?

Categories
Uncategorized

Remote Eclipse Debugging

This article on Configuring Eclipse for Remote Debugging is very useful. Java debugging is really nice, because of the protocol for debugging a remote JVM. The first time I managed to debug a servlet in Eclipse, I was astonished.

Hang in there with the article. Most of it is irrelevant if you’ve used Eclipse at all before. Look for the heading Configuring a Remote Debugging Configuration in Eclipse, that’s where the useful bits start.

Categories
Uncategorized

SVK

As noted in my talk earlier, SVK is a really handy tool for building remote operation on top of subversion. If you haven’t tried it yet, you need too. I’ve just tried it and been absolutely blown away by its mirroring abilities.

I committed a change on a local copy of a mirror of XML-Genx. I then said svk push and saw the changes go back from the mirror to my master repository. I ran svn update in a working copy attached to the master repository and there were the changes. This rocks. Everybody needs SVK!

Categories
Uncategorized

XML::LibXML Oddity

This afternoon at work, I came across something most odd with XML::LibXML: When you call removeChild() on an element, it loses its namespace declarations. For example, if I have this XML:

<foo>
  <bar:bar xmlns:bar="http://example.com/" />
</foo>

Then, I call removeChild() on the <bar:bar> element, immediately followed by $node-&gt;toString(). And this is what I get back:

&lt;bar:bar/&gt;

Which is not well formed XML because the namespace declaration is missing. Somewhere along the line, the declaration is being lost. I suspect that it should be copied in to the $node when it’s removed from its parent document, but that’s not happening. As to whether this is a bug in XML::LibXML or libxml2, I don’t know. I’ll file a report and we’ll see what happens.

Update: how odd. This minimal test case works as expected. I’ll have to examine the original situation more closely to work out what I’m not reproducing…

Update#2: I got the example wrong. Actually, the source xml looked like this:

&lt;foo xmlns:bar="http://example.com/"&gt;
  &lt;bar:bar /&gt;
&lt;/foo&gt;

This fails as expected.

Categories
Uncategorized

Subversion for CVS Users

Today I gave a little presentation on Subversion for CVS Users at work. We’re switching to subversion for new projects rather than having a “big bang” repository conversion approach.

The slides were done using DOMSlides, which seem to work rather well. It’s quite minimalist, unlike S5, which I always find to be terribly slow for some reason.

Categories
Uncategorized

New Releases

I released new versions of XML-Genx and Config-Setting last night. No particular reason to do so, apart from seeing that my kwalitee ratings could be improved by testing for valid pod…

In fairness, I do need to play with Devel::Cover a bit to see if my tests could be improved. And I need to carry on updating XML::Schematron. So much to do, so little time…