[csw-devel] SF.net SVN: gar:[8201] csw/mgar/gar/v2

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Jan 27 16:43:39 CET 2010


Revision: 8201
          http://gar.svn.sourceforge.net/gar/?rev=8201&view=rev
Author:   wahwah
Date:     2010-01-27 15:43:32 +0000 (Wed, 27 Jan 2010)

Log Message:
-----------
mGAR v2: fixes end-to-end tests by using ENABLE_CHECK= in the argument list.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/gartest.py
    csw/mgar/gar/v2/tests/example_test.py
    csw/mgar/gar/v2/tests/run_tests.py

Modified: csw/mgar/gar/v2/lib/python/gartest.py
===================================================================
--- csw/mgar/gar/v2/lib/python/gartest.py	2010-01-27 14:44:47 UTC (rev 8200)
+++ csw/mgar/gar/v2/lib/python/gartest.py	2010-01-27 15:43:32 UTC (rev 8201)
@@ -58,7 +58,13 @@
   def Build(self):
     if self.built:
       return 0
-    args = ["gmake", "dirpackage"]
+    # There's a need to turn off the use of checkpkg, as it needs a pkg.gz
+    # file, and the dirpackage target doesn't create it.  But it's not
+    # a problem, since the built package needs to be examined in a very
+    # specific way, we don't want to run all the tests against it.
+    #
+    # Hence, "ENABLE_CHECK=".
+    args = ["gmake", "ENABLE_CHECK=", "dirpackage"]
     gar_proc = subprocess.Popen(args, cwd=self.build_dir,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
@@ -125,9 +131,10 @@
         "TEST_SCRIPTS": "",
         "INSTALL_SCRIPTS": "",
     }
+    garsrc = os.path.join(os.getcwd(), os.path.dirname(__file__), "..", "..")
     self.tmpldata = {
         "garvars": self.garvars,
-        "garsrc": os.path.join(os.getcwd(), ".."),
+        "garsrc": garsrc,
         "blurb": None,
         "install_files": self.install_files,
         "build_dir": self.build_dir,
@@ -168,7 +175,8 @@
 
   def __del__(self):
     if self.cleanup:
-      shutil.rmtree(self.build_dir)
+      if os.path.isdir(self.build_dir):
+        shutil.rmtree(self.build_dir)
 
 
 class StaticGarBuild(GarBuild):
@@ -176,8 +184,13 @@
   def __init__(self, build_dir):
     super(StaticGarBuild, self).__init__(build_dir)
 
+  def GetDebugHelp(self):
+    return ("Please look into %s.\n"
+            % repr(self.build_dir))
+
   def __del__(self):
     if self.cleanup:
-      shutil.rmtree(os.path.join(self.build_dir, "work"))
+      if os.path.isdir(self.build_dir):
+        shutil.rmtree(os.path.join(self.build_dir, "work"))
 
 # vim:set ts=2 sts=2 sw=2 expandtab:

Modified: csw/mgar/gar/v2/tests/example_test.py
===================================================================
--- csw/mgar/gar/v2/tests/example_test.py	2010-01-27 14:44:47 UTC (rev 8200)
+++ csw/mgar/gar/v2/tests/example_test.py	2010-01-27 15:43:32 UTC (rev 8201)
@@ -1,7 +1,8 @@
 # $Id$
 
+import os.path
+import sys
 import unittest
-import sys
 sys.path.append("../lib/python")
 import gartest
 
@@ -29,7 +30,8 @@
   """
 
   def testLooseFiles(self):
-    mybuild = gartest.StaticGarBuild("static/example")
+    mybuild = gartest.StaticGarBuild(
+        os.path.join(os.path.dirname(__file__), "static/example"))
     mybuild.Build()
     pkg = mybuild.GetFirstBuiltPackage()
     pkginfo = pkg.GetParsedPkginfo()

Modified: csw/mgar/gar/v2/tests/run_tests.py
===================================================================
--- csw/mgar/gar/v2/tests/run_tests.py	2010-01-27 14:44:47 UTC (rev 8200)
+++ csw/mgar/gar/v2/tests/run_tests.py	2010-01-27 15:43:32 UTC (rev 8201)
@@ -2,10 +2,17 @@
 # $Id$
 
 import unittest
+import sys
+import os.path
+module_path = [os.path.dirname(__file__),
+               "..", "lib", "python"]
+sys.path.append(os.path.join(*module_path))
 
 # To add more test files, create <name>.py file and add a corresponding line
 # here:
-from example_test import *
+from opencsw_test  import *
+from checkpkg_test import *
+from example_test  import *
 
 if __name__ == '__main__':
   unittest.main()


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list