[asterisk-dev] [Code Review] 3397: testsuite: directory fixes to prevent untracked files from being created in the svn directory
wdoekes
reviewboard at asterisk.org
Fri Jun 6 14:37:19 CDT 2014
> On June 6, 2014, 2:34 p.m., wdoekes wrote:
> > /asterisk/trunk/tests/apps/chanspy/chanspy_barge/run-test, lines 46-47
> > <https://reviewboard.asterisk.org/r/3397/diff/2/?file=59333#file59333line46>
> >
> > 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.
>
> Corey Farrell wrote:
> 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.
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 :)
> On June 6, 2014, 2:34 p.m., wdoekes wrote:
> > /asterisk/trunk/run-local, line 57
> > <https://reviewboard.asterisk.org/r/3397/diff/2/?file=59332#file59332line57>
> >
> > /usr/local/bin and /usr/sbin?
> >
> > What kind of combination is that?
> >
> > Should this just be all permutations of
> >
> > /usr(/local)?/s?bin
> >
> > instead?
>
> Corey Farrell wrote:
> /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.
Perhaps a tiny comment above the PATH setting will help clarify that to the casual reader.
- wdoekes
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3397/#review12080
-----------------------------------------------------------
On June 6, 2014, 5:26 p.m., Corey Farrell wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3397/
> -----------------------------------------------------------
>
> (Updated June 6, 2014, 5:26 p.m.)
>
>
> Review request for Asterisk Developers and wdoekes.
>
>
> Bugs: ASTERISK-23538
> https://issues.asterisk.org/jira/browse/ASTERISK-23538
>
>
> Repository: testsuite
>
>
> Description
> -------
>
> 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.
>
>
> Diffs
> -----
>
> /asterisk/trunk/tests/udptl_v6/configs/ast2/extensions.conf 5094
> /asterisk/trunk/tests/udptl/configs/ast2/extensions.conf 5094
> /asterisk/trunk/tests/fax/sip/local_channel_t38_queryoption/configs/ast2/extensions.conf 5094
> /asterisk/trunk/tests/channels/SIP/sip_tls_register/run-test 5094
> /asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test 5094
> /asterisk/trunk/tests/channels/SIP/sip_tls_call/configs/helper2 5094
> /asterisk/trunk/tests/channels/SIP/sip_tls_call/configs/helper1 5094
> /asterisk/trunk/tests/apps/chanspy/chanspy_w_mixmonitor/run-test 5094
> /asterisk/trunk/tests/apps/chanspy/chanspy_barge/run-test 5094
> /asterisk/trunk/run-local 5094
> /asterisk/trunk/lib/python/asterisk/asterisk.py 5094
>
> Diff: https://reviewboard.asterisk.org/r/3397/diff/
>
>
> Testing
> -------
>
> 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.
>
>
> Thanks,
>
> Corey Farrell
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140606/43051721/attachment-0001.html>
More information about the asterisk-dev
mailing list