[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 24 15:54:17 CDT 2011


branch "review" has been updated
       via  0ef960688ea090ab072149af52d385ca234e7606 (commit)
      from  b464215fd8609c06e6a35f7fc408bc129d0d1f72 (commit)

Summary of changes:
 plugins/build.py                            |    9 ++++++-
 remote.py                                   |   37 +++++++++++----------------
 tests/build/Build_AsteriskSCF/testcase.yaml |    7 ++++-
 3 files changed, 29 insertions(+), 24 deletions(-)


- Log -----------------------------------------------------------------
commit 0ef960688ea090ab072149af52d385ca234e7606
Author: Darren Sessions <dsessions at digium.com>
Date:   Tue May 24 15:54:15 2011 -0500

    finishing up testing the build plugin.

diff --git a/plugins/build.py b/plugins/build.py
index 7a44552..98377f6 100644
--- a/plugins/build.py
+++ b/plugins/build.py
@@ -42,6 +42,9 @@ class testsuite(util.TestSuiteRemoteBaseClass):
                 if results['success'] == False:
                     return results
         else:
+            results = rpc.removeDir(repoInfo['repoName'])
+            if results['success'] == False:
+                return results
             results = self._scratchBuild(rpc, repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
             if results['success'] == False:
                 return results
@@ -61,10 +64,14 @@ class testsuite(util.TestSuiteRemoteBaseClass):
             if not 'remotes' in testData['cmd']['redistribute'] and not 'send_dir' in testData['cmd']['redistribute']:
                 return {'success':False,'msg':'The restribute element requires the remotes and send_dir options.'}
             else:
-                print 'done'
                 results = rpc.archiveDir(testData['cmd']['redistribute']['send_dir'])
                 if results['success'] == False:
                     return results
+               
+                for remote in testData['cmd']['redistribute']['remotes']:
+                    results = rpc.getFileFromRemote(remote, 'tmp.tar.gz')
+                    if results['success'] == False:
+                        return results
         
         return {'success':True,'shutdownExempt':True}
 
diff --git a/remote.py b/remote.py
index 1f300b5..f773c6b 100755
--- a/remote.py
+++ b/remote.py
@@ -14,6 +14,7 @@
 
 import os
 import time
+import shutil
 import platform
 import subprocess
 import SimpleXMLRPCServer
@@ -99,21 +100,16 @@ class RemoteManagement(object):
         msg = []
         if not plugin:
             return {'success':False,'msg':'A plugin name to shutdown must be provided.'}
-
         if not plugin in processList:
             return {'success':False,'msg':'The "%s" plugin is not running.' % plugin}
-
         for label in processList[plugin]:
             try:
                 os.kill(processList[plugin][label]['subprocess'].pid, 9)
             except:
                 msg.append("Unable to kill pid for %s in %s." % (label, plugin))
-
         del processList[plugin]
-
         if len(msg) > 0:
             return {'success':False,'msg':' '.join(msg)}
-
         return {'success':True}
 
     def setEnvVar(self, name, val):
@@ -124,22 +120,17 @@ class RemoteManagement(object):
                 varName = "LD_LIBRARY_PATH"
         else:
             return {'success':False,'msg':'Unknown variable type. Remember, generic variable names are used for portability (i.e. libpath).'}
-
         val = val.replace('!!TMP!!', '%s/tmp' % cwd)
-
         if not os.path.exists(val):
             return {'success':False,'msg':'env var path does not exist'}
-
         if varName in os.environ:
             for path in os.environ[varName].split(":"):
                 if path == val:
                     return {'success':True}
-
         try:
             os.environ[varName] = "%s:%s" % (os.environ[varName], val)
         except:
             os.environ[varName] = "%s" % val
-
         return {'success':True}
 
     def changeDir(self, dir):
@@ -154,7 +145,7 @@ class RemoteManagement(object):
         dir = dir.replace('/', '/invalid')
         if not os.path.exists('%s/tmp/%s' % (cwd, dir)):
             return {'success':False,'msg':'The %s path does not exist.' % dir}
-        os.removedirs('%s/tmp/%s' % (cwd, dir))
+        shutil.rmtree('%s/tmp/%s' % (cwd, dir))
         return {'success':True}
 
     def moveFile(self, fp, dp):
@@ -165,7 +156,7 @@ class RemoteManagement(object):
         if not os.path.exists('%s/tmp/build/%s' % (cwd, dp)):
             return {'success':False,'msg':'The %s path does not exist.' % dp}
         try:
-            returncode = call('mv %s/tmp/build/%s %s/tmp/build/%s' % (cwd, fp, cwd, dp))
+            returncode = subprocess.call('mv %s/tmp/build/%s %s/tmp/build/%s' % (cwd, fp, cwd, dp))
             if returncode != 0:
                 return {'success':False,'msg':'The move command failed. (return code %d)' % returncode}
         except OSError, e:
@@ -180,18 +171,20 @@ class RemoteManagement(object):
         return {'success':True}
 
     def archiveDir(self, dn):
-        print dn
-        os.chdir('%s/tmp' % cwd)
         dn = self._filePathCheck(dn)
-        if not os.path.exists(dn):
+        if not os.path.exists("%s" % dn):
             return {'success':False,'msg':'The %s path does not exist.' % dn}
-        try:
-            returncode = call('tar -cvf %s.tar %s' % (dn.replace('/', ''), dn))
-            if returncode != 0:
-                return {'success':False,'msg':'The move command failed. (return code %d)' % returncode}
-        except OSError, e:
-            return {'success':False,'msg':'Execution failed: %s' % e}
-        return {'success':True,'tarfile':'%s.tar' % dn.replace('/', '')}
+        tar = self._which('tar')
+        gzip = self._which('gzip')
+        cmds = '%s -cvf tmp.tar %s' % (tar, dn) 
+        os.chdir('%s/tmp' % cwd)
+        results = self.run('remote', 'archiveDir', cmds.split(' '), True)
+        if results['success'] == False:
+            return results
+        cmds = '%s tmp.tar' % gzip
+        os.chdir('%s/tmp' % cwd)
+        results = self.run('remote', 'archiveDir', cmds.split(' '), True)
+        return results
 
     def writeFile(self, fn, fd):
         try:
diff --git a/tests/build/Build_AsteriskSCF/testcase.yaml b/tests/build/Build_AsteriskSCF/testcase.yaml
index 7512ea2..07eba9b 100644
--- a/tests/build/Build_AsteriskSCF/testcase.yaml
+++ b/tests/build/Build_AsteriskSCF/testcase.yaml
@@ -38,7 +38,7 @@ tests :
                         remotes :
                             - testsuite-remote-1.digium.internal
                             - testsuite-remote-2.digium.internal
-                        send_dir : /opt/Ice-3.4.1
+                        send_dir : '/opt/Ice-3.4.1'
     - asterisk_scf :
         timeline:
             - build :
@@ -51,3 +51,8 @@ tests :
                         - ./gitall-asterisk-scf.sh
                         - cmake/init-cmake.sh
                         - cmake --build ./build
+                    redistribute :
+                        remotes :
+                            - testsuite-remote-1.digium.internal
+                            - testsuite-remote-2.digium.internal
+                        send_dir : '/opt/Ice-3.4.1'

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list