For my programming languages course, I’ve had to develop two small libraries (written in Prolog and Common Lisp) to handle multivariate polynomials.

They are now both available on GitHub (Prolog version and Lisp one). During the development, I thought to use Jenkins, a popular CI software, to automatically run tests and show a nice report.

Whereas there are some tools which are better suited to accomplish what mentioned above, I’d still like to pursue the goal using Jenkins. This way, projects would not be cluttered with testing-related code.

Installing Jenkins

This is really straightforward. I’ve installed Jenkins on my personal server and configured nginx to serve it at

Jenkins with Prolog and Lisp

There are Jenkins plugin for many languages. Unfortunately, due to the low popularity of Prolog and Lisp, there is not a dedicated plugin for them. This is the point at which things are getting interesting.

Since Jenkins understands JUnit results, which are XML files, we could simulate the output of JUnit. I’ve found a brief description on this StackOverflow answer.

A few line of bash then suffice to reach our goal.

Prolog testing

The file consists in a list of goals, line separated, which are expected to succeed (thanks, unification!). The script runs swipl in quiet mode using as source and then executes the query. If the output is false. something bad happened and the test is marked as failed. Otherwise the test is considered to be successful.

Lisp testing

Lisp testing is achieved in a similar manner. Tests are listed in tests.lisp, with the difference that we cannot rely on unification this time. Instead, functions are wrapped within equal along with their expected result. This drastically simplifies the script, as it needs to run sbcl and check only for T or NIL (i.e., the result of equal).

GitHub hooks and conclusion

Jenkins was configured to run the bash script (for the appropriate language). Its output consists in a file report.xml which is in turn parsed to display tests in a nice interface.

To reach automation, GitHub hooks were configured to trigger Jenkins after every push on the repositories. The system worked really smoothly and greatly helped during the development of the libraries.