[Asterisk-code-review] asterisk.py: Use env var AST WORK DIR for temp directory if... (testsuite[13])
George Joseph
asteriskteam at digium.com
Sat Nov 17 11:57:26 CST 2018
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/10669
Change subject: asterisk.py: Use env var AST_WORK_DIR for temp directory if avail
......................................................................
asterisk.py: Use env var AST_WORK_DIR for temp directory if avail
It's possible that on some systems, the /tmp directory is not
mounted on a tmpfs. In a docker container for instance, it may
be part of the container's write-only layer. This can make things
slow enough that the already-time-sensitive testsuite can report
false failures. This patch allows the user to specify a directory
in which the testsuite will create it's temp files. The user
could then create a directory and mount a tmpfs on it for the
testsuite to use.
Example:
$ mkdir /tmp/testsuite
$ mount -t tmpfs -o size=4g,noatime tmpfs /tmp/testsuite
$ export AST_WORK_DIR=/tmp/testsuite
$ ./runtests.py <yada, yada>
$ umount /tmp/testsuite
Change-Id: I35434e70b14b8c57591f881fef093be8dd2703b9
---
M lib/python/asterisk/asterisk.py
1 file changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/69/10669/1
diff --git a/lib/python/asterisk/asterisk.py b/lib/python/asterisk/asterisk.py
index b29cd79..c40865d 100644
--- a/lib/python/asterisk/asterisk.py
+++ b/lib/python/asterisk/asterisk.py
@@ -296,7 +296,10 @@
BINARY = /usr/sbin/asterisk (or found in PATH)
SOURCE_ETC_DIR = /etc/asterisk
- WORK_DIR = /tmp/asterisk-testsuite
+ If AST_WORK_DIR is unset (the default):
+ WORK_DIR = /tmp/asterisk-testsuite
+ If it is set:
+ WORK_DIR = AST_WORK_DIR/asterisk-testsuite
If it is set:
@@ -318,8 +321,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'], key=lambda path: os.statvfs(path).f_bavail)[0]
+ best_tmp = os.getenv("AST_WORK_DIR")
+ if not best_tmp:
+ # select tmp path with most available space
+ best_tmp = sorted(['/tmp', '/var/tmp'], key=lambda path: os.statvfs(path).f_bavail)[0]
# Base location of the temporary files created by the testsuite
test_suite_root = best_tmp + "/asterisk-testsuite"
# The default etc directory for Asterisk
--
To view, visit https://gerrit.asterisk.org/10669
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I35434e70b14b8c57591f881fef093be8dd2703b9
Gerrit-Change-Number: 10669
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181117/712ab307/attachment.html>
More information about the asterisk-code-review
mailing list