<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/1431/">https://reviewboard.asterisk.org/r/1431/</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 12th, 2011, 3:20 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/1431/diff/1/?file=20561#file20561line190" 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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">def __archive_ast_logs(self):</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">190</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">dest_dir</span> <span class="o">=</span> <span class="s">"./logs/</span><span class="si">%s</span><span class="s">/ast</span><span class="si">%d</span><span class="s">/var/log/asterisk"</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">test_name</span><span class="o">.</span><span class="n">lstrip</span><span class="p">(</span><span class="s">"tests/"</span><span class="p">),</span> <span class="n">i</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;">Is it possible to access the asterisk instance astlogdir value?</pre>
</blockquote>
<p>On September 12th, 2011, 3:31 p.m., <b>mjordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Probably not. If we created an Asterisk instance, we'd create a new directory structure, as opposed to merely querying for the potential location of the log directories. Right now the astlogdir is read from the config files, which are moved and copied (etc.) to the Asterisk instances on creation - when this happens, you've already created a directory structure, which we definitely want to avoid. Otherwise, we'd be creating directories in the same place we wanted to copy from.
That's why I moved the base location of the asterisk temp directory to being static, so I didn't make any false instances of Asterisk (and create more directories)</pre>
</blockquote>
<p>On September 12th, 2011, 3:54 p.m., <b>Paul Belanger</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Sorry, I was talking about the hard-coded path for /var/log/asterisk... could you not use: Dependency.__ast.directories["astlogdir"]</pre>
</blockquote>
<p>On September 12th, 2011, 4:37 p.m., <b>mjordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yup, I know. Let's say we make an instance of an Asterisk object and assign it to __ast (in whatever class). At that moment, we've created a new directory structure in the tmp/asterisk-testsuite directory, that has nothing to do with what we want to copy. Sure, it may (if we supplied the correct test name) have the correct config files, but we've just created a new directory in the same location as the directories we wanted to copy. For example, let's say a test run creates two Asterisk instances, so we have:
* ast1\var\log\...
* ast2\var\log\...
We then want to reference the \var\log path using an instance of Asterisk. If we create that instance, we'll have on disk:
* ast1\var\log\...
* ast2\var\log\...
* ast3\var\log\...
No bueno. We've just created something to find out where we want to copy from - in the best case, we're creating (yet again) more file to copy around, and we'll always have an 'empty' log directory for each failed run. This makes this more confusing then it needs to be.
If we don't create an instance by making the information static, then yes, we can do Asterisk.var_log_dir (or something similar) - however, right now that var log information is read from the configuration files that are copied to the instance's created directory structure. So it's not possible - and since the var log information is dependent on each test run, it's not really something that should be static.
It does mean that overriding the \var\log information in a test's Asterisk.conf file is probably a bad idea.</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;">I see what you are saying, and yes I knew that. For some reason my brain was saying we exposed the original /etc/asterisk/asterisk.conf file when we did Asterisk.__gen_ast_conf().
Okay, we'll have to leave the hardcoded path for now (yuck).</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On September 12th, 2011, 3:20 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/1431/diff/1/?file=20561#file20561line194" 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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">def __archive_ast_logs(self):</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">194</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">shutil</span><span class="o">.</span><span class="n">copytree</span><span class="p">(</span><span class="n">ast_dir</span><span class="p">,</span> <span class="n">dest_dir</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;">How about a symlink? Seems like a waste to copy it.</pre>
</blockquote>
<p>On September 12th, 2011, 3:34 p.m., <b>mjordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">You wouldn't want a symbolic link, as the thing that you link to is apparently being deleted by the test harness. We'd have a dangling link otherwise. If we aren't deleting the Asterisk logs between runs, then yes, a symbolic link would suffice here.</pre>
</blockquote>
<p>On September 12th, 2011, 3:49 p.m., <b>Paul Belanger</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well, we actually delete the testsuite directory and runtests.py before the /tmp/asterisk-testsuite folder, so symlinking is not an issue. We also have bamboo copy the files into the artifact directory before we at to this point too.</pre>
</blockquote>
<p>On September 12th, 2011, 4:31 p.m., <b>mjordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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'm confused.
Either we have the original Asterisk logs, or we don't. If we have the original Asterisk logs, then creating symbolic links is all find and good, but is merely a 'nice to have'. I was under the impression that we had no way to get the Asterisk logs after a test run. If that's not the case, then this is a nice to have, but not needed, patch to debug the voicemail tests that have been bouncing.
If we don't have the Asterisk logs, e.g., everything in the /tmp/asterisk-testsuite/ directory is deleted, then symbolic links would be no bueno, and we need to copy the files. Whether or not the place the test copies them to is later manipulated by bamboo in someway (moving them yet again, etc.) is superfluous from the test's perspective - currently, our place for putting log results is in the .logs\ directory.
</pre>
</blockquote>
<p>On September 12th, 2011, 4:38 p.m., <b>mjordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">er, that should be .\logs\ directory, but I think you know what I meant :-)</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;">Let me explain how bamboo works, this should clear up some issues.
Bamboo start
-> remote agent runs build-asterisk.sh
--> checkout asterisk
---> compile / install / samples for asterisk
---> checkout testsuite
----> make addons / install asttest
----> runtests.py
----> cp xml results
---> uninstall asterisk
--> generate coverage
-> bamboo copies artifacts
-> bamboo deletes everything
At the point of 'bamboo copies artifacts' is where we look into testsuite/logs/ folder to get the information. So, we can get the symlink information, I'm actually not sure if this will work, because for whatever reason bamboo will not copy files into an artifact folder if they exist out side the sandbox instance it creates. And becuase /tmp/asterisk-testsuite exists outside of the sandbox instance, we cannot directly access this.
So, copying is an issue, however for local development boxes, because we are just eating up HDD space. Like I said, I don't even know if a symlink will work.
</pre>
<br />
<p>- Paul</p>
<br />
<p>On September 12th, 2011, 1:42 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, 1:42 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;">The TestSuite will now archive the Asterisk logs if a test run fails. All logs are copied to the local ./logs directory, using the same relative test path used for the /tmp/asterisk-testsuite/ directory.
Note that since the top level script does not have knowledge of the number of instances of Asterisk created by a test, all Asterisk (ast1, etc.) directories created by the test are archived.</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;">local machine. Induced a test failure, tested multiple runs to ensure that archiving occurs even if directories were previously copied.</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/runtests.py <span style="color: grey">(2190)</span></li>
<li>/asterisk/trunk/lib/python/asterisk/asterisk.py <span style="color: grey">(2188)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1431/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>