[asterisk-commits] sgriepentrog: testsuite/asterisk/trunk r5615 - /asterisk/trunk/lib/python/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 19 08:54:08 CDT 2014


Author: sgriepentrog
Date: Fri Sep 19 08:54:03 2014
New Revision: 5615

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5615
Log:
Testsuite: pick test suite temp dir based on free space

On CentOS7, the /tmp path is now a ramdisk that can not
run the entire testsuite.  This change selects /var/tmp
instead when it has more free space.

Review: https://reviewboard.asterisk.org/r/4007/


Modified:
    asterisk/trunk/lib/python/asterisk/asterisk.py

Modified: asterisk/trunk/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/asterisk.py?view=diff&rev=5615&r1=5614&r2=5615
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Fri Sep 19 08:54:03 2014
@@ -184,6 +184,9 @@
     Note that AST_TEST_ROOT has to be reasonably short (symlinked in /tmp?) so
     we're not running into the asterisk.ctl AF_UNIX limit.
     """
+    def compare_free_space(x, y):
+        return os.statvfs(y).f_bavail - os.statvfs(x).f_bavail
+
     localtest_root = os.getenv("AST_TEST_ROOT")
     if localtest_root:
         # Base location of the temporary files created by the testsuite
@@ -191,8 +194,10 @@
         # The default etc directory for Asterisk
         default_etc_directory = os.path.join(localtest_root, "etc/asterisk")
     else:
+        # select tmp path with most available space
+        best_tmp = sorted(['/tmp', '/var/tmp'], cmp=compare_free_space)[0]
         # Base location of the temporary files created by the testsuite
-        test_suite_root = "/tmp/asterisk-testsuite"
+        test_suite_root = best_tmp + "/asterisk-testsuite"
         # The default etc directory for Asterisk
         default_etc_directory = "/etc/asterisk"
 




More information about the asterisk-commits mailing list