1Linux Test Project 2================== 3 4Linux Test Project is a joint project started by SGI, OSDL and Bull developed 5and maintained by IBM, Cisco, Fujitsu, SUSE, Red Hat, Oracle and others. The 6project goal is to deliver tests to the open source community that validate the 7reliability, robustness, and stability of Linux. 8 9The LTP testsuite contains a collection of tools for testing the Linux kernel 10and related features. Our goal is to improve the Linux kernel and system 11libraries by bringing test automation to the testing effort. Interested open 12source contributors are encouraged to join. 13 14Project pages are located at: http://linux-test-project.github.io/ 15 16The latest image is always available at: 17https://github.com/linux-test-project/ltp/releases 18 19The discussion about the project happens at ltp mailing list: 20http://lists.linux.it/listinfo/ltp 21 22The git repository is located at GitHub at: 23https://github.com/linux-test-project/ltp 24 25The patchwork instance is at: 26https://patchwork.ozlabs.org/project/ltp/list/ 27 28Warning! 29======== 30 31**Be careful with these tests!** 32 33Don't run them on production systems. Growfiles, doio, and iogen in particular 34stress the I/O capabilities of systems and while they should not cause problems 35on properly functioning systems, they are intended to find (or cause) problems. 36 37Quick guide to running the tests 38================================ 39 40If you have git, autoconf, automake, m4, the linux headers and the common 41developer packages installed, the chances are the following will work. 42 43``` 44$ git clone https://github.com/linux-test-project/ltp.git 45$ cd ltp 46$ make autotools 47$ ./configure 48``` 49 50Now you can continue either with compiling and running a single test or with 51compiling and installing the whole testsuite. 52 53Shortcut to running a single test 54--------------------------------- 55 56If you need to execute a single test you actually does not need to compile 57whole LTP, if you want to run a syscall testcase following should work. 58 59``` 60$ cd testcases/kernel/syscalls/foo 61$ make 62$ PATH=$PATH:$PWD ./foo01 63``` 64 65Shell testcases are a bit more complicated since these need a path to a shell 66library as well as to compiled binary helpers, but generally following should 67work. 68 69``` 70$ cd testcases/lib 71$ make 72$ cd ../commands/foo 73$ PATH=$PATH:$PWD:$PWD/../../lib/ ./foo01.sh 74``` 75 76Open Posix Testsuite has it's own build system which needs Makefiles to be 77generated first, then compilation should work in subdirectories as well. 78 79``` 80$ cd testcases/open_posix_testsuite/ 81$ make generate-makefiles 82$ cd conformance/interfaces/foo 83$ make 84$ ./foo_1-1.run-test 85``` 86 87Compiling and installing all testcases 88-------------------------------------- 89 90``` 91$ make 92$ make install 93``` 94 95This will install LTP to `/opt/ltp`. 96* If you have a problem see `doc/mini-howto-building-ltp-from-git.txt`. 97* If you still have a problem see `INSTALL` and `./configure --help`. 98* Failing that, ask for help on the mailing list or Github. 99 100Some tests will be disabled if the configure script can not find their build 101dependencies. 102 103* If a test returns `TCONF` due to a missing component, check the `./configure` 104 output. 105* If a tests fails due to a missing user or group, see the Quick Start section 106 of `INSTALL`. 107 108To run all the test suites 109 110``` 111$ cd /opt/ltp 112$ ./runltp 113``` 114 115Note that many test cases have to be executed as root. 116 117To run a particular test suite 118 119``` 120$ ./runltp -f syscalls 121``` 122 123To run all tests with `madvise` in the name 124 125``` 126$ ./runltp -f syscalls -s madvise 127``` 128Also see 129 130``` 131$ ./runltp --help 132``` 133 134Test suites (e.g. syscalls) are defined in the runtest directory. Each file 135contains a list of test cases in a simple format, see doc/ltp-run-files.txt. 136 137Each test case has its own executable or script, these can be executed 138directly 139 140``` 141$ testcases/bin/abort01 142``` 143 144Some have arguments 145 146``` 147$ testcases/bin/fork13 -i 37 148``` 149 150The vast majority of test cases accept the -h (help) switch 151 152``` 153$ testcases/bin/ioctl01 -h 154``` 155 156Many require certain environment variables to be set 157 158``` 159$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh 160``` 161 162Most commonly, the path variable needs to be set and also `LTPROOT`, but there 163are a number of other variables, `runltp` usually sets these for you. 164 165Note that all shell scripts need the `PATH` to be set. However this is not 166limited to shell scripts, many C based tests need environment variables as 167well. 168 169Developers corner 170================= 171 172Before you start you should read following documents: 173 174* `doc/test-writing-guidelines.txt` 175* `doc/build-system-guide.txt` 176 177There is also a step-by-step tutorial: 178 179* `doc/c-test-tutorial-simple.txt` 180 181If something is not covered there don't hesitate to ask on the LTP mailing 182list. Also note that these documents are available online at: 183 184* https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines 185* https://github.com/linux-test-project/ltp/wiki/BuildSystem 186* https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial 187 188Although we accept GitHub pull requests, the preferred way is sending patches to our mailing list. 189