Installation and tests execution

Basics requirements to build LTP are the following:

  • git

  • autoconf

  • automake

  • make

  • gcc

  • m4

  • pkgconf / pkg-config

  • libc headers

  • linux headers

$ git clone https://github.com/linux-test-project/ltp.git
$ cd ltp
$ make autotools
$ ./configure

Note

For optional library dependencies, take a look at the scripts inside ci/ directory.

Running single tests

LTP provides the possibility to build and run single tests:

$ cd testcases/kernel/syscalls/foo
$ make
$ PATH=$PATH:$PWD ./foo01

Shell testcases are a bit more complicated, since they need to setup PATH as well as to compiled binary helpers:

$ cd testcases/lib
$ make
$ cd ../commands/foo
$ PATH=$PATH:$PWD:$PWD/../../lib/ ./foo01.sh

Open Posix Testsuite has it’s own build system which needs Makefiles to be generated first:

$ cd testcases/open_posix_testsuite/
$ make generate-makefiles
$ cd conformance/interfaces/foo
$ make
$ ./foo_1-1.run-test

Compiling and installing all testcases

To compile all tests is really simple:

$ make

$ # install LTP inside /opt/ltp by default
$ make install

Note

Some tests will be disabled if configure script won’t find the build dependencies.

Running tests

To run all the test suites

$ cd /opt/ltp

$ # run syscalls testing suite
$ ./kirk -f ltp -r syscalls

Note

Many test cases have to be executed as root.

Test suites (e.g. syscalls) are defined in the runtest directory. Each file contains a list of test cases in a simple format.

Each test case has its own executable or script that can directly executed:

$ testcases/bin/abort01

$ # some tests have arguments
$ testcases/bin/mesgq_nstest -m none

$ # vast majority of tests have a help
$ testcases/bin/ioctl01 -h

$ # Many require certain environment variables to be set
$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh

Most commonly, the PATH variable needs to be set and also LTPROOT, but there are a number of other variables which usually kirk sets for you.

Note

All shell scripts need the PATH to be set. However, this is not limited to shell scripts and some C based tests need environment variables as well. They usually raise a configuration error when this is needed.

Network tests

Network tests usually require a certain setup that is described in testcases/network/README.md.