[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
Tue May 31 16:01:56 CDT 2011


branch "review" has been updated
       via  bf007a936d55dabb2c4c15c55ff7597c4cfb06f8 (commit)
      from  7e76eb1fbe88ee1ed211cdf4a1df98fce7157eeb (commit)

Summary of changes:
 plugins/build.py                            |    2 +-
 remote.py                                   |    2 +-
 tests/build/Build_AsteriskSCF/testcase.yaml |   10 ++++---
 testsuite.py                                |   40 ++++++++++++++++++++++++++-
 4 files changed, 47 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit bf007a936d55dabb2c4c15c55ff7597c4cfb06f8
Author: Darren Sessions <dsessions at digium.com>
Date:   Tue May 31 16:01:54 2011 -0500

    modified the test-suite server to start up the remote script for updates from the builder.

diff --git a/plugins/build.py b/plugins/build.py
index 5aa45aa..5708574 100644
--- a/plugins/build.py
+++ b/plugins/build.py
@@ -74,7 +74,7 @@ class plugin(TestSuite.RemoteBaseClass):
                     return results
                
                 for remote in testData['cmd']['redistribute']['remotes']:
-                    results = rpc.serverSideSendFile(testData['testsuite_remote'], remote, 'tmp.tar.gz', testData['cmd']['redistribute']['install_dir'])
+                    results = rpc.serverSideSendFile(testData['testsuite_remote_host'], remote, 'tmp.tar.gz', testData['cmd']['redistribute']['install_dir'])
                     if results['success'] == False:
                         return results
         
diff --git a/remote.py b/remote.py
index cb177bb..9db712b 100755
--- a/remote.py
+++ b/remote.py
@@ -20,7 +20,7 @@ import xmlrpclib
 import subprocess
 import SimpleXMLRPCServer
 
-iface = 'eth0'
+iface = 'en0'
 
 cwd = os.path.dirname(os.path.realpath(__file__))
 arch = platform.machine()
diff --git a/tests/build/Build_AsteriskSCF/testcase.yaml b/tests/build/Build_AsteriskSCF/testcase.yaml
index c762396..d5f36c8 100644
--- a/tests/build/Build_AsteriskSCF/testcase.yaml
+++ b/tests/build/Build_AsteriskSCF/testcase.yaml
@@ -3,7 +3,7 @@ tests :
     - ice_cpp :
         timeline :
             - build :
-                testsuite_remote : testsuite-builder-1.digium.internal
+                testsuite_remote_host : testsuite-builder-1.digium.internal
                 cmd :
                     pull_update : True
                     repo : 'git://git.asterisk.org/asterisk-scf/release/ice'
@@ -14,7 +14,7 @@ tests :
     - ice_python :
         timeline :
             - build :
-                testsuite_remote : testsuite-builder-1.digium.internal
+                testsuite_remote_host : testsuite-builder-1.digium.internal
                 cmd :
                     pull_update : True
                     repo : 'git://git.asterisk.org/asterisk-scf/release/ice'
@@ -25,7 +25,7 @@ tests :
     - slice_plugins :
         timeline:
             - build :
-                testsuite_remote : testsuite-builder-1.digium.internal
+                testsuite_remote_host : testsuite-builder-1.digium.internal
                 cmd :
                     pull_update : True
                     repo : 'git://git.asterisk.org/asterisk-scf/release/slice-plugins'
@@ -36,6 +36,7 @@ tests :
                         - make install
                     redistribute :
                         remotes :
+                            - testsuite-server.digium.internal
                             - testsuite-remote-1.digium.internal
                             - testsuite-remote-2.digium.internal
                             - testsuite-remote-3.digium.internal
@@ -44,7 +45,7 @@ tests :
     - asterisk_scf :
         timeline:
             - build :
-                testsuite_remote : testsuite-builder-1.digium.internal
+                testsuite_remote_host : testsuite-builder-1.digium.internal
                 cmd :
                     pull_update : True
                     repo : 'git://git.asterisk.org/asterisk-scf/integration/gitall'
@@ -55,6 +56,7 @@ tests :
                         - cmake --build ./build
                     redistribute :
                         remotes :
+                            - testsuite-server.digium.internal
                             - testsuite-remote-1.digium.internal
                             - testsuite-remote-2.digium.internal
                             - testsuite-remote-3.digium.internal
diff --git a/testsuite.py b/testsuite.py
index 521ffc6..04159b3 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -16,6 +16,7 @@ import sys
 import inspect
 import platform
 import xmlrpclib
+import subprocess
 
 from xml.dom import minidom
 from xml.etree.ElementTree import Element, SubElement, tostring
@@ -29,8 +30,19 @@ import yaml_parser
 class __main__:
     def __init__(self):
         self.yamlData = yaml_parser.testcases().returnData
+
+        remote = remoteClient().start()
+        if remote['success'] == False:
+            print '\n\nUnable to start the test-suite server remote client. %s\n\n' % remote['msg']
+            sys.exit(1)
+
         self.testsuite()
 
+        remote = remoteClient().stop(remote['subprocess'])
+        if remote['success'] == False:
+            print '\n\nUnable to stop the test-suite server remote client.\n\n'
+            sys.exit(1)
+
     def testsuite(self):
         errorMsgs = []
         pluginData = {}
@@ -107,10 +119,36 @@ class __main__:
                                 print '   |- Test "' + testName + '" - FAILED!\n    \- No test data defined!'
                                 subTestElement, errorMsgs = xml().addFailure(subTestElement, ['No test data defined!'])
                                 break
-        #print xml().convToString(x)
         print "\n\n" + xml().prettyXml(x)
         return
 
+class remoteClient:
+    def start(self):
+        cmd = ['%s/remote.py' % homeDir]
+        if os.path.exists(cmd[0]) and os.access(cmd[0], os.X_OK):
+            p = subprocess.Popen(
+                cmd,
+                bufsize=-1,
+                shell=False
+                #shell=False,
+                #stdin=subprocess.PIPE,
+                #stdout=subprocess.PIPE,
+                #stderr=subprocess.PIPE
+            )
+            p.poll()
+            if p.returncode:
+                return {'success':False,"msg":"Could not execute '%s'." % ' '.join(cmd)}
+        else:
+            return {'success':False,"msg":"FAILED TO EXECUTE '%s'. It must exist and be executable" % ' '.join(cmd)}
+        return {'success':True, 'subprocess':p}
+
+    def stop(self, subprocess):
+        try:
+            os.kill(subprocess.pid, 9)
+        except:
+            return {'success':False, 'msg':"Unable to kill the remote process."}
+        return {'success':True}
+
 class plugins:
     def execute(self, name, module, testData, testPath):
         try:

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list