Skip to content

Commit b471462

Browse files
author
mrwellan
committed
Added table of MT_ variables available to triggers.
1 parent 7f96658 commit b471462

File tree

2 files changed

+120
-7
lines changed

2 files changed

+120
-7
lines changed

docs/manual/megatest_manual.html

Lines changed: 95 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,11 +1417,31 @@ <h3 id="_config_file_additional_features">Config File Additional Features</h3>
14171417
B d e f</pre>
14181418
</div></div>
14191419
<div class="paragraph"><p>Then the config file would effectively appear to contain an items section
1420-
exactly like the output from the script. This is extremely useful when
1421-
dynamically creating items, itemstables and other config structures. You can
1422-
see the expansion of the call by looking in the cached files (look in your
1423-
linktree for megatest.config and runconfigs.config cache files and in your
1424-
test run areas for the expanded and cached testconfig).</p></div>
1420+
exactly like the output from the script. This is useful when dynamically
1421+
creating items, itemstables and other config structures. You can see the
1422+
expansion of the call by looking in the cached files (look in your linktree
1423+
for megatest.config and runconfigs.config cache files and in your test run
1424+
areas for the expanded and cached testconfig).</p></div>
1425+
<div class="paragraph"><p>Wildcards and regexes in Targets</p></div>
1426+
<div class="listingblock">
1427+
<div class="content monospaced">
1428+
<pre>[a/2/b]
1429+
VAR1 VAL1
1430+
1431+
[a/%/b]
1432+
VAR1 VAL2</pre>
1433+
</div></div>
1434+
<div class="paragraph"><p>Will result in:</p></div>
1435+
<div class="listingblock">
1436+
<div class="content monospaced">
1437+
<pre>[a/2/b]
1438+
VAR1 VAL2</pre>
1439+
</div></div>
1440+
<div class="paragraph"><p>Can use either wildcard of "%" or a regular expression:</p></div>
1441+
<div class="listingblock">
1442+
<div class="content monospaced">
1443+
<pre>[/abc.*def/]</pre>
1444+
</div></div>
14251445
<div class="sect3">
14261446
<h4 id="_disk_space_checks">Disk Space Checks</h4>
14271447
<div class="paragraph"><p>Some parameters you can put in the [setup] section of megatest.config:</p></div>
@@ -1925,6 +1945,74 @@ <h3 id="_triggers">Triggers</h3>
19251945
<td class="content">There is a trailing space after the --</td>
19261946
</tr></table>
19271947
</div>
1948+
<div class="paragraph"><p>There are a number of environment variables available to the trigger script
1949+
but since triggers can be called in various contexts not all variables are
1950+
available at all times. The trigger script should check for the variable and
1951+
fail gracefully if it doesn&#8217;t exist.</p></div>
1952+
<table class="tableblock frame-topbot grid-all"
1953+
style="
1954+
width:90%;
1955+
">
1956+
<caption class="title">Table 4. Environment variables visible to the trigger script</caption>
1957+
<col style="width:33%;">
1958+
<col style="width:66%;">
1959+
<thead>
1960+
<tr>
1961+
<th class="tableblock halign-center valign-top" >Variable </th>
1962+
<th class="tableblock halign-left valign-top" > Purpose</th>
1963+
</tr>
1964+
</thead>
1965+
<tbody>
1966+
<tr>
1967+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_TEST_RUN_DIR</p></td>
1968+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The directory where Megatest ran this test</p></td>
1969+
</tr>
1970+
<tr>
1971+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_CMDINFO</p></td>
1972+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">Encoded command data for the test</p></td>
1973+
</tr>
1974+
<tr>
1975+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_DEBUG_MODE</p></td>
1976+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">Used to pass the debug mode to nested calls to Megatest</p></td>
1977+
</tr>
1978+
<tr>
1979+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_RUN_AREA_HOME</p></td>
1980+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">Megatest home area</p></td>
1981+
</tr>
1982+
<tr>
1983+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_TESTSUITENAME</p></td>
1984+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The name of this testsuite or area</p></td>
1985+
</tr>
1986+
<tr>
1987+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_TEST_NAME</p></td>
1988+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The name of this test</p></td>
1989+
</tr>
1990+
<tr>
1991+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_ITEM_INFO</p></td>
1992+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The variable and values for the test item</p></td>
1993+
</tr>
1994+
<tr>
1995+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_MEGATEST</p></td>
1996+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">Which Megatest binary is being used by this area</p></td>
1997+
</tr>
1998+
<tr>
1999+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_TARGET</p></td>
2000+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The target variable values, separated by <em>/</em></p></td>
2001+
</tr>
2002+
<tr>
2003+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_LINKTREE</p></td>
2004+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The base of the link tree where all run tests can be found</p></td>
2005+
</tr>
2006+
<tr>
2007+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_ITEMPATH</p></td>
2008+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The values of the item path variables, separated by <em>/</em></p></td>
2009+
</tr>
2010+
<tr>
2011+
<td class="tableblock halign-center valign-top" ><p class="tableblock">MT_RUNNAME</p></td>
2012+
<td class="tableblock halign-left valign-top" ><p class="tableblock monospaced">The name of the run</p></td>
2013+
</tr>
2014+
</tbody>
2015+
</table>
19282016
</div>
19292017
<div class="sect2">
19302018
<h3 id="_override_the_toplevel_html_file">Override the Toplevel HTML File</h3>
@@ -2013,7 +2101,7 @@ <h2 id="_programming_api">Programming API</h2>
20132101
style="
20142102
width:70%;
20152103
">
2016-
<caption class="title">Table 4. API Keys Related Calls</caption>
2104+
<caption class="title">Table 5. API Keys Related Calls</caption>
20172105
<col style="width:14%;">
20182106
<col style="width:28%;">
20192107
<col style="width:28%;">
@@ -2065,7 +2153,7 @@ <h2 id="_example_index">Example Index</h2>
20652153
<div id="footer">
20662154
<div id="footer-text">
20672155
Version 1.0<br>
2068-
Last updated 2016-12-12 13:03:08 PST
2156+
Last updated 2017-04-12 13:34:13 PDT
20692157
</div>
20702158
</div>
20712159
</body>

