Tuesday, 29 January 2008

monitoring continuous integration

It has been a while since I last posted anything - sorry about that, I've been beavering away at Arum Systems building some interesting stuff with Flex and OSGi. More of that later.

For now though, just for fun, I decided it would be nice to be able to monitor our continuous integration environment (CruiseControl) in a slightly different way.

I got myself a USB experiment kit which has various inputs and outputs that can all be accessed via USB. Our CruiseControl runs on Linux, but exposes various ways of querying the status of the builds. I decided to run the hardware on the same Linux box, but use the XML for CCTray interface over HTTP, so in theory the USB kit could run anywhere - subject to an appropriate library being available for the OS.

The kit ships with a DLL for Windows but this wasn't going to be much use on Linux, so I downloaded the k8055 library for Linux which kindly replicates the DLL as a linux library.

My usual programming language is Java and that's what I wanted to work with for this project, so I decided to try out JNA which saves you the bother of writing JNI code - it simply wraps a shared object or DLL and maps it to an interface at runtime. Very handy!

In no time I had a Java program wrote which queried the XML from Cruise and was controlling the experiement kit.... a Cylon/Knight Rider display for when Cruise was building and a all lights flashing output for when the build was broken.

The only real problem I had was that when I first tried to run my code on Linux (I had it working on Windows in Eclipse IDE first using a stub for the interface which simulated the USB device), I got the following message:

symbol lookup error: /usr/lib/libk8055.so: undefined
symbol: usb_init

The solution was simply to add "-shared" as a linker option for the shared library in k8055's Makefile, clean build and that was it!

No comments: