<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10670">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">asterisk.py:  Use env var AST_WORK_DIR for temp directory if avail<br><br>It's possible that on some systems, the /tmp directory is not<br>mounted on a tmpfs.  In a docker container for instance, it may<br>be part of the container's write-only layer.  This can make things<br>slow enough that the already-time-sensitive testsuite can report<br>false failures.  This patch allows the user to specify a directory<br>in which the testsuite will create it's temp files.  The user<br>could then create a directory and mount a tmpfs on it for the<br>testsuite to use.<br><br>Example:<br>$ mkdir /tmp/testsuite<br>$ mount -t tmpfs -o size=4g,noatime tmpfs /tmp/testsuite<br>$ export AST_WORK_DIR=/tmp/testsuite<br>$ ./runtests.py <yada, yada><br>$ umount /tmp/testsuite<br><br>Change-Id: I35434e70b14b8c57591f881fef093be8dd2703b9<br>---<br>M lib/python/asterisk/asterisk.py<br>1 file changed, 8 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/lib/python/asterisk/asterisk.py b/lib/python/asterisk/asterisk.py</span><br><span>index b29cd79..c40865d 100644</span><br><span>--- a/lib/python/asterisk/asterisk.py</span><br><span>+++ b/lib/python/asterisk/asterisk.py</span><br><span>@@ -296,7 +296,10 @@</span><br><span> </span><br><span>         BINARY = /usr/sbin/asterisk (or found in PATH)</span><br><span>         SOURCE_ETC_DIR = /etc/asterisk</span><br><span style="color: hsl(0, 100%, 40%);">-        WORK_DIR = /tmp/asterisk-testsuite</span><br><span style="color: hsl(120, 100%, 40%);">+        If AST_WORK_DIR is unset (the default):</span><br><span style="color: hsl(120, 100%, 40%);">+            WORK_DIR = /tmp/asterisk-testsuite</span><br><span style="color: hsl(120, 100%, 40%);">+        If it is set:</span><br><span style="color: hsl(120, 100%, 40%);">+            WORK_DIR = AST_WORK_DIR/asterisk-testsuite</span><br><span> </span><br><span>     If it is set:</span><br><span> </span><br><span>@@ -318,8 +321,10 @@</span><br><span>         # The default etc directory for Asterisk</span><br><span>         default_etc_directory = os.path.join(localtest_root, "etc/asterisk")</span><br><span>     else:</span><br><span style="color: hsl(0, 100%, 40%);">-        # select tmp path with most available space</span><br><span style="color: hsl(0, 100%, 40%);">-        best_tmp = sorted(['/tmp', '/var/tmp'], key=lambda path: os.statvfs(path).f_bavail)[0]</span><br><span style="color: hsl(120, 100%, 40%);">+        best_tmp = os.getenv("AST_WORK_DIR")</span><br><span style="color: hsl(120, 100%, 40%);">+        if not best_tmp:</span><br><span style="color: hsl(120, 100%, 40%);">+            # select tmp path with most available space</span><br><span style="color: hsl(120, 100%, 40%);">+            best_tmp = sorted(['/tmp', '/var/tmp'], key=lambda path: os.statvfs(path).f_bavail)[0]</span><br><span>         # Base location of the temporary files created by the testsuite</span><br><span>         test_suite_root = best_tmp + "/asterisk-testsuite"</span><br><span>         # The default etc directory for Asterisk</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10670">change 10670</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10670"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I35434e70b14b8c57591f881fef093be8dd2703b9 </div>
<div style="display:none"> Gerrit-Change-Number: 10670 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>