BSDCan2012 - Slide Update J

BSDCan 2012
The Technical BSD Conference

Brett Lymn
Day Talks - 1 - 2012-05-11
Room MRT 250
Start time 11:30
Duration 01:00
ID 317
Event type Lecture
Track Hacking
Language used for presentation English

Automated testing of libcurses in NetBSD

This talk will describe how the curses library was added to the standard tests performed by the Automated Test Framework in NetBSD. It will discuss how the approach used was chosen and the pitfalls encountered during the implementation.

The curses library is a reasonably large and complex library of functions. Making changes to the library functions can be fraught with danger because subtle bugs can be introduced into the code that cannot be detected merely by observing the output in a terminal only to emerge in some combination of events that are difficult to determine which makes debugging extremely difficult.

A project during the 2007 Google Summer of Code saw the introduction of an automated test framework (atf) that gave developers the framework in which to write test code to validate that their code is working as expected and that subsequent changes do not break functionality. By using ATF libcurses could be tested automatically to validate changes made to the library have not had an impact on the curses output, or, if there are changes, that these changes are expected and desired.

The challenge in bringing libcurses under ATF testing lay in how a library that expects to read and write from a terminal may be automatically tested. Not only from the point of view of handling the input and output but also trying to avoid a huge amount of very repetitive code. I have developed a unique solution for these problems that provides the curses library with the terminal interface it needs but allows ATF to manage a series of tests. This curses test framework is currently in the NetBSD-current tree and I am slowly working through adding tests for functions in the curses library. In this talk I will share the solution I have devised and discuss some of the challenges involved in testing an interactive library such as libcurses.