[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 8 22:29:54 CDT 2011


branch "review" has been updated
       via  0ca50a25c7375538f05ad982a8489bb484c8e848 (commit)
      from  eb5d095f821ae108e2c4e0b946e89fb2b6bf88c6 (commit)

Summary of changes:
 plugins/asteriskscf_icebox.py                      |    2 +-
 plugins/build.py                                   |   12 ++++++------
 plugins/sipp.py                                    |    2 +-
 plugins/testsuite_remotes.py                       |    2 +-
 plugins/wireshark.py                               |    5 ++++-
 remote.py                                          |   18 ++++++++++--------
 tests/sip/Functional_Basic_CallSetup/testcase.yaml |    4 ++++
 7 files changed, 27 insertions(+), 18 deletions(-)


- Log -----------------------------------------------------------------
commit 0ca50a25c7375538f05ad982a8489bb484c8e848
Author: Darren Sessions <dsessions at digium.com>
Date:   Wed Jun 8 22:29:24 2011 -0500

    modified the rpc run function to prepend the console log files to include the remote host they were generated on so that it will be easy to determine the origin of the file when viewing in bamboo

diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index ecf64e1..841c19d 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -25,7 +25,7 @@ class plugin(TestSuite.RemoteBaseClass):
                     results = remote['rpc']('setEnvVar', 'libpath', '!!TMP!!/gitall/build/lib')
                     if results['success'] == False:
                         return results
-                    results = remote['rpc']('run', globalVars, 'asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
+                    results = remote['rpc']('run', remote['hostname'], globalVars, 'asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
                     if results['success'] == False:
                         return results
             elif cmd == 'stop':
diff --git a/plugins/build.py b/plugins/build.py
index 4c5ea3c..c4eb25f 100644
--- a/plugins/build.py
+++ b/plugins/build.py
@@ -38,14 +38,14 @@ class plugin(TestSuite.RemoteBaseClass):
         if update == True:
             results = remote['rpc']('changeDir', repoInfo['repoName'])
             if results['success'] == False:
-                results = self._scratchBuild(remote['rpc'], globalVars, repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
+                results = self._scratchBuild(remote['rpc'], remote['hostname'], globalVars, repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
                 if results['success'] == False:
                     return results
         else:
             results = remote['rpc']('removeDir', repoInfo['repoName'])
             if results['success'] == False:
                 return results
-            results = self._scratchBuild(rpc, repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
+            results = self._scratchBuild(remote['rpc'], remote['hostname'], repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
             if results['success'] == False:
                 return results
 
@@ -56,7 +56,7 @@ class plugin(TestSuite.RemoteBaseClass):
                     if results['success'] == False:
                         return results
 
-                results = remote['rpc']('run', globalVars, 'build', cmds, cmds.split(' '), True)
+                results = remote['rpc']('run', remote['hostname'], globalVars, 'build', cmds, cmds.split(' '), True)
                 if results['success'] == False:
                     return results
             
@@ -69,7 +69,7 @@ class plugin(TestSuite.RemoteBaseClass):
                 except:
                     pass
 
-                results = remote['rpc']('archiveDir', globalVars, testData['cmd']['redistribute']['send_dir'])
+                results = remote['rpc']('archiveDir', remote['hostname'], globalVars, testData['cmd']['redistribute']['send_dir'])
                 if results['success'] == False:
                     return results
                
@@ -88,6 +88,6 @@ class plugin(TestSuite.RemoteBaseClass):
         
         return {'success':True,'shutdownExempt':True}
 
-    def _scratchBuild(self, rpc, globalVars, name, type, getCmd, repo):
-        results = rpc('run', globalVars, 'build', name, [type, getCmd, repo], True)
+    def _scratchBuild(self, rpc, hostName, globalVars, name, type, getCmd, repo):
+        results = rpc('run', hostName, globalVars, 'build', name, [type, getCmd, repo], True)
         return results
diff --git a/plugins/sipp.py b/plugins/sipp.py
index e054827..ab61f0a 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -34,7 +34,7 @@ class plugin(TestSuite.RemoteBaseClass):
                 if mode == 'uac':
                     waitForPidToFinish = True
                 #print ' '.join(self._componentConfig(mode, config[mode], testPath, rpc, testData['testsuite_remote_host']))
-                results = remote['rpc']('run', globalVars, 'sipp', mode, self._componentConfig(mode, config[mode], testPath, remote, testData['testsuite_remote_host']), waitForPidToFinish)
+                results = remote['rpc']('run', remote['hostname'], globalVars, 'sipp', mode, self._componentConfig(mode, config[mode], testPath, remote, testData['testsuite_remote_host']), waitForPidToFinish)
                 if results['success'] == False:
                     return results
                 if mode == 'uac':
diff --git a/plugins/testsuite_remotes.py b/plugins/testsuite_remotes.py
index 3eaa000..9d161c7 100644
--- a/plugins/testsuite_remotes.py
+++ b/plugins/testsuite_remotes.py
@@ -51,7 +51,7 @@ class plugin(TestSuite.BaseClass):
                     if results['success'] == False:
                         pass
 
-                    results = rpc[remote]['rpc']('archiveDir', globalVars, 'artifacts')
+                    results = rpc[remote]['rpc']('archiveDir', rpc[remote]['hostname'], globalVars, 'artifacts')
                     if results['success'] == False:
                         return results
 
diff --git a/plugins/wireshark.py b/plugins/wireshark.py
index f247f2f..44e6da0 100644
--- a/plugins/wireshark.py
+++ b/plugins/wireshark.py
@@ -45,12 +45,15 @@ class plugin(TestSuite.RemoteBaseClass):
                     '-R', 
                     '(%s) and (%s)' % (protocolFilters, hostFilters)]
 
-                results = remote['rpc']('run', globalVars, 'wireshark', 'start', runCmd)
+                results = remote['rpc']('run', remote['hostname'], globalVars, 'wireshark', 'start', runCmd)
                 if results['success'] == False:
                     return results
 
+            elif cmd == 'stop':
                 results = remote['rpc']('moveFile', '/tmp/capture.pcap', '!!TMP!!/artifacts/%s/%s.capture.pcap' % (globalVars['testInfo']['testPath'], remote['hostname']))
                 if results['success'] == False:
                     return results
+            else: 
+                return {'success':False, 'msg':'Unknown command: %s' % cmd}
 
         return {'success':True}   
diff --git a/remote.py b/remote.py
index fdf46ac..cea05f6 100755
--- a/remote.py
+++ b/remote.py
@@ -41,7 +41,7 @@ class RemoteManagement(object):
             return {'success':True,'msg':list} 
         return {'success':True,'msg':'Nothing running.'}
 
-    def run(self, globalVars, plugin, label, execCmd, wait=False):
+    def run(self, hostName, globalVars, plugin, label, execCmd, wait=False):
         if plugin in processList:
             if label in processList[plugin]:
                 return {'success':False,'msg':'[run] %s executed by the %s plugin is already running.' % (label, plugin)}
@@ -69,9 +69,9 @@ class RemoteManagement(object):
         execCmd[0] = self._which(execCmd[0])
 
         try:
-            logArtifactFile = open('%s/tmp/artifacts/%s/%s_%s_console.log' % (cwd, globalVars['testInfo']['testPath'], self._artifactNameCheck(plugin), self._artifactNameCheck(label)), 'w')
+            logArtifactFile = open('%s/tmp/artifacts/%s/%s.%s_%s_console.log' % (cwd, globalVars['testInfo']['testPath'], hostName, self._artifactNameCheck(plugin), self._artifactNameCheck(label)), 'w')
         except:
-            return {'success':False,'msg':"[run] Unable to open '%s/tmp/artifacts/%s/%s_%s_console.log' for writing. %s" % (cwd, globalVars['testInfo']['testPath'], plugin, label, sys.exc_info()[1])}
+            return {'success':False,'msg':"[run] Unable to open '%s/tmp/artifacts/%s/%s.%s_%s_console.log' for writing. %s" % (cwd, globalVars['testInfo']['testPath'], hostName, plugin, label, sys.exc_info()[1])}
 
         if os.path.exists(execCmd[0]) and os.access(execCmd[0], os.X_OK):
             p = subprocess.Popen(
@@ -176,6 +176,8 @@ class RemoteManagement(object):
         return {'success':True}
 
     def moveFile(self, src, dst):
+        src = src.replace('!!TMP!!', '%s/tmp' % cwd)
+        dst = dst.replace('!!TMP!!', '%s/tmp' % cwd)
         try:
             shutil.move(src, dst)
         except:
@@ -197,11 +199,11 @@ class RemoteManagement(object):
         if not os.path.exists("%s" % dn):
             return {'success':False,'msg':'[archiveDir] The %s path does not exist.' % dn}
         os.chdir('%s/tmp' % cwd)
-        results = self.run(globalVars, 'remote', 'archiveDir', [self._which('tar'), '-cvf', 'tmp.tar', '%s' % dn], True)
+        results = self.run(hostName, globalVars, 'remote', 'archiveDir', [self._which('tar'), '-cvf', 'tmp.tar', '%s' % dn], True)
         if results['success'] == False:
             return results
         os.chdir('%s/tmp' % cwd)
-        results = self.run(globalVars, 'remote', 'archiveDir', [self._which('gzip'), 'tmp.tar'], True)
+        results = self.run(hostName, globalVars, 'remote', 'archiveDir', [self._which('gzip'), 'tmp.tar'], True)
         return results
     
     def readFile(self, fn):
@@ -232,12 +234,12 @@ class RemoteManagement(object):
         f.close()
         return {'success':True}
 
-    def remoteSideRecvFile(self, globalVars, fn, fd, installPath):
+    def remoteSideRecvFile(self, hostName, globalVars, fn, fd, installPath):
         w = open('%s/tmp/%s' % (cwd, fn), "wb")
         w.write(fd.data)
         w.close()
         installPath = installPath.replace('!!TMP!!', '%s/tmp' % cwd)
-        results = self.run(globalVars, 'remoteSideRecvFile', 'tar', ['tar', '-xvf', '%s/tmp/%s' % (cwd, fn), '-C', '%s' % installPath], True)
+        results = self.run(hostName, globalVars, 'remoteSideRecvFile', 'tar', ['tar', '-xvf', '%s/tmp/%s' % (cwd, fn), '-C', '%s' % installPath], True)
         if results['success'] == False:
             return results
         return {'success':'True'}
@@ -253,7 +255,7 @@ class RemoteManagement(object):
         except:
             pass
         f = open('%s/tmp/%s' % (cwd, fn), "rb")
-        results = rpc.remoteSideRecvFile(globalVars, fn, xmlrpclib.Binary(f.read()), installPath)
+        results = rpc.remoteSideRecvFile(remote.split('.')[0], globalVars, fn, xmlrpclib.Binary(f.read()), installPath)
         f.close()
         return results
    
diff --git a/tests/sip/Functional_Basic_CallSetup/testcase.yaml b/tests/sip/Functional_Basic_CallSetup/testcase.yaml
index 80140ad..b43b1a4 100644
--- a/tests/sip/Functional_Basic_CallSetup/testcase.yaml
+++ b/tests/sip/Functional_Basic_CallSetup/testcase.yaml
@@ -84,6 +84,10 @@ tests :
                         ipv4oripv6 : ipv4
                         transport : udp
                         timeout : 10
+            - wireshark :
+                testsuite_remote_host : testsuite-remote-1.digium.internal
+                cmd :
+                    stop :
     - ipv6toipv6 :
         expected_failure : False 
         timeline:

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list