<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/3397/">https://reviewboard.asterisk.org/r/3397/</a>
     </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On June 6th, 2014, 2:34 p.m. UTC, <b>wdoekes</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/3397/diff/2/?file=59332#file59332line57" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/trunk/run-local</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">57</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span>export PATH="$HERE/ast<span class="hl">test/</span>root/usr/local/bin:$HERE/astroot/usr/sbin:$PATH"</pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">57</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span>export PATH="$HERE/astroot/usr/local/bin:$HERE/astroot/usr/sbin:$PATH"</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;">/usr/local/bin and /usr/sbin?

What kind of combination is that?

Should this just be all permutations of

  /usr(/local)?/s?bin

instead?</pre>
 </blockquote>



 <p>On June 6th, 2014, 5:26 p.m. UTC, <b>Corey Farrell</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;">/usr/sbin is for asterisk binaries, /usr/local/bin is where asttest gets installed.  No other bin or sbin directories are created/used by run-local.</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;">Perhaps a tiny comment above the PATH setting will help clarify that to the casual reader.</pre>
<br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On June 6th, 2014, 2:34 p.m. UTC, <b>wdoekes</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/3397/diff/2/?file=59333#file59333line46" style="color: black; font-weight: bold; text-decoration: underline;">/asterisk/trunk/tests/apps/chanspy/chanspy_barge/run-test</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">46</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        self.talkingaudio = os.path.join(os.getcwd(), "%s/sounds/talking" % <span class="hl">(</span>test<span class="hl">dir))</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">44</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        self.talkingaudio = os.path.join(os.getcwd(), "%s/sounds/talking" % <span class="hl">self.</span>test<span class="hl">_name)</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">47</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        self.audiofile1 = <span class="hl">os.</span>path<span class="hl">.join(os.getcwd()</span>, "<span class="hl">%s/</span>testaudio1"<span class="hl"> % (testdir))</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">45</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        self.audiofile1 = <span class="hl">self.ast1.get_</span>path<span class="hl">("astspooldir"</span>, "<span class="hl">tmp", "</span>testaudio1"<span class="hl">)</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;">  os.getcwd() is always a bad idea

Please replace with path relative to this file:

  os.path.join(os.path.dirname(__file__),
               "sounds/talking")

Unless someone is actively os.chdir()ing around to make things work,
but my grep did not detect any such foolishness.</pre>
 </blockquote>



 <p>On June 6th, 2014, 5:26 p.m. UTC, <b>Corey Farrell</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;">os.path.dirname(__file__) gives a relative path (the same as self.test_name).  This does not work since asterisk will attempt to use it as a path relative to ${ASTROOT}/var/lib/asterisk/sounds.  Same applies to chanspy_w_mixmonitor.</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;">Interesting, I was going to point to os.path.abspath(), but that uses os.getcwd()
internally, rendering it identical to your solution:

def abspath(path):
    """Return an absolute path."""
    if not isabs(path):
        if isinstance(path, _unicode):
            cwd = os.getcwdu()
        else:
            cwd = os.getcwd()
        path = join(cwd, path)
    return normpath(path)

I may have to revise my dislike of getcwd :)</pre>
<br />




<p>- wdoekes</p>


<br />
<p>On June 6th, 2014, 5:26 p.m. UTC, Corey Farrell 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 and wdoekes.</div>
<div>By Corey Farrell.</div>


<p style="color: grey;"><i>Updated June 6, 2014, 5:26 p.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-23538">ASTERISK-23538</a>


</div>



<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;">run-local: install asttest within astroot directory structure, fix the path statement (local install of asttest was never in $PATH before).
lib/python/asterisk.py: add get_path
chanspy_barge, chanspy_w_mixmonitor: use astspooldir/tmp to write the testaudio1
sip_tls_call & sip_tls_register: use key files from original location instead of copying them
fax/sip/local_channel_t38_queryoption, udptl, udptl_v6: store file from ReceiveFax in ${ASTDATADIR}

asterisk.get_path is designed to be used in place of manual path construction involving asterisk._base, and to encourage use of os.path.join style construction.

Though reviewboard isn't showing it, this patch adds 'astroot' to svn:ignore of the testsuite root.</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;">Verified all modified tests still using work with run-local, and no longer create any untracked files in svn.  I believe these changes to be correct for use without run-local, but can't test that.</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/tests/udptl_v6/configs/ast2/extensions.conf <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/udptl/configs/ast2/extensions.conf <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/fax/sip/local_channel_t38_queryoption/configs/ast2/extensions.conf <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/channels/SIP/sip_tls_register/run-test <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/channels/SIP/sip_tls_call/configs/helper2 <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/channels/SIP/sip_tls_call/configs/helper1 <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/apps/chanspy/chanspy_w_mixmonitor/run-test <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/tests/apps/chanspy/chanspy_barge/run-test <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/run-local <span style="color: grey">(5094)</span></li>

 <li>/asterisk/trunk/lib/python/asterisk/asterisk.py <span style="color: grey">(5094)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/3397/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>