[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
Fri Jun 3 14:35:07 CDT 2011


branch "review" has been updated
       via  c53af7266375b9f4b690ceaa1dd0aea0ad6fe97d (commit)
      from  72a7ec473068bf3f2b3cf3bfba57d2796ad6134f (commit)

Summary of changes:
 remote.py |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit c53af7266375b9f4b690ceaa1dd0aea0ad6fe97d
Author: Darren Sessions <dsessions at digium.com>
Date:   Fri Jun 3 14:35:05 2011 -0500

    Modified the remote.py script so that the console output from programs being executed is written to a file. As not every process called is going to be waited upon to finish, the file handler is also stored in the process list so that when a shutdown command is executed after a test, in addition to whichever processes are killed, the file handlers are also closed.

diff --git a/remote.py b/remote.py
index 8c156d2..8caaed0 100755
--- a/remote.py
+++ b/remote.py
@@ -60,14 +60,20 @@ class RemoteManagement(object):
         time.sleep(1)
 
         execCmd[0] = self._which(execCmd[0])
+
+        try:
+            logArtifactFile = open('%s/tmp/artifacts/%s_%s.log' % (cwd, plugin, label))
+        except:
+            return {'success':False,'msg':"Unable to open '%s/tmp/artifacts/%s_%s.log' for writing." % (cwd, plugin, label)}
+
         if os.path.exists(execCmd[0]) and os.access(execCmd[0], os.X_OK):
             p = subprocess.Popen(
                 execCmd,
                 bufsize=-1,
-                shell=False
-                #stdin=subprocess.PIPE,
-                #stdout=subprocess.PIPE,
-                #stderr=subprocess.PIPE
+                shell=False,
+                stdin=logArtifactFile,
+                stdout=logArtifactFile,
+                stderr=logArtifactFile
             )
             p.poll()
             if wait == True:
@@ -82,7 +88,7 @@ class RemoteManagement(object):
             if not plugin in processList:
                 processList[plugin] = {}
             if not label in processList[plugin]:
-                processList[plugin][label] = {'exec':' '.join(execCmd),'subprocess':p}
+                processList[plugin][label] = {'exec':' '.join(execCmd), 'subprocess':p, 'logArtifactFile':logArtifactFile}
 
         return {'success':True}
 
@@ -109,6 +115,7 @@ class RemoteManagement(object):
                 os.kill(processList[plugin][label]['subprocess'].pid, 9)
             except:
                 msg.append("Unable to kill pid for %s in %s." % (label, plugin))
+            processList[plugin][label]['logArtifactFile'].close()
         del processList[plugin]
         if len(msg) > 0:
             return {'success':False,'msg':' '.join(msg)}

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list