Megatest

Artifact [1024506222]
Login

Artifact 1024506222e74b0310da68c5778a68ee01f56734:


<?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-08-03"/>
<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
</h1>
<h2 class="Date">
5/5/2011 
</h2>
<h2 class="author">
Matt Welland
</h2>
<div class="abstract">
<p class="abstract-message">
Abstract
</p>
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 with 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="Paragraph">
<a class="toc" name="toc-Paragraph-1"></a><div class="listing">
<pre class="listing"># Fields are the keys under which your test runs are organized
[fields]
field1 TEXT
field2 TEXT
​
[jobtools]
# The launcher launches jobs to the local or remote hosts,
# the job is managed on the target host by megatest,
# comment out launcher to run local only. An example launcher
# "nbfake" can be found in the utils directory. 
launcher nbfake
​
# The disks section specifies where the tests will be run. As you
# run out of space in a partition you can add additional disks
# entries.
# Format is:
# name /path/to/area 
[disks]
disk1 /tmp 
</pre>
</div>

</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="Paragraph">
<a class="toc" name="toc-Paragraph-2"></a><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="Paragraph">
<a class="toc" name="toc-Paragraph-3"></a><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="Paragraph">
<a class="toc" name="toc-Paragraph-4"></a><div class="listing">
<pre class="listing">#!/bin/bash
​
$MT_MEGATEST -runstep mystep1 "sleep 20;echo Done" -m "mystep1 is done"
​
$MT_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="Paragraph">
<a class="toc" name="toc-Paragraph-5"></a><div class="listing">
<pre class="listing">megatest :field1 abc :field2 def :runname 2011week08.4a -runall
​
watch megatest -list-runs %
​
# OR use the dashboard
​
dashboard &amp;
</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="Paragraph">
<a class="toc" name="toc-Paragraph-6"></a><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="Paragraph">
<a class="toc" name="toc-Paragraph-7"></a><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">
Note: Using csh is NOT recommended. Use bash, perl, ruby, zsh or anything other than csh. We use csh here because it is popular in some industries. 
</div>
<div class="Paragraph">
<a class="toc" name="toc-Paragraph-8"></a><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"
​
$MT_MEGATEST -runstep run_simulation -logpro runsim.logpro "runsim cpu1"
$MT_MEGATEST -test-status :state COMPLETED :status $?
</pre>
</div>

</div>
<div class="Unindented">
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="Paragraph">
<a class="toc" name="toc-Paragraph-9"></a><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"
​
$MT_MEGATEST -runstep run_simulation_cpu1 -logpro runsim.logpro "runsim cpu1" &amp;&amp; \
$MT_MEGATEST -runstep run_simulation_cpu2 -logpro runsim.logpro "runsim cpu2"
$MT_MEGATEST -test-status :state COMPLETED :status $?
</pre>
</div>

</div>
<h2 class="Section">
<a class="toc" name="toc-Section-3.3">3.3</a> Simple Test with 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="Paragraph">
<a class="toc" name="toc-Paragraph-10"></a><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)
	$(MT_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 
$MT_MEGATEST -test-status :state COMPLETED :status $?
</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 in this test it is possible to use 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="Paragraph">
<a class="toc" name="toc-Paragraph-11"></a><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="Paragraph">
<a class="toc" name="toc-Paragraph-12"></a><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
​
$MT_MEGATEST -runstep run_simulation -logpro runsim.logpro "runsim $CPU"
# As of version 1.07 Megatest automatically converts a status of "0"
# to "PASS", any other number to "FAIL" and directly uses the value of
# a string passed in.
$MT_MEGATEST -test-status :state COMPLETED :status $?
</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="Paragraph">
<a class="toc" name="toc-Paragraph-13"></a><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>
<blockquote class="Quotation">
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).
</blockquote>
<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">
Purpose
</td>
<td align="left" valign="top">
Default value/Comment
</td>

</tr>
<tr>
<td align="left" valign="top">
MT_CMDINFO
</td>
<td align="left" valign="top">
Conveys test variables to the megatest test runner.
</td>
<td align="left" valign="top">
Not for use by the end user
</td>

</tr>
<tr>
<td align="left" valign="top">
MT_TEST_RUN_DIR
</td>
<td align="left" valign="top">
Directory assigned by megatest for the test to run.
</td>
<td align="left" valign="top">
Tests can consider this their “home” directory
</td>

