[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 22:04:26 CDT 2011


branch "review" has been updated
       via  7f774d3270d3944c4cad71bb3652ad21723763eb (commit)
      from  c95d85c1cd60f972a734551287cf7181e8066401 (commit)

Summary of changes:
 lib/python/TestSuite.py |    2 +-
 testsuite.py            |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 7f774d3270d3944c4cad71bb3652ad21723763eb
Author: Darren Sessions <dsessions at digium.com>
Date:   Wed Jun 1 22:04:20 2011 -0500

    added the tarfile python module in the main testsuite as using tar while piping the output with subprocess had issues. added the time property to the xml output on a successful run.

diff --git a/lib/python/TestSuite.py b/lib/python/TestSuite.py
index 1477d67..145db9b 100644
--- a/lib/python/TestSuite.py
+++ b/lib/python/TestSuite.py
@@ -43,7 +43,7 @@ class utils():
         w.write(fd.data)
         w.close()
         installPath = installPath.replace('!!TMP!!', '%s/tmp' % cwd)
-        tar = tarfile.open('%s/tmp/%s' % (cwd, fn))
+        tar = tarfile.open('%s/tmp/%s' % (cwd, fn), "r:gz")
         tar.extractall(path="%s" % installPath)
         tar.close()
         #results = self.execute(['tar', '-xvf', '%s/tmp/%s' % (cwd, fn), '-C', '%s' % installPath], cwd, True)
diff --git a/testsuite.py b/testsuite.py
index 0e58ca3..96f6e89 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -16,6 +16,7 @@ import sys
 import shutil
 import signal
 import inspect
+import datetime
 import platform
 import xmlrpclib
 import subprocess
@@ -68,7 +69,7 @@ class __main__:
                                 success = True
                 
                                 if 'expected_failure' in subTestCase[testName]:
-                                    if subTestCase[testName]['expected_failure']:
+                                    if subTestCase[testName]['expected_failure'] == True:
                                        subTestElement = xml().setProperty(subTestElement, 'expected_failure', subTestCase[testName]['expected_failure'])
 
                                 #print subTestCase[testName]['expected_failure']
@@ -88,7 +89,9 @@ class __main__:
                                 ''' execute testcase timeline '''
                                 for timeLine in subTestCase[testName]['timeline']:
                                     for plugin in timeLine:
+                                        timerStart = datetime.datetime.now()
                                         runResults = plugins().execute(plugin, pluginData[plugin]['module'], timeLine[plugin], testData['path'], self.globalVars)
+                                        timerStop = datetime.datetime.now()
                                         if not 'shutdownList' in runResults:
                                             if not 'shutdownExempt' in runResults:
                                                 if 'testsuite_remote_host' in timeLine[plugin]:
@@ -99,7 +102,6 @@ class __main__:
                                         if not runResults['success'] == True:
                                             break
                                     if runResults['success'] == False:
-                                        print runResults
                                         runResults['msg'] = "'%s' plugin: %s" % (plugin, runResults['msg'])
                                         break
 
@@ -118,7 +120,7 @@ class __main__:
                                     break
                 
                                 print >> sys.stderr, '   |- Test "' + testName + '" - PASSED!'
-                                # setProperty(self, element, key, val): for xml results
+                                subTestElement = setProperty(subTestElement, 'time', (timerStop - timerStart))
                             else:
                                 print >> sys.stderr, '   |- Test "' + testName + '" - FAILED!\n    \- No test data defined!'
                                 subTestElement, errorMsgs = xml().addFailure(subTestElement, ['No test data defined!'])

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list