[asterisk-scf-commits] asterisk-scf/integration/testsuite.git branch "review" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Jun 1 17:06:38 CDT 2011
branch "review" has been updated
via 7762cd893d2c08bfffecc207e83f050d98fdac03 (commit)
from 83d444fd6491f850501eed2675df279b45933a80 (commit)
Summary of changes:
testsuite.py | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 7762cd893d2c08bfffecc207e83f050d98fdac03
Author: Darren Sessions <dsessions at digium.com>
Date: Wed Jun 1 17:06:35 2011 -0500
added a signal handler so the testsuite server piece can do some cleanup if forcibly stopped by bamboo.
diff --git a/testsuite.py b/testsuite.py
index 42da5f7..2259e45 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -13,6 +13,8 @@
import os
import imp
import sys
+import shutil
+import signal
import inspect
import platform
import xmlrpclib
@@ -126,6 +128,8 @@ class __main__:
results = file().write('testsuite_results.xml', xml().prettyXml(x))
if results['success'] == False:
print >> sys.stderr, 'Unable to generate XML test results file.'
+
+ cleanup()
return
class plugins:
@@ -220,4 +224,26 @@ class file:
f.close()
return {'success':True}
+class cleanup:
+ def __init__(self):
+ self.dirs()
+
+ def dirs(self):
+ if not os.path.exists('%s/tmp' % cwd):
+ return {'success':False,'msg':'The %s path does not exist.' % dir}
+ shutil.rmtree('%s/tmp' % cwd)
+ return {'success':True}
+
+def sigHandler(signum, frame):
+ print >> sys.stderr, 'Signal handler called with signal %s' % signum
+ cleanup()
+
+def sigSetup():
+ uncatchable = ['SIG_DFL','SIGSTOP','SIGKILL']
+ for i in [x for x in dir(signal) if x.startswith("SIG")]:
+ if not i in uncatchable:
+ signum = getattr(signal,i)
+ signal.signal(signum, sigHandler)
+
+sigSetup()
__main__()
-----------------------------------------------------------------------
--
asterisk-scf/integration/testsuite.git
More information about the asterisk-scf-commits
mailing list