</tr>
<tr>
<td align="left" valign="top">
MT_TEST_NAME
</td>
<td align="left" valign="top">
Name of the test, corrosponds to the directory name under tests.
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
MT_ITEM_INFO
</td>
<td align="left" valign="top">
Iterated tests will set this to a sequence of key/values ((KEY val) ...) 
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
MT_RUN_AREA_HOME
</td>
<td align="left" valign="top">
Directory where megatest was launched from and where the tests code can be found
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
MT_RUNNAME
</td>
<td align="left" valign="top">
Name of this run as set by the :runname parameter
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
MT_MEGATEST
</td>
<td align="left" valign="top">
Path/Filename to megatest executable. Found either from called path or but using the “exectuable” keyword in the [setup] section.
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
&lt;field1&gt; ....
</td>
<td align="left" valign="top">
The field values as set on the megatest -runall command line (e.g. :field1 abc)
</td>
<td align="left" valign="top">
Planning ahead your field names is important so as to avoid collisions with other environment variables
</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">
variable
</td>
<td align="left" valign="top">
value
</td>
<td align="left" valign="top">
required
</td>
<td align="left" valign="top">
comment
</td>

</tr>
<tr>
<td align="left" valign="top">
[setup]
</td>
<td align="left" valign="top">
max_concurrent_jobs
</td>
<td align="left" valign="top">
if variable is not defined no limit on jobs
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
executable
</td>
<td align="left" valign="top">
full path to megatest binary
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">
Use only if necessary, megatest will extract the location from where it used to launch and add append that to the PATH for test runs.
</td>

</tr>
<tr>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
runsdir
</td>
<td align="left" valign="top">
full path to where the link tree to all runs will be created
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">
Because your runs may be spread out over several disk partitions a central link tree is created to make finding all the runs easy.
</td>

</tr>
<tr>
<td align="left" valign="top">
[fields]
</td>
<td align="left" valign="top">
string of letters, numbers and underscore
</td>
<td align="left" valign="top">
string of letters, numbers and underscore
</td>
<td align="left" valign="top">
at least one
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
[jobtools]
</td>
<td align="left" valign="top">
launcher
</td>
<td align="left" valign="top">
command line used to launch jobs - the job command (megatest -execute) will be appended to this
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
workhosts
</td>
<td align="left" valign="top">
list of hostnames to run jobs on NOT SUPPORTED RIGHT NOW
</td>
<td align="left" valign="top">
n/a
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
[env-override]
</td>
<td align="left" valign="top">
string of letters, numbers and underscore
</td>
<td align="left" valign="top">
any string
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">
These are set on the test launching machine, not the test running machine. Typical usage is to control the host or run queue for launching tests. These values will not be seen by the test when it runs.
</td>

</tr>
<tr>
<td align="left" valign="top">
[disks]
</td>
<td align="left" valign="top">
string of letters, numbers and underscore
</td>
<td align="left" valign="top">
a valid path writable by the test launching process and by the test process
</td>
<td align="left" valign="top">
yes
</td>
<td align="left" valign="top">
The disk usage balancing algorithm is to choose the disk with the least space for each test run. 
</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">
variable
</td>
<td align="left" valign="top">
value
</td>
<td align="left" valign="top">
required?
</td>
<td align="left" valign="top">
comment
</td>

</tr>
<tr>
<td align="left" valign="top">
[default]
</td>
<td align="left" valign="top">
string of letters, numbers and underscore
</td>
<td align="left" valign="top">
any
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">
variables set in this section will be available for all runs, defining the same variable in another section will override the value from the default section
</td>

</tr>
<tr>
<td align="left" valign="top">
[field1value/field2value...]
</td>
<td align="left" valign="top">
string of letters, numbers and underscore
</td>
<td align="left" valign="top">
any
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">
the values in this section will be set for any run where field1 is field1value, field2 is field2value and fieldN is fieldNvalue. 
</td>

</tr>

</table>

</div>
<div class="Indented">
Example: a test suite that checks that a piece of software works correctly for different customer configurations and locations each of which is done as a separate release regression run. The fields, CUSTOMER and LOCATION were chosen. The following runconfigs.config file would set some variables specific to runs for megacorp in India and femtocorp in the Cook Islands and New Zealand:
</div>
<div class="Indented">
<div class="listing">
<pre class="listing"># runconfigs.config
[default]
ENCRYTION true
​
[megacorp/india]
TESTPATH /nfs/testing/megacorp_runs
​
[femtocorp/cook_islands]
ENCRYTION false
TESTPATH /afs/kiatoa/testing/cook_islands
​
[femtocorp/new_zealand]
TESTPATH /afs/kiatoa/testing/new_zealand
​
[megacorp/new_zealand]
TESTPATH /nfs/testing/megacorp_runs
</pre>
</div>

</div>
<div class="Paragraph-">
<a class="toc" name="toc-Paragraph--1"></a>Running megatest like this:
</div>
<div class="Code">
megatest :CUSTOMER megacorp :LOCATION new_zealand :runname week12_2011_run1 -runall
</div>
<div class="Paragraph-">
<a class="toc" name="toc-Paragraph--2"></a>Would set:
</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">
variable
</td>
<td align="left" valign="top">
value
</td>
<td align="left" valign="top">
required?
</td>
<td align="left" valign="top">
comments
</td>

