<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/3027/">https://reviewboard.asterisk.org/r/3027/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">In general, this looks like a good thing. The individual findings I have are quite few. There are some "un-pythonic" things going on in the code, the most common one being the way if statements are constructed. For instance, it's most common to have if statements that are "if something" or "if not something" when possible. So for instance, you could rewrite
if len(list):
do something
to
if list:
do something
and
if string != "":
do something
to
if string:
do something
and
if True == boolean:
do something
to
if boolean:
do something
Some other pythonistas may wish to chime in if there are other changes that may be warranted here.</pre>
<br />
<div>
<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/3027/diff/2/?file=48826#file48826line289" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</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 __start_asterisk_callback():</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">289</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">"Asterisk core waitfullybooted failed (wrong output), attempting again..."</span><span class="p">)</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I recommend outputting what the wrong output was.</pre>
</div>
<br />
<div>
<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/3027/diff/2/?file=48827#file48827line188" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">188</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">print</span> <span class="s">"Exception occurred valgrind logs from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I think you left a word out in this log message.</pre>
</div>
<br />
<p>- Mark Michelson</p>
<br />
<p>On November 25th, 2013, 11:10 p.m. UTC, Scott Griepentrog wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Scott Griepentrog.</div>
<p style="color: grey;"><i>Updated Nov. 25, 2013, 11:10 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
testsuite
</div>
<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 adds support for running Asterisk under Valgrind (say: Val-Grinned) to check for all sorts of nasty runtime bugs. This started off with a post to asterisk-dev list by nitesh.bansal@gmail.com, and he wrote and contributed the initial version. So if you find this useful, be sure to thank him. Then I made extensive changes and additions, so if the code stinks, blame me.
The following has been done:
- Check runtests.py arguments for --valgrind and --valgrind-gensupp flags, pass via environ to TestCase.py
- Note previously existing instances of ast# logs to insure we only process new log/xml files
- Increase reactor timeout by x5 when valgrind enabled
- Patch to reactor_stop() to insure it does even when exceptions occur in deferred stack
- Add valgrind with correct arguments into executable path
- After run, check valgrind.xml for errors, parse and condense them into something more managable
- If -gensup mode enabled, write suppressions to logs/(test)/ast#/valgrind.supp that can be added (manually)
- A default valgrind.supp "suppressions" file is in configs/ to prevent complaints about known unfixables
Notes:
- valgrind can be triggered by argument to runtests.py, export VALGRIND=true, or in test-config.yaml
- configs/valgrind.supp will be used if found, but tests/(test)/configs/valgrind.supp will take precedence
- valgrind-gensupp mode will create example suppressions file, during which no suppressions occur
</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;">Tested on 64bit and 32bit CentOS, including low cpu power conditions. Some sporadic timing issues affecting AMI/twisted operation have been seen and will be corrected.</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/team/sgriepentrog/testsuite-valgrind/runtests.py <span style="color: grey">(4350)</span></li>
<li>/asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py <span style="color: grey">(4350)</span></li>
<li>/asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestRunner.py <span style="color: grey">(4350)</span></li>
<li>/asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestConfig.py <span style="color: grey">(4350)</span></li>
<li>/asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py <span style="color: grey">(4350)</span></li>
<li>/asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/3027/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>