Chapter 4. Regression testing

Table of Contents

4.1. Testing file systems

Regression testing is an important part of software development. Unfortunately, NetBSD does not have a consistent regression testing framework. Each subsystem defines its own set of tests in whichever form it wishes to stress test itself.

This chapter provides some guidelines on how to test different parts of the system, but please do keep in mind that the whole regression testing framework ought to be replaced with something better.

XXX: This chapter is extremely incomplete. It currently contains supporting documentation for Chapter 2, File system internals but nothing else.

4.1. Testing file systems

Testing file systems this is specially important because they work within kernel space; any unexpected failure is often fatal and renders the whole system unusable. Also, because there are literally hundreds of minor details to test, none of them should suffer regressions.

The tests for a given file system are stored inside a directory named after it, placed under src/regress/sys/fs/. For example, the tmpfs test suite lives in src/regress/sys/fs/tmpfs/. Generally, this directory is accompanied by a Makefile whose regress targets executes all the tests automatically.

The author of this text suggests you to add individual and independent tests for each feature you want to check, and within these, add as many subtests as you need to ensure that the whole feature works. For example, if you wanted to verify the mkdir vnode operation, you'd write a t_mkdir script that checks its functionality through the mkdir(1) command. This script could check that directories can be created, that they cannot be overwritten, that their link count is updated correctly, etc.

tmpfs comes with a good set of generic tests that can be reused for other file systems.