nstraz | 7638a53 | 2000-10-09 20:35:46 +0000 | [diff] [blame^] | 1 | #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 |
| 12 | \spacing single |
| 13 | \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 |
| 29 | \added_space_top vfill \added_space_bottom vfill |
| 30 | Linux Test Project HOWTO |
| 31 | \layout Date |
| 32 | |
| 33 | 4 October 2000 |
| 34 | \layout Author |
| 35 | |
| 36 | Nate Straz |
| 37 | \layout Abstract |
| 38 | |
| 39 | This 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 | |
| 45 | Preface |
| 46 | \layout Standard |
| 47 | |
| 48 | This 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 | |
| 52 | Copyright |
| 53 | \layout Standard |
| 54 | |
| 55 | Copyright (c) 2000 by SGI, Inc. |
| 56 | |
| 57 | \layout Standard |
| 58 | |
| 59 | Please 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. |
| 63 | You may create a derivative work and distribute it provided that you: |
| 64 | \layout Itemize |
| 65 | |
| 66 | Send 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. |
| 69 | |
| 70 | \layout Itemize |
| 71 | |
| 72 | License the derivative work with this same license or use GPL. |
| 73 | Include a copyright notice and at least a pointer to the license used. |
| 74 | |
| 75 | \layout Itemize |
| 76 | |
| 77 | Give due credit to previous authors and major contributors. |
| 78 | |
| 79 | \layout Standard |
| 80 | |
| 81 | If you're considering making a derived work other than a translation, it's |
| 82 | requested that you discuss your plans with the current maintainer. |
| 83 | |
| 84 | \layout Subsection |
| 85 | |
| 86 | Disclaimer |
| 87 | \layout Standard |
| 88 | |
| 89 | Use 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. |
| 93 | |
| 94 | \layout Standard |
| 95 | |
| 96 | All 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. |
| 99 | |
| 100 | \layout Standard |
| 101 | |
| 102 | Naming of particular products or brands should not be seen as endorsements. |
| 103 | |
| 104 | \layout Standard |
| 105 | |
| 106 | You are strongly recommended to take a backup of your system before major |
| 107 | installation and backups at regular intervals. |
| 108 | |
| 109 | \layout Section |
| 110 | |
| 111 | Introduction |
| 112 | \layout Subsection |
| 113 | |
| 114 | What is the Linux Test Project? |
| 115 | \layout Standard |
| 116 | |
| 117 | The 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. |
| 122 | |
| 123 | \layout Subsection |
| 124 | |
| 125 | What is wrong with the current testing model? |
| 126 | \layout Standard |
| 127 | |
| 128 | The 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. |
| 138 | |
| 139 | \layout Standard |
| 140 | |
| 141 | There 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. |
| 144 | |
| 145 | \layout Subsection |
| 146 | |
| 147 | Are you doing benchmarking? |
| 148 | \layout Standard |
| 149 | |
| 150 | Not 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. |
| 154 | |
| 155 | \layout Subsection |
| 156 | |
| 157 | Are you doing standards testing? |
| 158 | \layout Standard |
| 159 | |
| 160 | No, we are leaving that to the Linux Standards Base (LSB). |
| 161 | See the Linux Standards Base |
| 162 | \begin_inset LatexCommand \htmlurl[web site]{http://www.linuxbase.org/} |
| 163 | |
| 164 | \end_inset |
| 165 | |
| 166 | for more information. |
| 167 | |
| 168 | \layout Section |
| 169 | |
| 170 | Structure |
| 171 | \layout Standard |
| 172 | |
| 173 | The basic building block of the test project is a |
| 174 | \series bold |
| 175 | test case |
| 176 | \series default |
| 177 | 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. |
| 179 | |
| 180 | \layout Standard |
| 181 | |
| 182 | A |
| 183 | \series bold |
| 184 | test program |
| 185 | \series default |
| 186 | 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 | |
| 193 | \series bold |
| 194 | Test tags |
| 195 | \series default |
| 196 | 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 | |
| 201 | Writing Tests |
| 202 | \layout Standard |
| 203 | |
| 204 | Writing 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. |
| 210 | |
| 211 | \layout Subsection |
| 212 | |
| 213 | Exit Style Tests |
| 214 | \layout Standard |
| 215 | |
| 216 | Probably 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. |
| 220 | |
| 221 | \family typewriter |
| 222 | exit(1) |
| 223 | \family default |
| 224 | . |
| 225 | Conversely, if your program completes as expected, return a zero exit status, |
| 226 | i.e. |
| 227 | |
| 228 | \family typewriter |
| 229 | exit(0) |
| 230 | \family default |
| 231 | . |
| 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. |
| 235 | |
| 236 | \layout Subsection |
| 237 | |
| 238 | Formatted Output Tests |
| 239 | \layout Standard |
| 240 | |
| 241 | The 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. |
| 247 | |
| 248 | \layout Section |
| 249 | |
| 250 | Testing Tools |
| 251 | \layout Standard |
| 252 | |
| 253 | The Linux Test Project has not yet decided on a "final" test harness. |
| 254 | We have provided a simple solution with |
| 255 | \family typewriter |
| 256 | pan |
| 257 | \family default |
| 258 | 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. |
| 263 | |
| 264 | \layout Subsection |
| 265 | |
| 266 | Pan and Scanner |
| 267 | \layout Standard |
| 268 | |
| 269 | |
| 270 | \family typewriter |
| 271 | pan |
| 272 | \family default |
| 273 | is a simple test driver. |
| 274 | It will take a list of test tags and command lines and run them. |
| 275 | |
| 276 | \family typewriter |
| 277 | pan |
| 278 | \family default |
| 279 | has the ability to run the test sequentially or randomly and in parallel |
| 280 | while capturing test output and cleaning up orphanned processes. |
| 281 | |
| 282 | \family typewriter |
| 283 | pan |
| 284 | \family default |
| 285 | can also be nested to create very complex test environments. |
| 286 | |
| 287 | \layout Standard |
| 288 | |
| 289 | |
| 290 | \family typewriter |
| 291 | scanner |
| 292 | \family default |
| 293 | is a results analysis tool that understands the |
| 294 | \emph on |
| 295 | rts |
| 296 | \emph default |
| 297 | style output which |
| 298 | \family typewriter |
| 299 | pan |
| 300 | \family default |
| 301 | generates by default. |
| 302 | It will produce a table summarizing which tests passed and which failed. |
| 303 | |
| 304 | \layout Subsubsection |
| 305 | |
| 306 | Example with Pan |
| 307 | \layout Standard |
| 308 | |
| 309 | This would be a Good Thing(tm) to have. |
| 310 | Show off the nesting that can be done with Pan |
| 311 | \layout Subsection |
| 312 | |
| 313 | The Quickhitter Package |
| 314 | \layout Standard |
| 315 | |
| 316 | Many of the tests released use the Quickhitter test package to perform tasks |
| 317 | like create and move to a temporary directory, handle some common command |
| 318 | line parameters, loop, run in parallel, handle signals, and clean up. |
| 319 | |
| 320 | \layout Section |
| 321 | |
| 322 | To Do |
| 323 | \layout Standard |
| 324 | |
| 325 | There are a lot of things that still need to be doine to make this a complete |
| 326 | kernel testing system. |
| 327 | The following sections will discuss some of the to do items in detail. |
| 328 | |
| 329 | \layout Subsection |
| 330 | |
| 331 | Configuration Analysis |
| 332 | \layout Standard |
| 333 | |
| 334 | While the number of configuration options for the Linux kernel is seen as |
| 335 | a strength to developers and users alike, it is a curse to testers. |
| 336 | To create a powerful automated testing system, we need to be able to determine |
| 337 | what the configuration on the booted box is and then determine which tests |
| 338 | should be run on that box. |
| 339 | |
| 340 | \layout Standard |
| 341 | |
| 342 | The Linux kernel has hundreds of configuration options that can be set to |
| 343 | compile the kernel. |
| 344 | There are more options that can be set when you boot the kernel and while |
| 345 | it is running. |
| 346 | There are also many patches that can be applied to the kernel to add functiona |
| 347 | lity or change behavior. |
| 348 | |
| 349 | \layout Subsection |
| 350 | |
| 351 | Result Comparison |
| 352 | \layout Standard |
| 353 | |
| 354 | A lot of testing will be done in the life of the Linux Test Project. |
| 355 | Keeping track of the results from all the testing will require some infrastruct |
| 356 | ure. |
| 357 | It would be nice to take that output from a test machine, feed it to a |
| 358 | program and receive a list of items that broke since the last run on that |
| 359 | machine, or were fixed, or work on another test machine but not on this |
| 360 | one. |
| 361 | |
| 362 | \layout Section |
| 363 | |
| 364 | Contact information and updates |
| 365 | \layout Literal |
| 366 | |
| 367 | URL: http://oss.sgi.com/projects/ltp/ |
| 368 | \layout Literal |
| 369 | |
| 370 | email: owners-ltp@oss.sgi.com |
| 371 | \layout Literal |
| 372 | |
| 373 | mailing list: ltp@oss.sgi.com |
| 374 | \layout Literal |
| 375 | |
| 376 | list archive: http://oss.sgi.com/projects/ltp/mail-threaded/ |
| 377 | \layout Standard |
| 378 | |
| 379 | Questions and comments should be sent to the LTP mailing list at ltp@oss.sgi.com. |
| 380 | To subscribe, send mail to majordomo@oss.sgi.com with "subscribe ltp" in |
| 381 | the body of the message. |
| 382 | |
| 383 | \layout Standard |
| 384 | |
| 385 | The source is also available via CVS. |
| 386 | See the web site for a web interface and check out instructions. |
| 387 | |
| 388 | \layout Section |
| 389 | |
| 390 | Glossary |
| 391 | \layout Description |
| 392 | |
| 393 | Test IEEE/ANSI |
| 394 | \begin_float footnote |
| 395 | \layout Standard |
| 396 | |
| 397 | Kit, Edward, Software Testing in the Real World: Improving the Process. |
| 398 | P. |
| 399 | 82. |
| 400 | ACM Press, 1995. |
| 401 | \end_float |
| 402 | : |
| 403 | \shape italic |
| 404 | |
| 405 | \newline |
| 406 | |
| 407 | \shape default |
| 408 | |
| 409 | \shape italic |
| 410 | (i) |
| 411 | \shape default |
| 412 | An activity in which a system or component is executed under specified |
| 413 | conditions, the results are observed or record, and an evaluation is made |
| 414 | of some aspect of the system or component. |
| 415 | |
| 416 | \shape italic |
| 417 | |
| 418 | \newline |
| 419 | |
| 420 | \shape default |
| 421 | |
| 422 | \shape italic |
| 423 | (ii) |
| 424 | \shape default |
| 425 | A set of one or more test cases. |
| 426 | |
| 427 | \layout Description |
| 428 | |
| 429 | Test\SpecialChar ~ |
| 430 | Case A test assertion with a single result that is being verified. |
| 431 | This allows designations such as PASS or FAIL to be applied to a single |
| 432 | bit of functionality. |
| 433 | A single test case may be one of many test cases for testing the complete |
| 434 | functionality of a system. |
| 435 | |
| 436 | \newline |
| 437 | IEEE/ANSI: |
| 438 | \shape italic |
| 439 | |
| 440 | \newline |
| 441 | (i) |
| 442 | \shape default |
| 443 | A set of test inputs, execution conditions, and expected results developed |
| 444 | for a particular objective. |
| 445 | |
| 446 | \shape italic |
| 447 | |
| 448 | \newline |
| 449 | (ii) |
| 450 | \shape default |
| 451 | The smallest entity that is always executed as a unit, from beginning to |
| 452 | end. |
| 453 | |
| 454 | \layout Description |
| 455 | |
| 456 | Test\SpecialChar ~ |
| 457 | Driver A program that handles the execution of test programs. |
| 458 | It is responsible for starting the test programs, capturing their output, |
| 459 | and recording their results. |
| 460 | Pan is an example of a test driver. |
| 461 | \layout Description |
| 462 | |
| 463 | Test\SpecialChar ~ |
| 464 | Framework A mechanism for organising a group of tests. |
| 465 | Frameworks may have complex or very simple API's, drivers and result logging |
| 466 | mechanisms. |
| 467 | Examples of frameworks are TETware and DejaGnu. |
| 468 | |
| 469 | \layout Description |
| 470 | |
| 471 | Test\SpecialChar ~ |
| 472 | Harness A Test harness is the mechanism that connects a test program |
| 473 | to a test framework. |
| 474 | It may be a specification of exit codes, or a set of libraries for formatting |
| 475 | messages and determining exit codes. |
| 476 | In TETware, the tet_result() API is the test harness. |
| 477 | |
| 478 | \layout Description |
| 479 | |
| 480 | Test\SpecialChar ~ |
| 481 | Program A single invokable program. |
| 482 | A test program can contain one or more test cases. |
| 483 | The test harness's API allows for reporting/analysis of the individual |
| 484 | test cases. |
| 485 | |
| 486 | \layout Description |
| 487 | |
| 488 | Test\SpecialChar ~ |
| 489 | Suite A collection of tests programs, assertions, cases grouped together |
| 490 | under a framework. |
| 491 | |
| 492 | \layout Description |
| 493 | |
| 494 | Test\SpecialChar ~ |
| 495 | Tag An identifier that corresponds to a command line which runs a test. |
| 496 | The tag is a single word that matches a test program with a set of command |
| 497 | line arguments. |
| 498 | |
| 499 | \the_end |