[Asterisk-code-review] Testsuite: avoid accidental use of alternate tmp (testsuite[master])

Scott Griepentrog asteriskteam at digium.com
Tue Nov 15 14:16:47 CST 2016


Scott Griepentrog has uploaded a new change for review. ( https://gerrit.asterisk.org/4452 )

Change subject: Testsuite: avoid accidental use of alternate tmp
......................................................................

Testsuite: avoid accidental use of alternate tmp

The alternate /var/tmp directory for asterisk-testsuite
temporary files will be autoamtically selected- when it
has more blocks available then /tmp. This can happen in
CentOS 7 where /tmp is mounted on a smaller tmpfs.

However if /tmp and /var/tmp are on the same filesystem
and the available space changes slightly between calls,
the testsuite could mistakenly select /var/tmp where it
was not necessary.  By changing the comparison function
to treat small differences in available space the same,
this problem is avoided.

ASTERISK-26602 #close

Change-Id: Ia1bc3ded873e917960478f31c257c93cd28fb4aa
---
M lib/python/asterisk/asterisk.py
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/52/4452/1

diff --git a/lib/python/asterisk/asterisk.py b/lib/python/asterisk/asterisk.py
index bfde74f..32e1d79 100755
--- a/lib/python/asterisk/asterisk.py
+++ b/lib/python/asterisk/asterisk.py
@@ -315,10 +315,10 @@
     def compare_free_space(x, y):
         # statvfs can return a long; comparison functions must return an
         # int. Hence the checks that occur here.
-        blocks_avail = os.statvfs(y).f_bavail - os.statvfs(x).f_bavail
-        if (blocks_avail > 0):
+        difference = os.statvfs(y).f_bavail - os.statvfs(x).f_bavail
+        if (difference > 1000):
             return 1
-        elif (blocks_avail < 0):
+        elif (difference < 1000):
             return -1
         else:
             return 0

-- 
To view, visit https://gerrit.asterisk.org/4452
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1bc3ded873e917960478f31c257c93cd28fb4aa
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list