<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1430/">https://reviewboard.asterisk.org/r/1430/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On September 14th, 2011, 1:56 p.m., <b>Paul Belanger</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/1430/diff/1/?file=20549#file20549line396" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/trunk/runtests.py</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">def run(self):</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">387</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">"></span><span class="se">\n\t\t</span><span class="s"><span class="hl"><</span>failure<span class="hl"> />"</span></span><span class="p">)</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">205</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">"></span><span class="se">\n\t\t</span><span class="si"><span class="hl">%s</span></span><span class="s"><span class="hl">"</span></span><span class="hl"> </span><span class="o"><span class="hl">%</span></span><span class="hl"> </span><span class="n"><span class="hl">t</span></span><span class="o"><span class="hl">.</span></span><span class="n">failure<span class="hl">_message</span></span><span class="p">)</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I mentioned this before, but I don't expect bamboo to be too happy parsing this. We'll have to keep a close eye on builds after this commit.
Basically, bamboo will default to passing, even if it cannot parse an XML file containing a failure.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Since we're having other issues with VM tests (which are currently serving as the guinea pigs for these), I think I'll comment this out for now and go with the standard failure blob. We can attempt to add the failure messages back in at a later date.</pre>
<br />
<p>- mjordan</p>
<br />
<p>On September 12th, 2011, 12:01 p.m., mjordan wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers and Paul Belanger.</div>
<div>By mjordan.</div>
<p style="color: grey;"><i>Updated Sept. 12, 2011, 12:01 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This patch provides a framework for doing pre- and post-test condition checking for an individual test run. This allows a test to take a snapshot of the state of its Asterisk instances before it executes and compare that against a snapshot of its Asterisk instances after the test executes. Depending on the test configuration, the test can either pass or fail based on whether or not resources were left uncollected in Asterisk after test execution.
The place in the test workflow where the conditions are evaluated is shown below:
main ConcreteTest TestClass TestConditionController
test.start_asterisk ----------------->start_asterisk
reactor.run -------------> run
|--------> run
|------------>evaluate_pre_checks()
|
test.stop_asterisk ------------------>stop_asterisk
|------------>evaluate_post_checks()
|
All pre- and post-test condition objects must inherit from the class TestCondition. The objects are created dynamically using python reflection and registered as either a pre- or post- check based on the test-config.yaml file for each test. Post TestConditions can be set to reference the Pre-Test condition object, such that the object is supplied to the post-test object during its evaluation. This allows the post-test condition object to make its evaluation based on the initial state of Asterisk as captured by the pre-test object. TestConditions are also allowed to have 'expected failure' states set to them, in case the tests in question are known to fail.
As part of this patch, a TestCondition set of objects were made to check for thread usage in Asterisk after a test. The objects ensure that after a test run, the threads currently active in Asterisk are the same threads that were active prior to the test run. The voicemail tests were updated to use this as an example.
Additionally, a few other enhancements were included with this patch:
1. A new class that allows tests to check what build options Asterisk was compiled with
2. Specifying the --test option now allows for a path to be specified as opposed to a specific test. All tests under that path will be executed, e.g., --test=tests/channels/SIP/ will execute all SIP tests
3. XML returned by runtests.py now includes ERROR log statements in the Failure message attribute
4. Test configuration was moved to its own class in the asterisk libraries. All TestClass-derived tests now have access to their configuration locally.
5. SIPpVersion was moved to the asterisk directory, as the other sipp related classes were already there and the TestConfig class in asterisk needed to reference it</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">trunk on local system.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/asterisk/trunk/lib/python/asterisk/ThreadTestCondition.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>/asterisk/trunk/lib/python/asterisk/buildoptions.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>/asterisk/trunk/lib/python/asterisk/TestState.py <span style="color: grey">(2176)</span></li>
<li>/asterisk/trunk/lib/python/asterisk/TestConditions.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>/asterisk/trunk/lib/python/asterisk/TestConfig.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>/asterisk/trunk/lib/python/asterisk/TestCase.py <span style="color: grey">(2176)</span></li>
<li>/asterisk/trunk/lib/python/asterisk/sippversion.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>/asterisk/trunk/lib/python/sipp/version.py <span style="color: grey">(2090)</span></li>
<li>/asterisk/trunk/runtests.py <span style="color: grey">(2090)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/authenticate_nominal/run-test <span style="color: grey">(2177)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/authenticate_nominal/test-config.yaml <span style="color: grey">(2094)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user/configs/ast1/extensions.conf <span style="color: grey">(2094)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user/run-test <span style="color: grey">(2176)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user/test-config.yaml <span style="color: grey">(2094)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf <span style="color: grey">(2094)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/test-config.yaml <span style="color: grey">(2094)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/func_vmcount/configs/ast1/extensions.conf <span style="color: grey">(2094)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/func_vmcount/test-config.yaml <span style="color: grey">(2094)</span></li>
<li>/asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/test-config.yaml <span style="color: grey">(2094)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1430/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>