</tr>
<tr>
<td align="left" valign="top">
[setup]
</td>
<td align="left" valign="top">
runscript
</td>
<td align="left" valign="top">
name of script to execute for this test
</td>
<td align="left" valign="top">
yes
</td>
<td align="left" valign="top">
The script must be executable and either provide the full path or put a copy at the top of your test directory
</td>

</tr>
<tr>
<td align="left" valign="top">
[requirements]
</td>
<td align="left" valign="top">
waiton
</td>
<td align="left" valign="top">
list of valid test names
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">
This test will not run until the named tests are state completed and status PASS
</td>

</tr>
<tr>
<td align="left" valign="top">
[items]
</td>
<td align="left" valign="top">
any valid
</td>
<td align="left" valign="top">
list of values
</td>
<td align="left" valign="top">
no
</td>
<td align="left" valign="top">
The test will be repeated once for each item with the variable name set to the value. If there is more than one variable then the test will be run against all unique combinations of the values
</td>

</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>
<td align="left" valign="top">
parameter
</td>
<td align="left" valign="top">
purpose
</td>
<td align="left" valign="top">
comments
</td>

</tr>
<tr>
<td align="left" valign="top">
-h
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
brief help
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-runall
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
run all tests
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-runtests
</td>
<td align="left" valign="top">
test1,test2,...
</td>
<td align="left" valign="top">
run one or more tests
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-step
</td>
<td align="left" valign="top">
stepname
</td>
<td align="left" valign="top">
record a step
</td>
<td align="left" valign="top">
requires :state and :status
</td>

</tr>
<tr>
<td align="left" valign="top">
-test-status
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
record the test status
</td>
<td align="left" valign="top">
requires :state and :status
</td>

</tr>
<tr>
<td align="left" valign="top">
-setlog
</td>
<td align="left" valign="top">
logfilename
</td>
<td align="left" valign="top">
set the logfile name for a test
</td>
<td align="left" valign="top">
path is assumed to be relative to the test run directory
</td>

</tr>
<tr>
<td align="left" valign="top">
-set-toplog
</td>
<td align="left" valign="top">
logfilename
</td>
<td align="left" valign="top">
set the logfile name for the top test in an iterated test run
</td>
<td align="left" valign="top">
each sub test can have its own logfile set
</td>

</tr>
<tr>
<td align="left" valign="top">
-m
</td>
<td align="left" valign="top">
“comment”
</td>
<td align="left" valign="top">
sets a comment for the step, test or run
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
:runname
</td>
<td align="left" valign="top">
[a-zA-Z0-9_-]+
</td>
<td align="left" valign="top">
directory in which this run will be stored in the test run area 
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
:state
</td>
<td align="left" valign="top">
any value
</td>
<td align="left" valign="top">
Set the step or test state, this is stored in the state field in the steps or tests table respectively
</td>
<td align="left" valign="top">
For tests Megatest recognises “INCOMPLETE”, “COMPLETE”
</td>

</tr>
<tr>
<td align="left" valign="top">
:status
</td>
<td align="left" valign="top">
any value
</td>
<td align="left" valign="top">
Set the step or test status, this is stored in the status field in the steps or tests table respectively
</td>
<td align="left" valign="top">
For tests Megatest recognises “PASS”, “FAIL”, and “CHECK”
</td>

</tr>
<tr>
<td align="left" valign="top">
-list-runs
</td>
<td align="left" valign="top">
any value, % is wildcard
</td>
<td align="left" valign="top">
Respects -itempatt and -testpatt for filters
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-testpatt
</td>
<td align="left" valign="top">
any value, % is wildcard
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-itempatt
</td>
<td align="left" valign="top">
any value, % is wildcard
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-showkeys
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
Print the keys being used for this database
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-force
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
Test will not re-run if in the “PASS”, “CHECK” or “KILLED”, using -force will force the run to be launched.
</td>
<td align="left" valign="top">
WARNING: The -force switch will bypass any “waiton” dependencies.
</td>

</tr>
<tr>
<td align="left" valign="top">
-xterm
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
Launch an xterm instead of run the test. The xterm will have the environment that the test would see.
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-remove-runs
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
Remove a run, test or subtest from the database and the disk. Cannot be undone. Requires -testpatt, -itempatt, :runname and all keys be specified.
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
<i>Test helpers</i>
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-runstep
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
Used inside a test to run a step, record the start and end of the step and optionally analyze the output using logpro.
</td>
<td align="left" valign="top">

</td>

</tr>
<tr>
<td align="left" valign="top">
-logpro
</td>
<td align="left" valign="top">

</td>
<td align="left" valign="top">
If using logpro to asses the PASS/FAIL status of the step you specify the logpro file with this parameter.
</td>
<td align="left" valign="top">

</td>

</tr>

</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-08-03T20:43:07.693353</span>
</div>
</div>
</body>
</html>