Linux Test Project

Previous: Introduction Home: Testing LTP Home Next: Developing Tests for LTP

Using LTP

One of the design goals of the Linux Test Project was to make it easy to use. To facilitate this, the LTP includes three scripts for executing subsets of the automated tests. They are:

The can be executed with little or manual setup required by the user. Even though the script is named "runalltests" it does not really run every test in the LTP. It runs all of the completely automated tests that do not require the user to perform manual setup tasks. Destructive tests and tests that consume so many system resources that they are designed to be run independently, such as a few of the memory tests, are not included in runalltests.

The script is a group of most the network tests. These are grouped separately because additional setup is required for these tests to function correctly. Two test machines are necessary to run all of the network tests. Both machines should have the same version of LTP compiled and installed in the same location. The client machine will be the one where the script is actually executed. On the server machine, a .rhosts entry should be created for the root user to allow connections from the client machine. The following services will need to be running for successful execution of the network test suite: rlogind, ftpd, telnetd, echo (stream), fingerd, and rshd. More detailed information about the setup for the machines running LTP may be found in the document called "How To Run the Linux Test Project(LTP) Test Suite" [RunLTP].

The script is a small test set that runs two io intensive tests. One of these targets the cdrom drive and the other targets the floppy drive. For the cdrom test to run, a cdrom with data on it must be inserted in the cdrom drive. For the floppy stress test to run, a blank, formatted floppy disk must be in the floppy drive.

The test driver itself is called pan. Pan can be passed a file that lists the tests to be executed, execute them, and exit with 0 if all tests passed, or with a number indicating how many tests failed. The line from that executes pan looks like this:

${LTPROOT}/pan/pan -e -S -a $$ -n $$
                  -f ${TMP}/alltests

The -e is necessary to tell pan to exit with the number of tests that failed. By default it will ignore exit statuses, but it is generally useful to have pan run this way.

The -D option tells pan to run tests sequentially as they are read from the command-file. If this option is not specified, it will select tests at random to run.

The -a $$ in the command line tells pan the name of a file to use to store the active test names, pids, and commands being executed. The $$ is used here to have it use the current pid so that a unique file is used to store this information.

The -n $$ in the command line is a tagname by which this pan process will be known. It is required and should be unique so $$ is convenient to use again.

The -f option is used to tell pan the name of a command-file to execute tests from. The command-file is a text file containing one test per line. The first item on the line is the tag name of the test, by which pan will know it. Usually this should match the TCID of the test. After the tag name and a space should be the executable with any necessary arguments. These files are usually stored under the runtest directory of LTP, but in the case of runalltests, several have been concatenated together into a file called alltests.

Another useful option for pan that is not used in runalltests is -s. The -s option tell pan the number of tests to run before exiting. If 0 is used here, pan will keep executing tests until it it manually stopped.

The -t option can be used to specify the amount of time pan should run tests. This time can be specified in seconds, minutes, hours, or days. For instance, -t 12h would tell pan to stop executing tests after 12 hours.

A complete list of options for pan can be found in the man page for pan in the /doc/man1 /citeLTPMan directory under LTP.

Tests may also be executed individually without the need for running them under pan or from a script. Once compiled, the tests are linked to under the /testcases/bin directory from the top of the LTP source tree. Testcases may be executed directly from here with any valid command line options. This is very useful when a particular test is observed to cause an error. The test can be executed alone to reproduce the error rather than waiting for the entire test suite to run.

Sometimes it is desirable to modify tests slightly for debugging purposes, or to add additional testing to them. To help make it easier to find tests, they have been organized under the testcases directory into four main categories.

Other tests that are not part of the automated test scripts previously mentioned may also be found under this directory tree. For these tests that are not automated, the only way to run them at the time being is manually.

Paul Larson 2002-09-11  Last modified on: August 02, 2006 - 17:13:54 UTC.