Structure
The basic building block of the test project is a test case that consists of a single action and a verification that the action worked. The result of the test case is usually restricted to PASS/FAIL.
A test program is a runnable program that contains one or more test cases. Test programs often understand command line options which alter their behavior. The options could determine the amount of memory tested, the location of temporary files, the type of network packet used, or any other useful parameter.
Test tags are used to pair a unique identifier with a test program and a set of command line options. Test tags are the basis for test suites.
Writing Tests
Writing a test case is a lot easier than most people think.
Any code that you write to examine how a part of the kernel
works can be adapted into a test case. All that is needed is a way to report the result of the action to the rest of the world. There are several ways of doing this, some more involved than others.
Exit Style Tests
Probably the simplest way of reporting the results of a test case is the exit status of your program. If your test program encounters unexpected or incorrect results, exit the test program with a non-zero exit status, i.e. exit(1). Conversely, if your program completes as expected, return a zero exit status, i.e. exit(0). Any test driver should be able to handle this type of error reporting. If a test program has multiple test cases you won't know which test case failed, but you will know the program that failed.
Formatted Output Tests
The next easiest way of reporting the results is to write the results of each test case to standard output. This allows for the testing results to be more understandable to both the tester and the analysis tools. When the results are written in a standard way, tools can be used to analyze the results.
Testing Tools
The Linux Test Project has not yet decided on a "final" test harness. We have provided a simple solution with ltp-pan to make due until a complete solution has been found/created that compliments the Linux kernel development process. Several people have said we should use such and such a test harness. Until we find we need a large complex test harness, we will apply the KISS concept.
Ltp-pan
Ltp-pan is a simple test driver with the ability to keep track of orphaned processes and capture test output. It works by reading a list of test tags and command lines and runs them. By default ltp-pan will select a command randomly from the list of test tags, wait for it to finish. Through command line options you can run through the entire list sequentially, run n tests, keep n test running at all times, and buffer test output. Ltp-pan can be nested to create very complex test environments.
Ltp-pan uses an active file, also called a zoo file to keep track of which tes