[asterisk-scf-commits] asterisk-scf/release/testsuite.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Apr 1 12:22:45 CDT 2011


branch "master" has been updated
       via  6d5244b93e1644da57881325299118e7d0f9ead9 (commit)
      from  f49f8cebc82508ac0d13d2ade892591dd9c33d47 (commit)

Summary of changes:
 bamboo/bin/tests.py |   88 ++++++++++++++++++--------------------------------
 1 files changed, 32 insertions(+), 56 deletions(-)


- Log -----------------------------------------------------------------
commit 6d5244b93e1644da57881325299118e7d0f9ead9
Author: Darren Sessions <dsessions at digium.com>
Date:   Fri Apr 1 12:22:41 2011 -0500

    Refactored the system calls across the board.

diff --git a/bamboo/bin/tests.py b/bamboo/bin/tests.py
index c6404a5..0e70ea2 100755
--- a/bamboo/bin/tests.py
+++ b/bamboo/bin/tests.py
@@ -38,33 +38,7 @@ class test_asterisk_scf:
 
         start_time = time.time()
 
-        if plat == "Windows":
-            mkcmd = ['-F','Makefile ']
-
-        cmd = [
-            "%s" % make,
-            "%stest" % mkcmd
-        ]
-
-        if os.path.exists(cmd[0]) and os.access(cmd[0], os.X_OK):
-            try:
-                f = open("../../../test_output.txt", "w")
-            except IOError:
-                print "FAILURE: Failed to open file for test output"
-                return
-            p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-                                 stderr=subprocess.STDOUT)
-            try:
-                for l in p.stdout.readlines():
-                    f.write(l)
-                    print l,
-            except IOError:
-                pass
-            p.wait()
-            f.close()
-            self.passed = p.returncode == 0
-        else:
-            print "FAILED TO EXECUTE %s, it must exist and be executable" % cmd
+        self.passed = uni_make(None, None, 'test') == 0
 
         self.total_time = time.time() - start_time
 
@@ -148,46 +122,54 @@ class test_asterisk_scf:
             system_call(["%s" % self.msbuild_path, "pjsip_core.vcxproj"])
             system_call(["%s" % self.msbuild_path, "pjsua_lib.vcxproj"])
             os.chdir("../../../build")
-            system_call(["%s" % make,"%s" % mkcmd[0], "%s" % mkcmd[1]])
+            uni_make(None, None, None)
             os.chdir("..")
         else:
             system_call(["/bin/bash","./cmake/init-cmake.sh"])
             system_call(["/usr/bin/cmake","--build","./build"])
 
 def system_call(cmd):
-    p = subprocess.Popen(cmd)
-    p.wait()
-    if p.returncode != 0:
-        errorout("Error detected during system call! '%s' returned with exit code: %d" % (cmd[0], p.returncode))
+    if os.path.exists(cmd[0]) and os.access(cmd[0], os.X_OK):
+        p = subprocess.Popen(cmd)
+        p.wait()
+        if p.returncode != 0:
+            errorout("Error detected during system call! '%s' returned with exit code: %d" % (cmd[0], p.returncode))
+        return p.returncode
+    else:
+        errorout("FAILED TO EXECUTE %s, it must exist and be executable" % cmd)
 
 def test_ice():
     print "\n\nBuilding Ice\n"
     os.chdir("./cpp")
-    if plat == "Windows":
-        system_call(["%s" % make,"%s" % mkcmd[0], "%s.mak" % mkcmd[1]])
-        system_call(["%s" % make,"%s" % mkcmd[0], "%s.mak" % mkcmd[1], "install"])
-    elif plat == "SunOS":
-        system_call(["%s" % make,"MCPP_HOME=/usr/local EXPAT_HOME=/usr/sfw OPENSSL_HOME=/usr/sfw DB_HOME=/usr/local/BerkeleyDB.4.8"])
-        system_call(["%s" % make,"install"])
-    else:
-        system_call(["%s" % make])
-        system_call(["%s" % make,"install"])
+    uni_make(1, 1, 'install')
     sys.exit(0)
 
 def test_slice_plugins():
     print "\n\nBuilding Slice Plugins\n"
     os.system("cmake .")
+    uni_make(None, None, 'install')
+    sys.exit(0)
+
+def uni_make(makefile=None,makeargs=None,makesubtype=None):
+    sc = []
     if plat == "Windows":
-        system_call(["%s" % make])
-        system_call(["%s" % make,"install"])
+        if makefile:
+            sc = ["%s" % make,"-F","Makefile.mak"]
+        else:
+            sc = ["%s" % make]
+        system_call(sc)
     elif plat == "SunOS":
-        system_call(["%s" % make,"MCPP_HOME=/usr/local EXPAT_HOME=/usr/sfw OPENSSL_HOME=/usr/sfw DB_HOME=/usr/local/BerkeleyDB.4.8"])
-        system_call(["%s" % make,"install"])
+        if makeargs:
+            sc = ["%s" % make,"MCPP_HOME=/usr/local EXPAT_HOME=/usr/sfw OPENSSL_HOME=/usr/sfw DB_HOME=/usr/local/BerkeleyDB.4.8"]
+        else:
+            sc = ["%s" % make]
+        system_call(sc)
     else:
-        system_call(["%s" % make])
-        system_call(["%s" % make,"install"])
-
-    sys.exit(0)
+        sc = ["%s" % make] 
+        system_call(sc)
+    if makesubtype:
+        sc.append(makesubtype)
+        system_call(sc)
 
 def readinfile(file):
     try:
@@ -210,10 +192,7 @@ def errorout(msg):
 
 def update_build_env():
     os.chdir('bamboo')
-    if plat == "Windows":
-        os.system("%s %s %s.mak install" % (make, mkcmd[0], mkcmd[1]))
-    else:
-        os.system("%s install" % make)
+    uni_make(1, None, 'install')
     return 
 
 def main(argv=None):
@@ -236,15 +215,12 @@ def main(argv=None):
     
     if plat == "Windows":
         make = '/PROGRA~1/MICROS~1.0/VC/bin/nmake.exe'
-        mkcmd = ['-F','Makefile']
         rmdircmd = "rmdir /S /Q"
     elif plat == "SunOS":
         make = "/usr/bin/gmake"
-        mkcmd = ""
         rmdircmd = "rm -rf"
     else:
         make = "/usr/bin/make"
-        mkcmd = ""              
         rmdircmd = "rm -rf"
 
     print "-------------------------------------------------------------------------\n"

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


-- 
asterisk-scf/release/testsuite.git



More information about the asterisk-scf-commits mailing list