blob: ae898fadab54a62f0b876532a05d80f91e9b40b8 [file] [log] [blame]
nstraz7638a532000-10-09 20:35:46 +00001#LyX 1.1 created this file. For more info see http://www.lyx.org/
2\lyxformat 2.16
3\textclass docbook
4\begin_preamble
5<!entity header system "header.sgml">
6\end_preamble
7\language default
8\inputencoding default
9\fontscheme default
10\graphics default
11\paperfontsize default
Chris Dearman37550cf2012-10-17 19:54:01 -070012\spacing single
nstraz7638a532000-10-09 20:35:46 +000013\papersize Default
14\paperpackage a4
15\use_geometry 0
16\use_amsmath 0
17\paperorientation portrait
18\secnumdepth 3
19\tocdepth 3
20\paragraph_separation indent
21\defskip medskip
22\quotes_language english
23\quotes_times 2
24\papercolumns 1
25\papersides 1
26\paperpagestyle default
27
28\layout Title
Chris Dearman37550cf2012-10-17 19:54:01 -070029\added_space_top vfill \added_space_bottom vfill
nstraz7638a532000-10-09 20:35:46 +000030Linux Test Project HOWTO
31\layout Date
32
Chris Dearman37550cf2012-10-17 19:54:01 -07003310 October 2000
nstraz7638a532000-10-09 20:35:46 +000034\layout Author
35
36Nate Straz
37\layout Abstract
38
39This document explains some of the more in depth topics of the Linux Test
40 Project and related testing issues.
41 It does not cover basic installation procedures.
42 See the INSTALL and README files in the tarball for that information.
43\layout Section
44
45Preface
46\layout Standard
47
48This document was written to help bring the community up to speed on the
49 ins and outs of the Linux Test Project.
50\layout Subsection
51
Chris Dearman37550cf2012-10-17 19:54:01 -070052Copyright
nstraz7638a532000-10-09 20:35:46 +000053\layout Standard
54
55Copyright (c) 2000 by SGI, Inc.
Chris Dearman37550cf2012-10-17 19:54:01 -070056
nstraz7638a532000-10-09 20:35:46 +000057\layout Standard
58
59Please freely copy and distribute (sell or give away) this document in any
60 format.
61 It's requested that corrections and/or comments be fowarded to the document
62 maintainer.
Chris Dearman37550cf2012-10-17 19:54:01 -070063 You may create a derivative work and distribute it provided that you:
nstraz7638a532000-10-09 20:35:46 +000064\layout Itemize
65
66Send your derivative work (in the most suitable format such as sgml) to
67 the LDP (Linux Documentation Project) or the like for posting on the Internet.
68 If not the LDP, then let the LDP know where it is available.
Chris Dearman37550cf2012-10-17 19:54:01 -070069
nstraz7638a532000-10-09 20:35:46 +000070\layout Itemize
71
72License the derivative work with this same license or use GPL.
73 Include a copyright notice and at least a pointer to the license used.
Chris Dearman37550cf2012-10-17 19:54:01 -070074
nstraz7638a532000-10-09 20:35:46 +000075\layout Itemize
76
77Give due credit to previous authors and major contributors.
Chris Dearman37550cf2012-10-17 19:54:01 -070078
nstraz7638a532000-10-09 20:35:46 +000079\layout Standard
80
81If you're considering making a derived work other than a translation, it's
82 requested that you discuss your plans with the current maintainer.
Chris Dearman37550cf2012-10-17 19:54:01 -070083
nstraz7638a532000-10-09 20:35:46 +000084\layout Subsection
85
Chris Dearman37550cf2012-10-17 19:54:01 -070086Disclaimer
nstraz7638a532000-10-09 20:35:46 +000087\layout Standard
88
89Use the information in this document at your own risk.
90 I disavow any potential liability for the contents of this document.
91 Use of the concepts, examples, and/or other content of this document is
92 entirely at your own risk.
Chris Dearman37550cf2012-10-17 19:54:01 -070093
nstraz7638a532000-10-09 20:35:46 +000094\layout Standard
95
96All copyrights are owned by their owners, unless specifically noted otherwise.
97 Use of a term in this document should not be regarded as affecting the
98 validity of any trademark or service mark.
Chris Dearman37550cf2012-10-17 19:54:01 -070099
nstraz7638a532000-10-09 20:35:46 +0000100\layout Standard
101
102Naming of particular products or brands should not be seen as endorsements.
Chris Dearman37550cf2012-10-17 19:54:01 -0700103
nstraz7638a532000-10-09 20:35:46 +0000104\layout Standard
105
106You are strongly recommended to take a backup of your system before major
107 installation and backups at regular intervals.
Chris Dearman37550cf2012-10-17 19:54:01 -0700108
nstraz7638a532000-10-09 20:35:46 +0000109\layout Section
110
Chris Dearman37550cf2012-10-17 19:54:01 -0700111Introduction
nstraz7638a532000-10-09 20:35:46 +0000112\layout Subsection
113
Chris Dearman37550cf2012-10-17 19:54:01 -0700114What is the Linux Test Project?
nstraz7638a532000-10-09 20:35:46 +0000115\layout Standard
116
117The Linux Test Project (LTP) is an effort to create a set of tools and tests
118 to verify the functionality and stability of the Linux kernel.
119 We hope this will support Linux development by making unit testing more
120 complete and minimizing user impact by building a barrier to keep bugs
121 from making it to the user.
Chris Dearman37550cf2012-10-17 19:54:01 -0700122
nstraz7638a532000-10-09 20:35:46 +0000123\layout Subsection
124
Chris Dearman37550cf2012-10-17 19:54:01 -0700125What is wrong with the current testing model?
nstraz7638a532000-10-09 20:35:46 +0000126\layout Standard
127
128The Linux development community utilizes two important (some out argue most
129 important) testing techniques in its normal operations: Design and Code
130 Inspections.
131 The intent of LTP is to support this by giving developers an ever growing
132 set of tools to help identify any operational problems in their code that
133 may be missed by human review.
134 One of the toughest categories of problems to catch with inspection is
135 that of interaction of features.
136 With a continuously improving set of tests and tools, developers can get
137 an indication of whether their changes may have broken some other functionality.
Chris Dearman37550cf2012-10-17 19:54:01 -0700138
nstraz7638a532000-10-09 20:35:46 +0000139\layout Standard
140
141There is no such thing as a perfect test base.
142 It is only useful it if keeps up with new and changing functionality,
143 and if it actually gets used.
Chris Dearman37550cf2012-10-17 19:54:01 -0700144
nstraz7638a532000-10-09 20:35:46 +0000145\layout Subsection
146
Chris Dearman37550cf2012-10-17 19:54:01 -0700147Are you doing benchmarking?
nstraz7638a532000-10-09 20:35:46 +0000148\layout Standard
149
150Not at this time.
151 We are more interested in functional, regression, and stress testing the
152 Linux kernel.
153 Benchmarking may be workable to compare the performance among kernel versions.
Chris Dearman37550cf2012-10-17 19:54:01 -0700154
nstraz7638a532000-10-09 20:35:46 +0000155\layout Subsection
156
Chris Dearman37550cf2012-10-17 19:54:01 -0700157Are you doing standards testing?
nstraz7638a532000-10-09 20:35:46 +0000158\layout Standard
159
160No, we are leaving that to the Linux Standards Base (LSB).
Chris Dearman37550cf2012-10-17 19:54:01 -0700161 See the Linux Standards Base
nstraz7638a532000-10-09 20:35:46 +0000162\begin_inset LatexCommand \htmlurl[web site]{http://www.linuxbase.org/}
163
Chris Dearman37550cf2012-10-17 19:54:01 -0700164\end_inset
nstraz7638a532000-10-09 20:35:46 +0000165
166 for more information.
Chris Dearman37550cf2012-10-17 19:54:01 -0700167
nstraz7638a532000-10-09 20:35:46 +0000168\layout Section
169
Chris Dearman37550cf2012-10-17 19:54:01 -0700170Structure
nstraz7638a532000-10-09 20:35:46 +0000171\layout Standard
172
Chris Dearman37550cf2012-10-17 19:54:01 -0700173The basic building block of the test project is a
174\series bold
nstraz7638a532000-10-09 20:35:46 +0000175test case
Chris Dearman37550cf2012-10-17 19:54:01 -0700176\series default
nstraz7638a532000-10-09 20:35:46 +0000177 that consists of a single action and a verification that the action worked.
178 The result of the test case is usually restricted to PASS/FAIL.
Chris Dearman37550cf2012-10-17 19:54:01 -0700179
nstraz7638a532000-10-09 20:35:46 +0000180\layout Standard
181
Chris Dearman37550cf2012-10-17 19:54:01 -0700182A
183\series bold
nstraz7638a532000-10-09 20:35:46 +0000184test program
Chris Dearman37550cf2012-10-17 19:54:01 -0700185\series default
nstraz7638a532000-10-09 20:35:46 +0000186 is a runnable program that contains one or more test cases.
187 Test programs often understand command line options which alter their behavior.
188 The options could determine the amount of memory tested, the location of
189 temporary files, the type of network packet used, or any other useful parameter.
190\layout Standard
191
192
Chris Dearman37550cf2012-10-17 19:54:01 -0700193\series bold
nstraz7638a532000-10-09 20:35:46 +0000194Test tags
Chris Dearman37550cf2012-10-17 19:54:01 -0700195\series default
nstraz7638a532000-10-09 20:35:46 +0000196 are used to pair a unique identifier with a test program and a set of command
197 line options.
198 Test tags are the basis for test suites.
199\layout Section
200
Chris Dearman37550cf2012-10-17 19:54:01 -0700201Writing Tests
nstraz7638a532000-10-09 20:35:46 +0000202\layout Standard
203
204Writing a test case is a lot easier than most people think.
205 Any code that you write to examine how a part of the kernel works can
206 be adapted into a test case.
207 All that is needed is a way to report the result of the action to the
208 rest of the world.
209 There are several ways of doing this, some more involved than others.
Chris Dearman37550cf2012-10-17 19:54:01 -0700210
nstraz7638a532000-10-09 20:35:46 +0000211\layout Subsection
212
Chris Dearman37550cf2012-10-17 19:54:01 -0700213Exit Style Tests
nstraz7638a532000-10-09 20:35:46 +0000214\layout Standard
215
216Probably the simplest way of reporting the results of a test case is the
217 exit status of your program.
218 If your test program encounters unexpected or incorrect results, exit
219 the test program with a non-zero exit status, i.e.
Chris Dearman37550cf2012-10-17 19:54:01 -0700220
221\family typewriter
nstraz7638a532000-10-09 20:35:46 +0000222exit(1)
Chris Dearman37550cf2012-10-17 19:54:01 -0700223\family default
nstraz7638a532000-10-09 20:35:46 +0000224.
225 Conversely, if your program completes as expected, return a zero exit status,
226 i.e.
Chris Dearman37550cf2012-10-17 19:54:01 -0700227
228\family typewriter
nstraz7638a532000-10-09 20:35:46 +0000229exit(0)
Chris Dearman37550cf2012-10-17 19:54:01 -0700230\family default
nstraz7638a532000-10-09 20:35:46 +0000231.
232 Any test driver should be able to handle this type of error reporting.
233 If a test program has multiple test cases you won't know which test case
234 failed, but you will know the program that failed.
Chris Dearman37550cf2012-10-17 19:54:01 -0700235
nstraz7638a532000-10-09 20:35:46 +0000236\layout Subsection
237
Chris Dearman37550cf2012-10-17 19:54:01 -0700238Formatted Output Tests
nstraz7638a532000-10-09 20:35:46 +0000239\layout Standard
240
241The next easiest way of reporting the results is to write the results of
242 each test case to standard output.
243 This allows for the testing results to be more understandable to both the
244 tester and the analysis tools.
245 When the results are written in a standard way, tools can be used to analyze
246 the results.
Chris Dearman37550cf2012-10-17 19:54:01 -0700247
nstraz7638a532000-10-09 20:35:46 +0000248\layout Section
249
250Testing Tools
251\layout Standard
252
253The Linux Test Project has not yet decided on a "final" test harness.
Chris Dearman37550cf2012-10-17 19:54:01 -0700254 We have provided a simple solution with
255\family typewriter
subrata_modak14390fd2009-05-19 09:39:11 +0000256ltp-pan
Chris Dearman37550cf2012-10-17 19:54:01 -0700257\family default
nstraz7638a532000-10-09 20:35:46 +0000258 to make due until a complete solution has been found/created that compliments
259 the Linux kernel development process.
260 Several people have said we should use such and such a test harness.
261 Until we find we need a large complex test harness, we will apply the KISS
262 concept.
Chris Dearman37550cf2012-10-17 19:54:01 -0700263
nstraz7638a532000-10-09 20:35:46 +0000264\layout Subsection
265
subrata_modak14390fd2009-05-19 09:39:11 +0000266Ltp-pan
nstraz7638a532000-10-09 20:35:46 +0000267\layout Standard
268
269
Chris Dearman37550cf2012-10-17 19:54:01 -0700270\family typewriter
subrata_modak14390fd2009-05-19 09:39:11 +0000271ltp-pan
Chris Dearman37550cf2012-10-17 19:54:01 -0700272\family default
nstraz03d32f42000-10-11 22:46:16 +0000273 is a simple test driver with the ability to keep track of orphaned processes
274 and capture test output.
275 It works by reading a list of test tags and command lines and runs them.
subrata_modak14390fd2009-05-19 09:39:11 +0000276 By default ltp-pan will select a command randomly from the list of test tags,
nstraz03d32f42000-10-11 22:46:16 +0000277 wait for it to finish.
278 Through command line options you can run through the entire list sequentially,
279 run n tests, keep n test running at all times, and buffer test output.
subrata_modak14390fd2009-05-19 09:39:11 +0000280 Ltp-pan can be nested to create very complex test environments.
nstraz7638a532000-10-09 20:35:46 +0000281\layout Standard
282
Chris Dearman37550cf2012-10-17 19:54:01 -0700283Ltp-pan uses an
284\emph on
nstraz03d32f42000-10-11 22:46:16 +0000285active file
Chris Dearman37550cf2012-10-17 19:54:01 -0700286\emph default
287, also called a
288\emph on
nstraz03d32f42000-10-11 22:46:16 +0000289zoo file
Chris Dearman37550cf2012-10-17 19:54:01 -0700290\emph default
nstraz03d32f42000-10-11 22:46:16 +0000291 to keep track of which tests are currently running.
292 This file holds the pid, tag, and a portion of the command line.
subrata_modak14390fd2009-05-19 09:39:11 +0000293 When you start ltp-pan it becomes a test tag in itself, thus it requires a
nstraz03d32f42000-10-11 22:46:16 +0000294 name for itself.
subrata_modak14390fd2009-05-19 09:39:11 +0000295 Ltp-pan updates the active file to show which test tags are currently running.
296 When a test tag exits, ltp-pan will overwrite the first character with a '#'.
297 The active file can be shared between multiple instances of ltp-pan so you
nstraz03d32f42000-10-11 22:46:16 +0000298 know which tests were running when the system crashes by looking at one
299 file.
Chris Dearman37550cf2012-10-17 19:54:01 -0700300
nstraz03d32f42000-10-11 22:46:16 +0000301\layout Standard
302
Chris Dearman37550cf2012-10-17 19:54:01 -0700303A
304\emph on
subrata_modak14390fd2009-05-19 09:39:11 +0000305ltp-pan file
Chris Dearman37550cf2012-10-17 19:54:01 -0700306\emph default
subrata_modak14390fd2009-05-19 09:39:11 +0000307 contains a list of test tags for ltp-pan to run.
308 The format of a ltp-pan file is as follows:
nstraz562c7372000-10-10 21:57:51 +0000309\layout Code
310
nstrazce6eedd2000-10-13 21:14:14 +0000311
Chris Dearman37550cf2012-10-17 19:54:01 -0700312\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000313testtag testprogram -o one -p two other command line options
314\layout Code
315
nstrazce6eedd2000-10-13 21:14:14 +0000316
Chris Dearman37550cf2012-10-17 19:54:01 -0700317\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000318# This is a comment.
Chris Dearman37550cf2012-10-17 19:54:01 -0700319 It is a good idea to describe the test
nstraz562c7372000-10-10 21:57:51 +0000320\layout Code
321
nstrazce6eedd2000-10-13 21:14:14 +0000322
Chris Dearman37550cf2012-10-17 19:54:01 -0700323\latex no_latex
subrata_modak14390fd2009-05-19 09:39:11 +0000324# tags in your ltp-pan file.
Chris Dearman37550cf2012-10-17 19:54:01 -0700325 Tests programs can have different
nstraz562c7372000-10-10 21:57:51 +0000326\layout Code
327
nstrazce6eedd2000-10-13 21:14:14 +0000328
Chris Dearman37550cf2012-10-17 19:54:01 -0700329\latex no_latex
330# behaviors depending on the command line options so it is
nstraz562c7372000-10-10 21:57:51 +0000331\layout Code
332
nstrazce6eedd2000-10-13 21:14:14 +0000333
Chris Dearman37550cf2012-10-17 19:54:01 -0700334\latex no_latex
nstraz03d32f42000-10-11 22:46:16 +0000335# helpful to describe what each test tag is meant to verify or # provoke.
nstraz562c7372000-10-10 21:57:51 +0000336\layout Code
337
nstrazce6eedd2000-10-13 21:14:14 +0000338
Chris Dearman37550cf2012-10-17 19:54:01 -0700339\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000340# Some more test cases
341\layout Code
342
nstrazce6eedd2000-10-13 21:14:14 +0000343
Chris Dearman37550cf2012-10-17 19:54:01 -0700344\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000345mm01 mmap001 -m 10000
346\layout Code
347
nstrazce6eedd2000-10-13 21:14:14 +0000348
Chris Dearman37550cf2012-10-17 19:54:01 -0700349\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000350# 40 Mb mmap() test.
351\layout Code
352
nstrazce6eedd2000-10-13 21:14:14 +0000353
Chris Dearman37550cf2012-10-17 19:54:01 -0700354\latex no_latex
355# Creates a 10000 page mmap, touches all of the map, sync's
nstraz562c7372000-10-10 21:57:51 +0000356\layout Code
357
nstrazce6eedd2000-10-13 21:14:14 +0000358
Chris Dearman37550cf2012-10-17 19:54:01 -0700359\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000360# it, and munmap()s it.
361\layout Code
362
nstrazce6eedd2000-10-13 21:14:14 +0000363
Chris Dearman37550cf2012-10-17 19:54:01 -0700364\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000365mm03 mmap001 -i 0 -I 1 -m 100
366\layout Code
367
nstrazce6eedd2000-10-13 21:14:14 +0000368
Chris Dearman37550cf2012-10-17 19:54:01 -0700369\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000370# repetitive mmapping test.
371\layout Code
372
nstrazce6eedd2000-10-13 21:14:14 +0000373
Chris Dearman37550cf2012-10-17 19:54:01 -0700374\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000375# Creates a one page map repetitively for one minute.
376\layout Code
377
nstrazce6eedd2000-10-13 21:14:14 +0000378
Chris Dearman37550cf2012-10-17 19:54:01 -0700379\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000380dup02 dup02
381\layout Code
382
nstrazce6eedd2000-10-13 21:14:14 +0000383
Chris Dearman37550cf2012-10-17 19:54:01 -0700384\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000385# Negative test for dup(2) with bad fd
386\layout Code
387
nstrazce6eedd2000-10-13 21:14:14 +0000388
Chris Dearman37550cf2012-10-17 19:54:01 -0700389\latex no_latex
390kill09 kill09
nstraz562c7372000-10-10 21:57:51 +0000391\layout Code
392
nstrazce6eedd2000-10-13 21:14:14 +0000393
Chris Dearman37550cf2012-10-17 19:54:01 -0700394\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000395# Basic test for kill(2)
396\layout Code
397
nstrazce6eedd2000-10-13 21:14:14 +0000398
Chris Dearman37550cf2012-10-17 19:54:01 -0700399\latex no_latex
subrata_modak14390fd2009-05-19 09:39:11 +0000400fs-suite01 ltp-pan -e -a fs-suite01.zoo -n fs-suite01 -f runtest/fs
nstraz562c7372000-10-10 21:57:51 +0000401\layout Code
402
nstrazce6eedd2000-10-13 21:14:14 +0000403
Chris Dearman37550cf2012-10-17 19:54:01 -0700404\latex no_latex
nstraz562c7372000-10-10 21:57:51 +0000405# run the entire set of file system tests
406\layout Standard
407
nstraz03d32f42000-10-11 22:46:16 +0000408The test tags are simple identifiers, no spaces are allowed.
409 The test of the line is the program to run, which is done using execvp(3).
subrata_modak14390fd2009-05-19 09:39:11 +0000410 Lines starting with '#' are comments and ignored by ltp-pan.
nstraz03d32f42000-10-11 22:46:16 +0000411 It is a good practice to include descriptions with your test tags so you
412 can have a reminder what a certain obscure test tag tries to do.
413\layout Subsubsection
414
415Examples
nstrazce6eedd2000-10-13 21:14:14 +0000416\layout Standard
nstraz03d32f42000-10-11 22:46:16 +0000417
subrata_modak14390fd2009-05-19 09:39:11 +0000418The most basic way to run ltp-pan is by passing the test program and parameters
nstrazce6eedd2000-10-13 21:14:14 +0000419 on the command line.
420 This will run the single program once and wrap the output.
Chris Dearman37550cf2012-10-17 19:54:01 -0700421
nstrazce6eedd2000-10-13 21:14:14 +0000422\layout Code
423
424
Chris Dearman37550cf2012-10-17 19:54:01 -0700425\latex no_latex
subrata_modak14390fd2009-05-19 09:39:11 +0000426$ ltp-pan -a ltp.zoo -n tutor sleep 4
nstrazce6eedd2000-10-13 21:14:14 +0000427\layout Code
428
429
Chris Dearman37550cf2012-10-17 19:54:01 -0700430\latex no_latex
431<<<test_start>>>
nstrazce6eedd2000-10-13 21:14:14 +0000432\layout Code
433
434
Chris Dearman37550cf2012-10-17 19:54:01 -0700435\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000436tag=cmdln stime=971450564
437\layout Code
438
439
Chris Dearman37550cf2012-10-17 19:54:01 -0700440\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000441cmdline="sleep 4"
442\layout Code
443
444
Chris Dearman37550cf2012-10-17 19:54:01 -0700445\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000446contacts=""
447\layout Code
448
449
Chris Dearman37550cf2012-10-17 19:54:01 -0700450\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000451analysis=exit
452\layout Code
453
454
Chris Dearman37550cf2012-10-17 19:54:01 -0700455\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000456initiation_status="ok"
457\layout Code
458
459
Chris Dearman37550cf2012-10-17 19:54:01 -0700460\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000461<<<test_output>>>
462\layout Code
463
464
Chris Dearman37550cf2012-10-17 19:54:01 -0700465\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000466<<<execution_status>>>
467\layout Code
468
469
Chris Dearman37550cf2012-10-17 19:54:01 -0700470\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000471duration=103341903 termination_type=exited termination_id=0 corefile=no
472 cutime=0 cstime=0
473\layout Code
474
475
Chris Dearman37550cf2012-10-17 19:54:01 -0700476\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000477<<<test_end>>>
478\layout Code
479
480
Chris Dearman37550cf2012-10-17 19:54:01 -0700481\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000482$ cat ltp.zoo
483\layout Code
484
485
Chris Dearman37550cf2012-10-17 19:54:01 -0700486\latex no_latex
487#9357,tutor,pan/ltp-pan -a ltp.zoo -n tutor sleep 4
nstrazce6eedd2000-10-13 21:14:14 +0000488\layout Code
489
490
Chris Dearman37550cf2012-10-17 19:54:01 -0700491\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000492#9358,cmdln,sleep 4
493\layout Code
494
495
Chris Dearman37550cf2012-10-17 19:54:01 -0700496\latex no_latex
497$
nstrazce6eedd2000-10-13 21:14:14 +0000498\layout Paragraph
499
500How it works
501\layout Standard
502
subrata_modak14390fd2009-05-19 09:39:11 +0000503This example shows the two parameters that are always required by ltp-pan, the
504 active file and a test tag for ltp-pan.
Chris Dearman37550cf2012-10-17 19:54:01 -0700505 The
nstrazce6eedd2000-10-13 21:14:14 +0000506\begin_inset Quotes eld
Chris Dearman37550cf2012-10-17 19:54:01 -0700507\end_inset
nstrazce6eedd2000-10-13 21:14:14 +0000508
509sleep 4
510\begin_inset Quotes erd
Chris Dearman37550cf2012-10-17 19:54:01 -0700511\end_inset
nstrazce6eedd2000-10-13 21:14:14 +0000512
subrata_modak14390fd2009-05-19 09:39:11 +0000513 on the end of the command line is a test program and parameters that ltp-pan
nstrazce6eedd2000-10-13 21:14:14 +0000514 should run.
Chris Dearman37550cf2012-10-17 19:54:01 -0700515 This test is given the tag
nstrazce6eedd2000-10-13 21:14:14 +0000516\begin_inset Quotes eld
Chris Dearman37550cf2012-10-17 19:54:01 -0700517\end_inset
nstrazce6eedd2000-10-13 21:14:14 +0000518
519cmdln.
520\begin_inset Quotes erd
Chris Dearman37550cf2012-10-17 19:54:01 -0700521\end_inset
nstrazce6eedd2000-10-13 21:14:14 +0000522
subrata_modak14390fd2009-05-19 09:39:11 +0000523 Ltp-pan will run one test randomly, which ends up being cmdln since it is the
524 only test that we told ltp-pan about.
Chris Dearman37550cf2012-10-17 19:54:01 -0700525
nstrazce6eedd2000-10-13 21:14:14 +0000526\layout Standard
527
Chris Dearman37550cf2012-10-17 19:54:01 -0700528In the active file,
529\family typewriter
nstrazce6eedd2000-10-13 21:14:14 +0000530ltp.zoo
Chris Dearman37550cf2012-10-17 19:54:01 -0700531\family default
subrata_modak14390fd2009-05-19 09:39:11 +0000532, ltp-pan writes the pid, test tag, and part of the command line for the currently
nstrazce6eedd2000-10-13 21:14:14 +0000533 running tests.
534 The command lines are truncated so each line will fit on an 80 column display.
subrata_modak14390fd2009-05-19 09:39:11 +0000535 When a test tag finishes, ltp-pan will place a '#' at the beginning of the
nstrazce6eedd2000-10-13 21:14:14 +0000536 line to mark it as available.
subrata_modak14390fd2009-05-19 09:39:11 +0000537 Here you can see that cmdln and tutor, the name we gave ltp-pan, ran to completion.
nstrazce6eedd2000-10-13 21:14:14 +0000538 If the computer hangs, you can read this file to see which test programs
539 were running.
540\layout Standard
541
542We have run one test once.
543 Let's do something a little more exciting.
544 Let's run one test several times, at the same time.
Chris Dearman37550cf2012-10-17 19:54:01 -0700545
nstrazce6eedd2000-10-13 21:14:14 +0000546\layout Code
547
548
Chris Dearman37550cf2012-10-17 19:54:01 -0700549\latex no_latex
subrata_modak14390fd2009-05-19 09:39:11 +0000550$ ltp-pan -a ltp.zoo -n tutor -x 3 -s 3 -O /tmp sleep 1
nstrazce6eedd2000-10-13 21:14:14 +0000551\layout Code
552
553
Chris Dearman37550cf2012-10-17 19:54:01 -0700554\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000555<<<test_start>>>
556\layout Code
557
558
Chris Dearman37550cf2012-10-17 19:54:01 -0700559\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000560tag=cmdln stime=971465653
561\layout Code
562
563
Chris Dearman37550cf2012-10-17 19:54:01 -0700564\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000565cmdline="sleep 1"
566\layout Code
567
568
Chris Dearman37550cf2012-10-17 19:54:01 -0700569\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000570contacts=""
571\layout Code
572
573
Chris Dearman37550cf2012-10-17 19:54:01 -0700574\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000575analysis=exit
576\layout Code
577
578
Chris Dearman37550cf2012-10-17 19:54:01 -0700579\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000580initiation_status="ok"
581\layout Code
582
583
Chris Dearman37550cf2012-10-17 19:54:01 -0700584\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000585<<<test_output>>>
586\layout Code
587
588
Chris Dearman37550cf2012-10-17 19:54:01 -0700589\latex no_latex
590
nstrazce6eedd2000-10-13 21:14:14 +0000591\layout Code
592
593
Chris Dearman37550cf2012-10-17 19:54:01 -0700594\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000595<<<execution_status>>>
596\layout Code
597
598
Chris Dearman37550cf2012-10-17 19:54:01 -0700599\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000600duration=103326814 termination_type=exited termination_id=0 corefile=no
601\layout Code
602
603
Chris Dearman37550cf2012-10-17 19:54:01 -0700604\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000605cutime=1 cstime=0
606\layout Code
607
608
Chris Dearman37550cf2012-10-17 19:54:01 -0700609\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000610<<<test_end>>>
611\layout Code
612
613
Chris Dearman37550cf2012-10-17 19:54:01 -0700614\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000615<<<test_start>>>
616\layout Code
617
618
Chris Dearman37550cf2012-10-17 19:54:01 -0700619\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000620tag=cmdln stime=971465653
621\layout Code
622
623
Chris Dearman37550cf2012-10-17 19:54:01 -0700624\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000625cmdline="sleep 1"
626\layout Code
627
628
Chris Dearman37550cf2012-10-17 19:54:01 -0700629\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000630contacts=""
631\layout Code
632
633
Chris Dearman37550cf2012-10-17 19:54:01 -0700634\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000635analysis=exit
636\layout Code
637
638
Chris Dearman37550cf2012-10-17 19:54:01 -0700639\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000640initiation_status="ok"
641\layout Code
642
643
Chris Dearman37550cf2012-10-17 19:54:01 -0700644\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000645<<<test_output>>>
646\layout Code
647
648
Chris Dearman37550cf2012-10-17 19:54:01 -0700649\latex no_latex
650
nstrazce6eedd2000-10-13 21:14:14 +0000651\layout Code
652
653
Chris Dearman37550cf2012-10-17 19:54:01 -0700654\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000655<<<execution_status>>>
656\layout Code
657
658
Chris Dearman37550cf2012-10-17 19:54:01 -0700659\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000660duration=103326814 termination_type=exited termination_id=0 corefile=no
661\layout Code
662
663
Chris Dearman37550cf2012-10-17 19:54:01 -0700664\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000665cutime=0 cstime=1
666\layout Code
667
668
Chris Dearman37550cf2012-10-17 19:54:01 -0700669\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000670<<<test_end>>>
671\layout Code
672
673
Chris Dearman37550cf2012-10-17 19:54:01 -0700674\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000675<<<test_start>>>
676\layout Code
677
678
Chris Dearman37550cf2012-10-17 19:54:01 -0700679\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000680tag=cmdln stime=971465653
681\layout Code
682
683
Chris Dearman37550cf2012-10-17 19:54:01 -0700684\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000685cmdline="sleep 1"
686\layout Code
687
688
Chris Dearman37550cf2012-10-17 19:54:01 -0700689\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000690contacts=""
691\layout Code
692
693
Chris Dearman37550cf2012-10-17 19:54:01 -0700694\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000695analysis=exit
696\layout Code
697
698
Chris Dearman37550cf2012-10-17 19:54:01 -0700699\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000700initiation_status="ok"
701\layout Code
702
703
Chris Dearman37550cf2012-10-17 19:54:01 -0700704\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000705<<<test_output>>>
706\layout Code
707
708
Chris Dearman37550cf2012-10-17 19:54:01 -0700709\latex no_latex
710
nstrazce6eedd2000-10-13 21:14:14 +0000711\layout Code
712
713
Chris Dearman37550cf2012-10-17 19:54:01 -0700714\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000715<<<execution_status>>>
716\layout Code
717
718
Chris Dearman37550cf2012-10-17 19:54:01 -0700719\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000720duration=103326814 termination_type=exited termination_id=0 corefile=no
721\layout Code
722
723
Chris Dearman37550cf2012-10-17 19:54:01 -0700724\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000725cutime=0 cstime=0
726\layout Code
727
728
Chris Dearman37550cf2012-10-17 19:54:01 -0700729\latex no_latex
nstrazce6eedd2000-10-13 21:14:14 +0000730<<<test_end>>>
731\layout Paragraph
732
733How it works
734\layout Standard
735
736In this example we run another fake test from the command line, but we run
737 it three times (-s 3) and keep three test tags active at the same time
738 (-x 3).
739 The -O parameter is a directory where temporary files can be created to
740 buffer the output of each test tag.
741 You can see in the output that cmdln ran three times.
742 If the -O option were omitted, your test output would be mixed, making
743 it almost worthless.
Chris Dearman37550cf2012-10-17 19:54:01 -0700744
nstraz830a65b2000-10-12 16:39:25 +0000745\layout Itemize
746
subrata_modak14390fd2009-05-19 09:39:11 +0000747Using a ltp-pan file to run multiple tests
nstraz830a65b2000-10-12 16:39:25 +0000748\layout Itemize
749
subrata_modak14390fd2009-05-19 09:39:11 +0000750Nesting ltp-pan
nstraz03d32f42000-10-11 22:46:16 +0000751\layout Standard
752
Chris Dearman37550cf2012-10-17 19:54:01 -0700753For more information on ltp-pan see the man page
754\family typewriter
subrata_modak14390fd2009-05-19 09:39:11 +0000755doc/man1/ltp-pan.1
Chris Dearman37550cf2012-10-17 19:54:01 -0700756\family default
nstraz562c7372000-10-10 21:57:51 +0000757.
758\layout Subsection
759
760Scanner
761\layout Standard
762
nstraz7638a532000-10-09 20:35:46 +0000763
Chris Dearman37550cf2012-10-17 19:54:01 -0700764\family typewriter
subrata_modak14390fd2009-05-19 09:39:11 +0000765Ltp-scanner
Chris Dearman37550cf2012-10-17 19:54:01 -0700766\family default
767 is a results analysis tool that understands the
768\emph on
nstraz7638a532000-10-09 20:35:46 +0000769rts
Chris Dearman37550cf2012-10-17 19:54:01 -0700770\emph default
771 style output which
772\family typewriter
subrata_modak14390fd2009-05-19 09:39:11 +0000773ltp-pan
Chris Dearman37550cf2012-10-17 19:54:01 -0700774\family default
nstraz7638a532000-10-09 20:35:46 +0000775 generates by default.
776 It will produce a table summarizing which tests passed and which failed.
Chris Dearman37550cf2012-10-17 19:54:01 -0700777
nstraz7638a532000-10-09 20:35:46 +0000778\layout Subsection
779
nstraz562c7372000-10-10 21:57:51 +0000780The Quick-hitter Package
nstraz7638a532000-10-09 20:35:46 +0000781\layout Standard
782
nstraz562c7372000-10-10 21:57:51 +0000783Many of the tests released use the Quick-hitter test package to perform
784 tasks like create and move to a temporary directory, handle some common
785 command line parameters, loop, run in parallel, handle signals, and clean
786 up.
Chris Dearman37550cf2012-10-17 19:54:01 -0700787
nstraz562c7372000-10-10 21:57:51 +0000788\layout Standard
789
Chris Dearman37550cf2012-10-17 19:54:01 -0700790There is an example test case,
791\family typewriter
nstraz562c7372000-10-10 21:57:51 +0000792doc/examples/quickhit.c
Chris Dearman37550cf2012-10-17 19:54:01 -0700793\family default
nstraz562c7372000-10-10 21:57:51 +0000794, which shows how the quick-hitter package can be used.
795 The file is meant to be a supplement to the documentation, not a working
796 test case.
Chris Dearman37550cf2012-10-17 19:54:01 -0700797 Use any of the tests in
798\family typewriter
nstraz562c7372000-10-10 21:57:51 +0000799tests/
Chris Dearman37550cf2012-10-17 19:54:01 -0700800\family default
nstraz562c7372000-10-10 21:57:51 +0000801 as a template.
nstraz7638a532000-10-09 20:35:46 +0000802\layout Section
803
Chris Dearman37550cf2012-10-17 19:54:01 -0700804To Do
nstraz7638a532000-10-09 20:35:46 +0000805\layout Standard
806
nstraz562c7372000-10-10 21:57:51 +0000807There are a lot of things that still need to be done to make this a complete
nstraz7638a532000-10-09 20:35:46 +0000808 kernel testing system.
809 The following sections will discuss some of the to do items in detail.
Chris Dearman37550cf2012-10-17 19:54:01 -0700810
nstraz7638a532000-10-09 20:35:46 +0000811\layout Subsection
812
Chris Dearman37550cf2012-10-17 19:54:01 -0700813Configuration Analysis
nstraz7638a532000-10-09 20:35:46 +0000814\layout Standard
815
816While the number of configuration options for the Linux kernel is seen as
817 a strength to developers and users alike, it is a curse to testers.
818 To create a powerful automated testing system, we need to be able to determine
819 what the configuration on the booted box is and then determine which tests
820 should be run on that box.
Chris Dearman37550cf2012-10-17 19:54:01 -0700821
nstraz7638a532000-10-09 20:35:46 +0000822\layout Standard
823
824The Linux kernel has hundreds of configuration options that can be set to
825 compile the kernel.
826 There are more options that can be set when you boot the kernel and while
827 it is running.
828 There are also many patches that can be applied to the kernel to add functiona
829lity or change behavior.
Chris Dearman37550cf2012-10-17 19:54:01 -0700830
nstraz7638a532000-10-09 20:35:46 +0000831\layout Subsection
832
Chris Dearman37550cf2012-10-17 19:54:01 -0700833Result Comparison
nstraz7638a532000-10-09 20:35:46 +0000834\layout Standard
835
836A lot of testing will be done in the life of the Linux Test Project.
837 Keeping track of the results from all the testing will require some infrastruct
838ure.
839 It would be nice to take that output from a test machine, feed it to a
840 program and receive a list of items that broke since the last run on that
841 machine, or were fixed, or work on another test machine but not on this
842 one.
Chris Dearman37550cf2012-10-17 19:54:01 -0700843
nstraz7638a532000-10-09 20:35:46 +0000844\layout Section
845
Chris Dearman37550cf2012-10-17 19:54:01 -0700846Contact information and updates
nstraz7638a532000-10-09 20:35:46 +0000847\layout Literal
848
subrata_modak72ff4252007-07-24 10:09:02 +0000849URL: http://ltp.sourceforge.net/
nstraz7638a532000-10-09 20:35:46 +0000850\layout Literal
851
Cyril Hrubis70d7e8c2015-09-15 12:50:31 +0200852mailing list: ltp@lists.linux.it
nstraz7638a532000-10-09 20:35:46 +0000853\layout Literal
854
Cyril Hrubis70d7e8c2015-09-15 12:50:31 +0200855list archive: http://lists.linux.it/pipermail/ltp/
nstraz7638a532000-10-09 20:35:46 +0000856\layout Standard
857
subrata_modak72ff4252007-07-24 10:09:02 +0000858Questions and comments should be sent to the LTP mailing
Cyril Hrubis70d7e8c2015-09-15 12:50:31 +0200859 list at ltp@lists.linux.it. To subscribe, please go to
860 http://lists.linux.it/pipermail/ltp/.
Chris Dearman37550cf2012-10-17 19:54:01 -0700861
nstraz7638a532000-10-09 20:35:46 +0000862\layout Standard
863
864The source is also available via CVS.
865 See the web site for a web interface and check out instructions.
Chris Dearman37550cf2012-10-17 19:54:01 -0700866
nstraz7638a532000-10-09 20:35:46 +0000867\layout Section
868
Chris Dearman37550cf2012-10-17 19:54:01 -0700869Glossary
nstraz7638a532000-10-09 20:35:46 +0000870\layout Description
871
872Test IEEE/ANSI
Chris Dearman37550cf2012-10-17 19:54:01 -0700873\begin_float footnote
nstraz7638a532000-10-09 20:35:46 +0000874\layout Standard
875
876Kit, Edward, Software Testing in the Real World: Improving the Process.
877 P.
878 82.
879 ACM Press, 1995.
Chris Dearman37550cf2012-10-17 19:54:01 -0700880\end_float
881:
882\shape italic
nstraz7638a532000-10-09 20:35:46 +0000883
Chris Dearman37550cf2012-10-17 19:54:01 -0700884\newline
nstraz7638a532000-10-09 20:35:46 +0000885
Chris Dearman37550cf2012-10-17 19:54:01 -0700886\shape default
887
888\shape italic
nstraz7638a532000-10-09 20:35:46 +0000889(i)
Chris Dearman37550cf2012-10-17 19:54:01 -0700890\shape default
nstraz7638a532000-10-09 20:35:46 +0000891 An activity in which a system or component is executed under specified
892 conditions, the results are observed or record, and an evaluation is made
893 of some aspect of the system or component.
nstraz7638a532000-10-09 20:35:46 +0000894
Chris Dearman37550cf2012-10-17 19:54:01 -0700895\shape italic
nstraz7638a532000-10-09 20:35:46 +0000896
Chris Dearman37550cf2012-10-17 19:54:01 -0700897\newline
898
899\shape default
900
901\shape italic
nstraz7638a532000-10-09 20:35:46 +0000902(ii)
Chris Dearman37550cf2012-10-17 19:54:01 -0700903\shape default
nstraz7638a532000-10-09 20:35:46 +0000904 A set of one or more test cases.
Chris Dearman37550cf2012-10-17 19:54:01 -0700905
nstraz7638a532000-10-09 20:35:46 +0000906\layout Description
907
908Test\SpecialChar ~
909Case A test assertion with a single result that is being verified.
910 This allows designations such as PASS or FAIL to be applied to a single
911 bit of functionality.
912 A single test case may be one of many test cases for testing the complete
913 functionality of a system.
nstraz7638a532000-10-09 20:35:46 +0000914
Chris Dearman37550cf2012-10-17 19:54:01 -0700915\newline
916IEEE/ANSI:
917\shape italic
918
919\newline
nstraz7638a532000-10-09 20:35:46 +0000920(i)
Chris Dearman37550cf2012-10-17 19:54:01 -0700921\shape default
nstraz7638a532000-10-09 20:35:46 +0000922A set of test inputs, execution conditions, and expected results developed
923 for a particular objective.
nstraz7638a532000-10-09 20:35:46 +0000924
Chris Dearman37550cf2012-10-17 19:54:01 -0700925\shape italic
926
927\newline
nstraz7638a532000-10-09 20:35:46 +0000928(ii)
Chris Dearman37550cf2012-10-17 19:54:01 -0700929\shape default
nstraz7638a532000-10-09 20:35:46 +0000930 The smallest entity that is always executed as a unit, from beginning to
931 end.
Chris Dearman37550cf2012-10-17 19:54:01 -0700932
nstraz7638a532000-10-09 20:35:46 +0000933\layout Description
934
935Test\SpecialChar ~
936Driver A program that handles the execution of test programs.
937 It is responsible for starting the test programs, capturing their output,
938 and recording their results.
subrata_modak14390fd2009-05-19 09:39:11 +0000939 Ltp-pan is an example of a test driver.
nstraz7638a532000-10-09 20:35:46 +0000940\layout Description
941
942Test\SpecialChar ~
nstraz562c7372000-10-10 21:57:51 +0000943Framework A mechanism for organizing a group of tests.
nstraz7638a532000-10-09 20:35:46 +0000944 Frameworks may have complex or very simple API's, drivers and result logging
945 mechanisms.
946 Examples of frameworks are TETware and DejaGnu.
Chris Dearman37550cf2012-10-17 19:54:01 -0700947
nstraz7638a532000-10-09 20:35:46 +0000948\layout Description
949
950Test\SpecialChar ~
951Harness A Test harness is the mechanism that connects a test program
952 to a test framework.
953 It may be a specification of exit codes, or a set of libraries for formatting
954 messages and determining exit codes.
955 In TETware, the tet_result() API is the test harness.
Chris Dearman37550cf2012-10-17 19:54:01 -0700956
nstraz7638a532000-10-09 20:35:46 +0000957\layout Description
958
959Test\SpecialChar ~
960Program A single invokable program.
961 A test program can contain one or more test cases.
962 The test harness's API allows for reporting/analysis of the individual
963 test cases.
Chris Dearman37550cf2012-10-17 19:54:01 -0700964
nstraz7638a532000-10-09 20:35:46 +0000965\layout Description
966
967Test\SpecialChar ~
968Suite A collection of tests programs, assertions, cases grouped together
969 under a framework.
Chris Dearman37550cf2012-10-17 19:54:01 -0700970
nstraz7638a532000-10-09 20:35:46 +0000971\layout Description
972
973Test\SpecialChar ~
974Tag An identifier that corresponds to a command line which runs a test.
975 The tag is a single word that matches a test program with a set of command
976 line arguments.
Chris Dearman37550cf2012-10-17 19:54:01 -0700977
nstraz7638a532000-10-09 20:35:46 +0000978\the_end