Overview
Comment: | Updated the documentation |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
895455e988e8965d9ef652e00284b0e5 |
User & Date: | matt on 2011-05-16 23:50:52 |
Other Links: | manifest | tags |
Context
2011-05-16
| ||
23:59 | Updated the documentation check-in: 4a356a51e5 user: matt tags: trunk | |
23:50 | Updated the documentation check-in: 895455e988 user: matt tags: trunk | |
2011-05-14
| ||
18:09 | Merging subtest-rollup to trunk check-in: 00761e1112 user: matt tags: trunk, v1.06 | |
Changes
Modified docs/megatest.html from [a113e56825] to [aa66bfa737].
1 2 3 4 5 6 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="generator" content="http://www.nongnu.org/elyxer/"/> | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="generator" content="http://www.nongnu.org/elyxer/"/> <meta name="create-date" content="2011-05-16"/> <link rel="stylesheet" href="http://www.nongnu.org/elyxer/lyx.css" type="text/css" media="screen"/> <title>Megatest</title> </head> <body> <div id="globalWrapper"> <h1 class="title"> Megatest |
︙ | ︙ | |||
26 27 28 29 30 31 32 | Megatest is a minimalistic tool to help automate and manage the running of a suite of regression tests or other processes and to roll up the results for display on a web page or dashboard. </div> <div class="fulltoc"> <div class="tocheader"> Table of Contents </div> <div class="tocindent"> | < | | | > > > > | | | > > > | > | > > | | > > | | > > | > | > | > > > | > > | | > > > > > > > | | > | > | > | > > > | | | > > | > | > > > | | > > > | > > > | | | | | | | | | | > > > | | < < < | | | | | | | | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | Megatest is a minimalistic tool to help automate and manage the running of a suite of regression tests or other processes and to roll up the results for display on a web page or dashboard. </div> <div class="fulltoc"> <div class="tocheader"> Table of Contents </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Chapter-1">Chapter 1: About Megatest</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Section-1.1">Section 1.1: Megatest design philosophy</a> </div> <div class="toc"> <a class="Link" href="#toc-Section-1.2">Section 1.2: Megatest architecture</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Chapter-2">Chapter 2: Installation</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Section-2.1">Section 2.1: Compilation</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-2.1.1">Subsection 2.1.1: Dependencies</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-2.1.2">Subsection 2.1.2: Build and install</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Section-2.2">Section 2.2: Setup</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-2.2.1">Subsection 2.2.1: Create megatest.config</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-2.2.2">Subsection 2.2.2: Create runconfigs.config</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-2.2.3">Subsection 2.2.3: Create the tests directory and your first test</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-2.2.4">Subsection 2.2.4: Create the testconfig file for your test</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-2.2.5">Subsection 2.2.5: Create your test running script, main.sh</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-2.2.6">Subsection 2.2.6: Run megatest and watch your run progress</a> </div> </div> </div> <div class="toc"> <a class="Link" href="#toc-Chapter-3">Chapter 3: How to Write Tests</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Section-3.1">Section 3.1: A Simple Test with one Step</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-3.1.1">Subsection 3.1.1: Create your test directory. The directory name will be the name of the test</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-3.1.2">Subsection 3.1.2: Create your testconfig file. This file contains various specifications for your test. For our example the test author has chosen to write the test using csh scripting.</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-3.1.3">Subsection 3.1.3: Create your main.csh script</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Section-3.2">Section 3.2: Simple Test with Multiple Steps </a> </div> <div class="toc"> <a class="Link" href="#toc-Section-3.3">Section 3.3: Simple Test, Multiple Steps, Some in Parallel </a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-3.3.1">Subsection 3.3.1: The Makefile</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-3.3.2">Subsection 3.3.2: The main.csh file</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Section-3.4">Section 3.4: Simple Test with Iteration</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-3.4.1">Subsection 3.4.1: Update you testconfig file for iteration</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-3.4.2">Subsection 3.4.2: Rewrite your main.csh for iteration</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Section-3.5">Section 3.5: Tests with Inter-test dependencies</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Chapter-4">Chapter 4: Reference</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Section-4.1">Section 4.1: Configuration file Syntax</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-4.1.1">Subsection 4.1.1: Sections</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-4.1.2">Subsection 4.1.2: Variables</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-4.1.3">Subsection 4.1.3: Includes</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-4.1.4">Subsection 4.1.4: Setting a variable by running a command</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-4.1.5">Subsection 4.1.5: Notes</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Section-4.2">Section 4.2: Environment variables</a> </div> <div class="toc"> <a class="Link" href="#toc-Section-4.3">Section 4.3: Configuration files</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-4.3.1">Subsection 4.3.1: megatest.config</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-4.3.2">Subsection 4.3.2: runconfigs.config file</a> </div> </div> <div class="toc"> <a class="Link" href="#toc-Section-4.4">Section 4.4: Writing tests</a> </div> <div class="tocindent"> <div class="toc"> <a class="Link" href="#toc-Subsection-4.4.1">Subsection 4.4.1: testconfig file</a> </div> <div class="toc"> <a class="Link" href="#toc-Subsection-4.4.2">Subsection 4.4.2: Command line</a> </div> </div> </div> </div> </div> <h1 class="Chapter"> <a class="toc" name="toc-Chapter-1">1</a> About Megatest </h1> <h2 class="Section"> <a class="toc" name="toc-Section-1.1">1.1</a> Megatest design philosophy </h2> <div class="Unindented"> Megatest is intended to provide the minimum needed resources to make writing a suite of tests for software, design engineering or process control (via owlfs for example) without being specialized for any specific problem space. Megatest in of itself does not know what constitutes a PASS or FAIL of a test. In most cases megatest is best used in conjunction with logpro or a similar tool to parse, analyze and decide on the test outcome. A call to megatest can then be made to record the result. </div> <h2 class="Section"> <a class="toc" name="toc-Section-1.2">1.2</a> Megatest architecture </h2> <div class="Unindented"> All data to specify the tests and configure the system is stored in plain text files. All system state is stored in an sqlite3 database. Tests are launched using the launching system available for the distributed compute platform in use. A template script is provided which can launch jobs on local and remote Linux hosts. Currently megatest uses the network filesystem to “call home” to your master sqlite3 database. </div> <h1 class="Chapter"> <a class="toc" name="toc-Chapter-2">2</a> Installation </h1> <h2 class="Section"> <a class="toc" name="toc-Section-2.1">2.1</a> Compilation </h2> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.1.1">2.1.1</a> Dependencies </h3> <div class="Unindented"> Chicken scheme and a number of eggs are required for building megatest. See the file utils/installall.sh for an automated way to install the dependencies on Linux. </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.1.2">2.1.2</a> Build and install </h3> <div class="Unindented"> Run “make test” to create the megatest executable. You may wish to copy the executable to a centrally accessible location. </div> <h2 class="Section"> <a class="toc" name="toc-Section-2.2">2.2</a> Setup </h2> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.2.1">2.2.1</a> Create megatest.config </h3> <div class="Unindented"> Create the file megatest.config using the megatest.config template from the tests directory. At a minimum you need the following: </div> <div class="Code"> # Fields are the keys under which your test runs are organized </div> <div class="Code"> |
︙ | ︙ | |||
230 231 232 233 234 235 236 | </div> <div class="Code"> [disks] </div> <div class="Code"> 1 /tmp </div> | | | | | > > > > > | | | | < < | > | < < | < < | < < | < < | > > | < | | | | < < | > < < < | < < < > > > > | > > > > > | < | | | | < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < | | | | | | | | | | | | | | | | | | | | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | </div> <div class="Code"> [disks] </div> <div class="Code"> 1 /tmp </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.2.2">2.2.2</a> Create runconfigs.config </h3> <div class="Unindented"> This file is used to set environment variables that are run specific. You can simply create an empty file to start.<div class="listing"> <pre class="listing"># runconfigs.config </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.2.3">2.2.3</a> Create the tests directory and your first test </h3> <div class="Unindented"> The structure should look like this: </div> <div class="Indented"> <div class="listing"> <pre class="listing">../tests ├── megatest.config ├── runconfigs.config └── tests └── mytest ├── main.sh └── testconfig </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.2.4">2.2.4</a> Create the testconfig file for your test </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">[setup] runscript main.sh </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.2.5">2.2.5</a> Create your test running script, main.sh </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">#!/bin/bash megatest -runstep mystep1 "sleep 20;echo Done" -m "mystep1 is done" megatest -test-status :state COMPLETED :status PASS -m "This is a comment" </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-2.2.6">2.2.6</a> Run megatest and watch your run progress </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">megatest :field1 abc :field2 def :runname 2011week08.4a -runall watch megatest -list-runs % # OR use the dashboard dashboard & </pre> </div> </div> <div class="Code"> </div> <h1 class="Chapter"> <a class="toc" name="toc-Chapter-3">3</a> How to Write Tests </h1> <h2 class="Section"> <a class="toc" name="toc-Section-3.1">3.1</a> A Simple Test with one Step </h2> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-3.1.1">3.1.1</a> Create your test directory. The directory name will be the name of the test </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">mkdir simpletest cd simpletest </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-3.1.2">3.1.2</a> Create your testconfig file. This file contains various specifications for your test. For our example the test author has chosen to write the test using csh scripting. </h3> <div class="Unindented"> <div class="listing"> <pre class="listing"># testconfig [setup] runscript main.csh </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-3.1.3">3.1.3</a> Create your main.csh script </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">#!/bin/tcsh -x # run the cpu1 simulation. # The step name is "run_simulation" # The commandline being run for this step is "runsim cpu1" # The logpro file to validate the output from the run is "runsim.logpro" $MEGATEST -runstep run_simulation -logpro runsim.logpro "runsim cpu1" </pre> </div> </div> <div class="Indented"> You can now run megatest and the created test directory will contain the new files “run_simulation.html” and “run_simulation.log”. If you are using the dashboard you can click on the run and then push the “View log” button to view the log file in firefox. </div> <h2 class="Section"> <a class="toc" name="toc-Section-3.2">3.2</a> Simple Test with Multiple Steps </h2> <div class="Unindented"> To run multiple steps simply add them to the main.csh file. Here we add a step to test “cpu2”. The second step that tests cpu2 will only run after the step that tested “cpu1” completes. </div> <div class="Indented"> <div class="listing"> <pre class="listing">#!/bin/tcsh -x # run the cpu1 simulation. # The step name is "run_simulation" # The commandline being run for this step is "runsim cpu1" # The logpro file to validate the output from the run is "runsim.logpro" $MEGATEST -runstep run_simulation_cpu1 -logpro runsim.logpro "runsim cpu1" $MEGATEST -runstep run_simulation_cpu2 -logpro runsim.logpro "runsim cpu2" </pre> </div> </div> <h2 class="Section"> <a class="toc" name="toc-Section-3.3">3.3</a> Simple Test, Multiple Steps, Some in Parallel </h2> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-3.3.1">3.3.1</a> The Makefile </h3> <div class="Unindented"> A good way to run steps in parallel within a single test, especially when there are following steps, is to use the Unix Make utility. Writing Makefiles is beyond the scope of this document but here is a minimal example that will run “runsim cpu1” and “runsim cpu2” in parallel. For more information on make try “info make” at the Linux command prompt. </div> <div class="Indented"> <div class="listing"> <pre class="listing"># Example Makefile to run two steps in parallel RTLDIR=/path/to/rtl CPUS = cpu1 cpu2 run_simulation_$(CPUS).html : $(RTLDIR)/$(CPUS) $(MEGATEST) -runstep run_simulation_$(CPUS) -logpro runsim.logpro "runsim $(CPUS) </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-3.3.2">3.3.2</a> The main.csh file </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">#!/bin/tcsh -x # run the cpu1 and cpu2 simulations in parallel. # The -j parameter tells make how many jobs it may run in parallel make -j 2 </pre> </div> </div> <h2 class="Section"> <a class="toc" name="toc-Section-3.4">3.4</a> Simple Test with Iteration </h2> <div class="Unindented"> Since no jobs run after the cpu1 and cpu2 simulations inside the test there it is possible to run this test in iterated mode. </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-3.4.1">3.4.1</a> Update you testconfig file for iteration </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">[setup] runscript main.csh [items] CPU cpu1 cpu2 </pre> </div> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-3.4.2">3.4.2</a> Rewrite your main.csh for iteration </h3> <div class="Unindented"> <div class="listing"> <pre class="listing">#!/bin/tcsh -x # run the cpu simulation but now use the environment variable $CPU # to select what cpu to run the simulation against $MEGATEST -runstep run_simulation -logpro runsim.logpro "runsim $CPU" </pre> </div> </div> <h2 class="Section"> <a class="toc" name="toc-Section-3.5">3.5</a> Tests with Inter-test dependencies </h2> <div class="Unindented"> Sometimes a test depends on the output from a previous test or it may not make sense to run a test is another test does not complete with status “PASS”. In either of these scenarios you can use the “waiton” keyword in your testconfig file to indicate that this test must wait on one or more tests to complete before being launched. In this example there is no point in running the “system” test if the “cpu” and “mem” tests either do not complete or complete but with status “FAIL”. </div> <div class="Indented"> <div class="listing"> <pre class="listing"># testconfig for the "system" test [setup] runscript main.csh waiton cpu mem </pre> </div> </div> <h1 class="Chapter"> <a class="toc" name="toc-Chapter-4">4</a> Reference </h1> <h2 class="Section"> <a class="toc" name="toc-Section-4.1">4.1</a> Configuration file Syntax </h2> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.1.1">4.1.1</a> Sections </h3> <div class="Unindented"> [section name] </div> <blockquote class="Quotation"> This creates a section named “section name” </blockquote> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.1.2">4.1.2</a> Variables </h3> <div class="Unindented"> VARX has this value </div> <blockquote class="Quotation"> The variable “VARX” will have the value “has this value” </blockquote> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.1.3">4.1.3</a> Includes </h3> <div class="Unindented"> [include filename] </div> <div class="Indented"> The file named “filename” will be included as if part of the calling file. NOTE: This means no section can be named “include “ (with the whitespace). </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.1.4">4.1.4</a> Setting a variable by running a command </h3> <div class="Unindented"> VARNAME [system ls /tmp] </div> <blockquote class="Quotation"> The variable “VARNAME” will get a value created by the Unix command “ls /tmp”. All lines of output from the command will be joined with a space. </blockquote> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.1.5">4.1.5</a> Notes </h3> <ul> <li> Some variables are infered as lists. Each token on the line separated by whitespace will be member of the list. </li> <li> Comments (lines starting with #) and blank lines are ignored. </li> </ul> <h2 class="Section"> <a class="toc" name="toc-Section-4.2">4.2</a> Environment variables </h2> <div class="Unindented"> <table> <tr> <td align="left" valign="top"> Variable </td> <td align="left" valign="top"> |
︙ | ︙ | |||
467 468 469 470 471 472 473 | </td> </tr> </table> </div> | | | | | | | | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | </td> </tr> </table> </div> <h2 class="Section"> <a class="toc" name="toc-Section-4.3">4.3</a> Configuration files </h2> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.3.1">4.3.1</a> megatest.config </h3> <div class="Unindented"> <table> <tr> <td align="left" valign="top"> section </td> <td align="left" valign="top"> |
︙ | ︙ | |||
641 642 643 644 645 646 647 | </td> </tr> </table> </div> | | | | | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | </td> </tr> </table> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.3.2">4.3.2</a> runconfigs.config file </h3> <div class="Unindented"> <table> <tr> <td align="left" valign="top"> section </td> <td align="left" valign="top"> |
︙ | ︙ | |||
770 771 772 773 774 775 776 | </div> <div class="Code"> ENCRYPTION true </div> <div class="Code"> TESTPATH /nfs/testing/megacorp_runs </div> | | | | | | | | 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | </div> <div class="Code"> ENCRYPTION true </div> <div class="Code"> TESTPATH /nfs/testing/megacorp_runs </div> <h2 class="Section"> <a class="toc" name="toc-Section-4.4">4.4</a> Writing tests </h2> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.4.1">4.4.1</a> testconfig file </h3> <div class="Unindented"> <table> <tr> <td align="left" valign="top"> section </td> <td align="left" valign="top"> |
︙ | ︙ | |||
855 856 857 858 859 860 861 | </tr> </table> </div> <h3 class="Subsection"> | | | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | </tr> </table> </div> <h3 class="Subsection"> <a class="toc" name="toc-Subsection-4.4.2">4.4.2</a> Command line </h3> <div class="Unindented"> <table> <tr> <td align="left" valign="top"> switch or param </td> |
︙ | ︙ | |||
1196 1197 1198 1199 1200 1201 1202 | </table> </div> <hr class="footer"/> <div class="footer" id="generated-by"> | | | 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | </table> </div> <hr class="footer"/> <div class="footer" id="generated-by"> Document generated by <a href="http://elyxer.nongnu.org/">eLyXer 1.0.0 (2010-07-21)</a> on <span class="create-date">2011-05-16T22:49:35.164246</span> </div> </div> </body> </html> |
Modified docs/megatest.lyx from [b50d911082] to [98c122c376].
︙ | ︙ | |||
17 18 19 20 21 22 23 | \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \default_output_format default | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \default_output_format default \output_sync 1 \bibtex_command default \index_command default \paperfontsize default \spacing single \use_hyperref false \papersize default \use_geometry false |
︙ | ︙ | |||
83 84 85 86 87 88 89 | LatexCommand tableofcontents \end_inset \end_layout | | | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | LatexCommand tableofcontents \end_inset \end_layout \begin_layout Chapter About Megatest \end_layout \begin_layout Section Megatest design philosophy \end_layout \begin_layout Standard Megatest is intended to provide the minimum needed resources to make writing a suite of tests for software, design engineering or process control (via owlfs for example) without being specialized for any specific problem space. Megatest in of itself does not know what constitutes a PASS or FAIL of a test. In most cases megatest is best used in conjunction with logpro or a similar tool to parse, analyze and decide on the test outcome. A call to megatest can then be made to record the result. \end_layout \begin_layout Section Megatest architecture \end_layout \begin_layout Standard All data to specify the tests and configure the system is stored in plain text files. All system state is stored in an sqlite3 database. |
︙ | ︙ | |||
126 127 128 129 130 131 132 | call home \begin_inset Quotes erd \end_inset to your master sqlite3 database. \end_layout | | | | | | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | call home \begin_inset Quotes erd \end_inset to your master sqlite3 database. \end_layout \begin_layout Chapter Installation \end_layout \begin_layout Section Compilation \end_layout \begin_layout Subsection Dependencies \end_layout \begin_layout Standard Chicken scheme and a number of eggs are required for building megatest. See the file utils/installall.sh for an automated way to install the dependencie s on Linux. \end_layout \begin_layout Subsection Build and install \end_layout \begin_layout Standard Run \begin_inset Quotes eld \end_inset make test \begin_inset Quotes erd \end_inset to create the megatest executable. You may wish to copy the executable to a centrally accessible location. \end_layout \begin_layout Section Setup \end_layout \begin_layout Subsection Create megatest.config \end_layout \begin_layout Standard Create the file megatest.config using the megatest.config template from the tests directory. At a minimum you need the following: |
︙ | ︙ | |||
254 255 256 257 258 259 260 | [disks] \end_layout \begin_layout Code 1 /tmp \end_layout | | > > > > > > > > > > > > > > > > | > > > > > | > | > | | > | | > | | > | | > | | > | > > > > > | > > > > > | > | > > > > > > | > > > > > | > | | > | > > > > > | > | > > > | > > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | [disks] \end_layout \begin_layout Code 1 /tmp \end_layout \begin_layout Subsection Create runconfigs.config \end_layout \begin_layout Standard This file is used to set environment variables that are run specific. You can simply create an empty file to start. \begin_inset listings inline false status open \begin_layout Plain Layout # runconfigs.config \end_layout \begin_layout Plain Layout \end_layout \end_inset \end_layout \begin_layout Subsection Create the tests directory and your first test \end_layout \begin_layout Standard The structure should look like this: \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout ../tests \end_layout \begin_layout Plain Layout ├── megatest.config \end_layout \begin_layout Plain Layout ├── runconfigs.config \end_layout \begin_layout Plain Layout └── tests \end_layout \begin_layout Plain Layout └── mytest \end_layout \begin_layout Plain Layout ├── main.sh \end_layout \begin_layout Plain Layout └── testconfig \end_layout \end_inset \end_layout \begin_layout Subsection Create the testconfig file for your test \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout [setup] \end_layout \begin_layout Plain Layout runscript main.sh \end_layout \end_inset \end_layout \begin_layout Subsection Create your test running script, main.sh \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout #!/bin/bash \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout megatest -runstep mystep1 "sleep 20;echo Done" -m "mystep1 is done" \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout megatest -test-status :state COMPLETED :status PASS -m "This is a comment" \end_layout \end_inset \end_layout \begin_layout Subsection Run megatest and watch your run progress \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout megatest :field1 abc :field2 def :runname 2011week08.4a -runall \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout watch megatest -list-runs % \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout # OR use the dashboard \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout dashboard & \end_layout \end_inset \end_layout \begin_layout Code \end_layout \begin_layout Chapter How to Write Tests \end_layout \begin_layout Section A Simple Test with one Step \end_layout \begin_layout Subsection Create your test directory. The directory name will be the name of the test \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout mkdir simpletest \end_layout \begin_layout Plain Layout cd simpletest \end_layout \end_inset \end_layout \begin_layout Subsection Create your testconfig file. This file contains various specifications for your test. For our example the test author has chosen to write the test using csh scripting. \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout # testconfig \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout [setup] \end_layout \begin_layout Plain Layout runscript main.csh \end_layout \end_inset \end_layout \begin_layout Subsection Create your main.csh script \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout #!/bin/tcsh -x \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout # run the cpu1 simulation. \end_layout \begin_layout Plain Layout # The step name is "run_simulation" \end_layout \begin_layout Plain Layout # The commandline being run for this step is "runsim cpu1" \end_layout \begin_layout Plain Layout # The logpro file to validate the output from the run is "runsim.logpro" \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout $MEGATEST -runstep run_simulation -logpro runsim.logpro "runsim cpu1" \end_layout \end_inset \end_layout \begin_layout Standard You can now run megatest and the created test directory will contain the new files \begin_inset Quotes eld \end_inset run_simulation.html \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset run_simulation.log \begin_inset Quotes erd \end_inset . If you are using the dashboard you can click on the run and then push the \begin_inset Quotes eld \end_inset View log \begin_inset Quotes erd \end_inset button to view the log file in firefox. \end_layout \begin_layout Section Simple Test with Multiple Steps \end_layout \begin_layout Standard To run multiple steps simply add them to the main.csh file. Here we add a step to test \begin_inset Quotes eld \end_inset cpu2 \begin_inset Quotes erd \end_inset . The second step that tests cpu2 will only run after the step that tested \begin_inset Quotes eld \end_inset cpu1 \begin_inset Quotes erd \end_inset completes. \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout #!/bin/tcsh -x \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout # run the cpu1 simulation. \end_layout \begin_layout Plain Layout # The step name is "run_simulation" \end_layout \begin_layout Plain Layout # The commandline being run for this step is "runsim cpu1" \end_layout \begin_layout Plain Layout # The logpro file to validate the output from the run is "runsim.logpro" \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout $MEGATEST -runstep run_simulation_cpu1 -logpro runsim.logpro "runsim cpu1" \end_layout \begin_layout Plain Layout $MEGATEST -runstep run_simulation_cpu2 -logpro runsim.logpro "runsim cpu2" \end_layout \end_inset \end_layout \begin_layout Section Simple Test, Multiple Steps, Some in Parallel \end_layout \begin_layout Subsection The Makefile \end_layout \begin_layout Standard A good way to run steps in parallel within a single test, especially when there are following steps, is to use the Unix Make utility. Writing Makefiles is beyond the scope of this document but here is a minimal example that will run \begin_inset Quotes eld \end_inset runsim cpu1 \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset runsim cpu2 \begin_inset Quotes erd \end_inset in parallel. For more information on make try \begin_inset Quotes eld \end_inset info make \begin_inset Quotes erd \end_inset at the Linux command prompt. \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout # Example Makefile to run two steps in parallel \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout RTLDIR=/path/to/rtl \end_layout \begin_layout Plain Layout CPUS = cpu1 cpu2 \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout run_simulation_$(CPUS).html : $(RTLDIR)/$(CPUS) \end_layout \begin_layout Plain Layout $(MEGATEST) -runstep run_simulation_$(CPUS) -logpro runsim.logpro "runsim $(CPUS) \end_layout \end_inset \end_layout \begin_layout Subsection The main.csh file \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout #!/bin/tcsh -x \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout # run the cpu1 and cpu2 simulations in parallel. \end_layout \begin_layout Plain Layout # The -j parameter tells make how many jobs it may run in parallel \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout make -j 2 \end_layout \begin_layout Plain Layout \end_layout \end_inset \end_layout \begin_layout Section Simple Test with Iteration \end_layout \begin_layout Standard Since no jobs run after the cpu1 and cpu2 simulations inside the test there it is possible to run this test in iterated mode. \end_layout \begin_layout Subsection Update you testconfig file for iteration \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout [setup] \end_layout \begin_layout Plain Layout runscript main.csh \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout [items] \end_layout \begin_layout Plain Layout CPU cpu1 cpu2 \end_layout \end_inset \end_layout \begin_layout Subsection Rewrite your main.csh for iteration \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout #!/bin/tcsh -x \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout # run the cpu simulation but now use the environment variable $CPU \end_layout \begin_layout Plain Layout # to select what cpu to run the simulation against \end_layout \begin_layout Plain Layout \end_layout \begin_layout Plain Layout $MEGATEST -runstep run_simulation -logpro runsim.logpro "runsim $CPU" \end_layout \end_inset \end_layout \begin_layout Section Tests with Inter-test dependencies \end_layout \begin_layout Standard Sometimes a test depends on the output from a previous test or it may not make sense to run a test is another test does not complete with status \begin_inset Quotes eld \end_inset PASS \begin_inset Quotes erd \end_inset . In either of these scenarios you can use the \begin_inset Quotes eld \end_inset waiton \begin_inset Quotes erd \end_inset keyword in your testconfig file to indicate that this test must wait on one or more tests to complete before being launched. In this example there is no point in running the \begin_inset Quotes eld \end_inset system \begin_inset Quotes erd \end_inset test if the \begin_inset Quotes eld \end_inset cpu \begin_inset Quotes erd \end_inset and \begin_inset Quotes eld \end_inset mem \begin_inset Quotes erd \end_inset tests either do not complete or complete but with status \begin_inset Quotes eld \end_inset FAIL \begin_inset Quotes erd \end_inset . \end_layout \begin_layout Standard \begin_inset listings inline false status open \begin_layout Plain Layout # testconfig for the "system" test \end_layout \begin_layout Plain Layout [setup] \end_layout \begin_layout Plain Layout runscript main.csh \end_layout \begin_layout Plain Layout waiton cpu mem \end_layout \end_inset \end_layout \begin_layout Chapter Reference \end_layout \begin_layout Section Configuration file Syntax \end_layout \begin_layout Subsection Sections \end_layout \begin_layout Standard [section name] \end_layout \begin_layout Quotation This creates a section named \begin_inset Quotes eld \end_inset section name \begin_inset Quotes erd \end_inset \end_layout \begin_layout Subsection Variables \end_layout \begin_layout Standard VARX has this value \end_layout \begin_layout Quotation The variable \begin_inset Quotes eld \end_inset VARX \begin_inset Quotes erd \end_inset will have the value \begin_inset Quotes eld \end_inset has this value \begin_inset Quotes erd \end_inset \end_layout \begin_layout Subsection Includes \end_layout \begin_layout Standard [include filename] \end_layout |
︙ | ︙ | |||
429 430 431 432 433 434 435 | include \begin_inset Quotes eld \end_inset (with the whitespace). \end_layout | | | | | | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | include \begin_inset Quotes eld \end_inset (with the whitespace). \end_layout \begin_layout Subsection Setting a variable by running a command \end_layout \begin_layout Standard VARNAME [system ls /tmp] \end_layout \begin_layout Quotation The variable \begin_inset Quotes eld \end_inset VARNAME \begin_inset Quotes erd \end_inset will get a value created by the Unix command \begin_inset Quotes eld \end_inset ls /tmp \begin_inset Quotes erd \end_inset . All lines of output from the command will be joined with a space. \end_layout \begin_layout Subsection Notes \end_layout \begin_layout Itemize Some variables are infered as lists. Each token on the line separated by whitespace will be member of the list. \end_layout \begin_layout Itemize Comments (lines starting with #) and blank lines are ignored. \end_layout \begin_layout Section Environment variables \end_layout \begin_layout Standard \begin_inset Tabular <lyxtabular version="3" rows="9" columns="3"> <features tabularvalignment="middle"> |
︙ | ︙ | |||
770 771 772 773 774 775 776 | </lyxtabular> \end_inset \end_layout | | | | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | </lyxtabular> \end_inset \end_layout \begin_layout Section Configuration files \end_layout \begin_layout Subsection megatest.config \end_layout \begin_layout Standard \begin_inset Tabular <lyxtabular version="3" rows="9" columns="5"> <features tabularvalignment="middle"> |
︙ | ︙ | |||
1224 1225 1226 1227 1228 1229 1230 | </lyxtabular> \end_inset \end_layout | | | 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 | </lyxtabular> \end_inset \end_layout \begin_layout Subsection runconfigs.config file \end_layout \begin_layout Standard \begin_inset Tabular <lyxtabular version="3" rows="3" columns="5"> <features tabularvalignment="middle"> |
︙ | ︙ | |||
1483 1484 1485 1486 1487 1488 1489 | ENCRYPTION true \end_layout \begin_layout Code TESTPATH /nfs/testing/megacorp_runs \end_layout | | | | 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 | ENCRYPTION true \end_layout \begin_layout Code TESTPATH /nfs/testing/megacorp_runs \end_layout \begin_layout Section Writing tests \end_layout \begin_layout Subsection testconfig file \end_layout \begin_layout Standard \begin_inset Tabular <lyxtabular version="3" rows="4" columns="5"> <features tabularvalignment="middle"> |
︙ | ︙ |