docs/manual/reference.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ VAR1 VAL2
6969

7070
Can use either wildcard of "%" or a regular expression:
7171

72+
-------------------------
7273
[/abc.*def/]
74+
-------------------------
7375

7476
Disk Space Checks
7577
^^^^^^^^^^^^^^^^^
@@ -498,6 +500,29 @@ COMPLETED/ xterm -e bash -s --
498500

499501
NOTE: There is a trailing space after the --
500502

503+
There are a number of environment variables available to the trigger script
504+
but since triggers can be called in various contexts not all variables are
505+
available at all times. The trigger script should check for the variable and
506+
fail gracefully if it doesn't exist.
507+
508+
.Environment variables visible to the trigger script
509+
[width="90%",cols="^,2m",frame="topbot",options="header"]
510+
|======================
511+
|Variable | Purpose
512+
| MT_TEST_RUN_DIR | The directory where Megatest ran this test
513+
| MT_CMDINFO | Encoded command data for the test
514+
| MT_DEBUG_MODE | Used to pass the debug mode to nested calls to Megatest
515+
| MT_RUN_AREA_HOME | Megatest home area
516+
| MT_TESTSUITENAME | The name of this testsuite or area
517+
| MT_TEST_NAME | The name of this test
518+
| MT_ITEM_INFO | The variable and values for the test item
519+
| MT_MEGATEST | Which Megatest binary is being used by this area
520+
| MT_TARGET | The target variable values, separated by '/'
521+
| MT_LINKTREE | The base of the link tree where all run tests can be found
522+
| MT_ITEMPATH | The values of the item path variables, separated by '/'
523+
| MT_RUNNAME | The name of the run
524+
|======================
525+
501526

502527
Override the Toplevel HTML File
503528
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)