[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
Thu Mar 31 14:48:28 CDT 2011


branch "master" has been updated
       via  7d6a923aa4ed63d33530c82bbb2427022d5a5393 (commit)
      from  2047f716b4f72db0c086c78addb65ba01dfe3656 (commit)

Summary of changes:
 bamboo/bin/tests.py |   66 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 39 insertions(+), 27 deletions(-)


- Log -----------------------------------------------------------------
commit 7d6a923aa4ed63d33530c82bbb2427022d5a5393
Author: Darren Sessions <dsessions at digium.com>
Date:   Thu Mar 31 14:48:21 2011 -0500

    Converted os.system calls to us a subprocess.Popen wrapper function in order to be able to check exit codes.

diff --git a/bamboo/bin/tests.py b/bamboo/bin/tests.py
index 327b118..cb4900c 100755
--- a/bamboo/bin/tests.py
+++ b/bamboo/bin/tests.py
@@ -127,56 +127,68 @@ class test_asterisk_scf:
             os.chdir("..")
 
         if plat == "Windows":
-            os.system("bash ./cmake/init-cmake.sh --nmake")
+            system_call(["/cygwin/bin/bash.exe","./cmake/init-cmake.sh --nmake"])
             os.chdir("./pjproject/pjlib/build")
-            os.system("%s pjlib.vcxproj" % self.msbuild_path)
+            system_call(["%s" % self.msbuild_path, "pjlib.vcxproj"])
             os.chdir("../../pjlib-util/build")
-            os.system("%s pjlib_util.vcxproj" % self.msbuild_path)
+            system_call(["%s" % self.msbuild_path, "pjlib_util.vcxproj"])
             os.chdir("../../pjmedia/build")
-            os.system("%s pjmedia.vcxproj" % self.msbuild_path)
-            os.system("%s pjmedia_audiodev.vcxproj" % self.msbuild_path)
+            system_call(["%s" % self.msbuild_path, "pjmedia.vcxproj"])
+            system_call(["%s" % self.msbuild_path, "pjmedia_audiodev.vcxproj"])
             os.chdir("../../third_party/build/srtp")
-            os.system("%s libsrtp.vcxproj" % self.msbuild_path)
+            system_call(["%s" % self.msbuild_path, "libsrtp.vcxproj"])
             os.chdir("../../../pjnath/build")
-            os.system("%s pjnath.vcxproj" % self.msbuild_path)
+            system_call(["%s" % self.msbuild_path, "pjnath.vcxproj"])
             os.chdir("../../pjsip/build")
-            os.system("%s pjsip_simple.vcxproj" % self.msbuild_path)
-            os.system("%s pjsip_ua.vcxproj" % self.msbuild_path)
-            os.system("%s pjsip_core.vcxproj" % self.msbuild_path)
-            os.system("%s pjsua_lib.vcxproj" % self.msbuild_path)
+            system_call(["%s" % self.msbuild_path, "pjsip_simple.vcxproj"])
+            system_call(["%s" % self.msbuild_path, "pjsip_ua.vcxproj"])
+            system_call(["%s" % self.msbuild_path, "pjsip_core.vcxproj"])
+            system_call(["%s" % self.msbuild_path, "pjsua_lib.vcxproj"])
             os.chdir("../../../build")
-            os.system("%s %s" % (make, mkcmd))
+            system_call(["%s" % make,"%s" % mkcmd])
             os.chdir("..")
         else:
-            os.system("./cmake/init-cmake.sh")
-            os.system("cmake --build ./build")
-    
+            system_call(["/bin/bash","./cmake/init-cmake.sh"])
+            system_call(["/usr/bin/cmake","--build ./builds"])
+
+def system_call(cmd):
+    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    try:
+        for l in p.stdout.readlines():
+            print l,
+    except IOError:
+        pass
+    p.wait()
+    if p.returncode != 0:
+        errorout("Error detected during system call! '%s' returned with exit code: %d" % (cmd[0], p.returncode))
+
 def test_ice():
     print "\n\nBuilding Ice\n"
     os.chdir("./cpp")
     if plat == "Windows":
-        os.system("%s %s" % (make, mkcmd))
-        os.system("%s %s install" % (make, mkcmd))
+        system_call(["%s" % make,"%s" % mkcmd])
+        system_call(["%s" % make,"%s install" % mkcmd])
     elif plat == "SunOS":
-        os.system("%s MCPP_HOME=/usr/local EXPAT_HOME=/usr/sfw OPENSSL_HOME=/usr/sfw DB_HOME=/usr/local/BerkeleyDB.4.8" % make)
-        os.system("%s install" % make)
+        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:
-        os.system(make)
-        os.system("%s install" % make)
+        system_call(["%s" % make])
+        system_call(["%s" % make,"install"])
     sys.exit(0)
 
 def test_slice_plugins():
     print "\n\nBuilding Slice Plugins\n"
     os.system("cmake .")
     if plat == "Windows":
-        os.system("%s %s" % (make, mkcmd))
-        os.system("%s %s install" % (make, mkcmd))
+        system_call(["%s" % make,"%s" % mkcmd])
+        system_call(["%s" % make,"%s install" % mkcmd])
     elif plat == "SunOS":
-        os.system("%s MCPP_HOME=/usr/local EXPAT_HOME=/usr/sfw OPENSSL_HOME=/usr/sfw DB_HOME=/usr/local/BerkeleyDB.4.8" % make)
-        os.system("%s install" % make)
+        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:
-        os.system(make)
-        os.system("%s install" % make)
+        system_call(["%s" % make])
+        system_call(["%s" % make,"install"])
+
     sys.exit(0)
 
 def readinfile(file):

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


-- 
asterisk-scf/release/testsuite.git



More information about the asterisk-scf-commits mailing list