• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, pkgconf / pkg-config, libc headers,
41linux kernel headers and other common development packages installed (see
42INSTALL and ci/*.sh), the chances are the following will work:
43
44```
45$ git clone https://github.com/linux-test-project/ltp.git
46$ cd ltp
47$ make autotools
48$ ./configure
49```
50
51Now you can continue either with compiling and running a single test or with
52compiling and installing the whole testsuite.
53
54For optional library dependencies look into scripts for major distros in
55`ci/` directory. You can also build whole LTP with `./build.sh` script.
56
57Shortcut to running a single test
58---------------------------------
59If you need to execute a single test you actually do not need to compile
60the whole LTP, if you want to run a syscall testcase following should work.
61
62```
63$ cd testcases/kernel/syscalls/foo
64$ make
65$ PATH=$PATH:$PWD ./foo01
66```
67
68Shell testcases are a bit more complicated since these need a path to a shell
69library as well as to compiled binary helpers, but generally following should
70work.
71
72```
73$ cd testcases/lib
74$ make
75$ cd ../commands/foo
76$ PATH=$PATH:$PWD:$PWD/../../lib/ ./foo01.sh
77```
78
79Open Posix Testsuite has it's own build system which needs Makefiles to be
80generated first, then compilation should work in subdirectories as well.
81
82```
83$ cd testcases/open_posix_testsuite/
84$ make generate-makefiles
85$ cd conformance/interfaces/foo
86$ make
87$ ./foo_1-1.run-test
88```
89
90Compiling and installing all testcases
91--------------------------------------
92
93```
94$ make
95$ make install
96```
97
98This will install LTP to `/opt/ltp`.
99* If you have a problem see `doc/mini-howto-building-ltp-from-git.txt`.
100* If you still have a problem see `INSTALL` and `./configure --help`.
101* Failing that, ask for help on the mailing list or Github.
102
103Some tests will be disabled if the configure script can not find their build
104dependencies.
105
106* If a test returns `TCONF` due to a missing component, check the `./configure`
107  output.
108* If a tests fails due to a missing user or group, see the Quick Start section
109  of `INSTALL`.
110
111Running tests
112-------------
113
114To run all the test suites
115
116```
117$ cd /opt/ltp
118$ ./runltp
119```
120
121Note that many test cases have to be executed as root.
122
123To run a particular test suite
124
125```
126$ ./runltp -f syscalls
127```
128
129To run all tests with `madvise` in the name
130
131```
132$ ./runltp -f syscalls -s madvise
133```
134Also see
135
136```
137$ ./runltp --help
138```
139
140Test suites (e.g. syscalls) are defined in the runtest directory. Each file
141contains a list of test cases in a simple format, see doc/ltp-run-files.txt.
142
143Each test case has its own executable or script, these can be executed
144directly
145
146```
147$ testcases/bin/abort01
148```
149
150Some have arguments
151
152```
153$ testcases/bin/fork13 -i 37
154```
155
156The vast majority of test cases accept the -h (help) switch
157
158```
159$ testcases/bin/ioctl01 -h
160```
161
162Many require certain environment variables to be set
163
164```
165$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh
166```
167
168Most commonly, the path variable needs to be set and also `LTPROOT`, but there
169are a number of other variables, `runltp` usually sets these for you.
170
171Note that all shell scripts need the `PATH` to be set. However this is not
172limited to shell scripts, many C based tests need environment variables as
173well.
174
175For more info see `doc/user-guide.txt` or online at
176https://github.com/linux-test-project/ltp/wiki/User-Guidelines.
177
178Network tests
179-------------
180Network tests require certain setup, described in `testcases/network/README.md`
181(online at https://github.com/linux-test-project/ltp/tree/master/testcases/network).
182
183Developers corner
184=================
185
186Before you start you should read following documents:
187
188* `doc/test-writing-guidelines.txt`
189* `doc/build-system-guide.txt`
190* `doc/library-api-writing-guidelines.txt`
191
192There is also a step-by-step tutorial:
193
194* `doc/c-test-tutorial-simple.txt`
195
196If something is not covered there don't hesitate to ask on the LTP mailing
197list. Also note that these documents are available online at:
198
199* https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines
200* https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines
201* https://github.com/linux-test-project/ltp/wiki/Build-System
202* https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial
203
204Although we accept GitHub pull requests, the preferred way is sending patches to our mailing list.
205
206It's a good idea to test patches on GitHub Actions before posting to mailing
207list. Our GitHub Actions setup covers various architectures and distributions in
208order to make sure LTP compiles cleanly on most common configurations.
209For testing you need to just to push your changes to your own LTP fork on GitHub.
210