gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19183 - in gnunet-update: gnunet_update test


From: gnunet
Subject: [GNUnet-SVN] r19183 - in gnunet-update: gnunet_update test
Date: Mon, 16 Jan 2012 23:12:12 +0100

Author: harsha
Date: 2012-01-16 23:12:12 +0100 (Mon, 16 Jan 2012)
New Revision: 19183

Added:
   gnunet-update/test/test_regression.py
Modified:
   gnunet-update/gnunet_update/install.py
   gnunet-update/gnunet_update/package.py
Log:
- added regression test case

Modified: gnunet-update/gnunet_update/install.py
===================================================================
--- gnunet-update/gnunet_update/install.py      2012-01-16 21:31:46 UTC (rev 
19182)
+++ gnunet-update/gnunet_update/install.py      2012-01-16 22:12:12 UTC (rev 
19183)
@@ -211,6 +211,7 @@
         os.symlink(dep.realname, dep.name)
         installed_dep_files.append(dep)
 
+    os.chdir(orig_working_dir)
     package_tarfile.close()
 
     # run ldconfig -n in the dep_dir

Modified: gnunet-update/gnunet_update/package.py
===================================================================
--- gnunet-update/gnunet_update/package.py      2012-01-16 21:31:46 UTC (rev 
19182)
+++ gnunet-update/gnunet_update/package.py      2012-01-16 22:12:12 UTC (rev 
19183)
@@ -44,11 +44,11 @@
 package_file = ""
 prefix_given = False
 external_config_file = None
-configure_options = list()
-binary_objects = list()
-other_objects = list()
+configure_options = None
+binary_objects = None
+other_objects = None
 #dependency cache
-dependencies = dict()
+dependencies = None
 config = None
 
 def usage():
@@ -343,7 +343,16 @@
     global install_prefix
     global package_file
     global external_config_file
+    global configure_options
+    global binary_objects
+    global other_objects
+    global dependencies
 
+    configure_options = list()
+    binary_objects = list()
+    other_objects = list()
+    dependencies = dict()
+
     #first parse the command line arguments
     try:
         opts, args = getopt.getopt(sys.argv[1:], 

Added: gnunet-update/test/test_regression.py
===================================================================
--- gnunet-update/test/test_regression.py                               (rev 0)
+++ gnunet-update/test/test_regression.py       2012-01-16 22:12:12 UTC (rev 
19183)
@@ -0,0 +1,110 @@
+# This file is part of GNUnet.
+# (C) 2001--2011 Christian Grothoff (and other contributing authors)
+#
+# GNUnet is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 2, or (at your
+# option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNUnet; see the file COPYING.  If not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+# File:    gnunet_update/tests/test_regression.py
+# Author:  Sree Harsha Totakura
+#
+# Regression tests
+#
+# IMPORTANT: set GNUNET_UPDATE_HOME environmental variable to the directory
+# having the source of GNUNET_UPDATE before running this test
+#
+# Thoughts: Add checks in between each module test??
+
+import unittest
+import os
+import tempfile
+import sys
+import shutil
+
+import __init__
+import gnunet_update.package
+import gnunet_update.install
+import gnunet_update.update
+
+class TestRegression(unittest.TestCase):
+    """UnitTest class"""
+
+    install_dir = None
+    common_argv = None
+    test_dir = None
+
+    def setUp(self):
+        """Test ramp up code"""
+        self.test_dir = os.path.join(os.environ['GNUNET_UPDATE_HOME'],
+                                     "test");
+        self.common_argv = [
+            '-c',
+            os.path.join(self.test_dir, 
+                         "confs/gnunet-update-home/etc/gnunet-update.conf")
+            ]
+        self.install_dir = tempfile.mkdtemp(prefix="gnunet-update-test")
+
+    def tearDown(self):
+        """Test tear down routine"""
+        shutil.rmtree(self.install_dir)
+        
+
+    def test_regression(self):
+        """Regression testing for packager, installer and updater"""
+
+        # Run packager on old package
+        # Set up arguments for the packager script
+        sys.argv = ["package"] + self.common_argv + [
+            # The source directory
+            os.path.join(self.test_dir, 
+                         "old/test-package"),
+            # The path where the package has to be kept
+            os.path.join(self.install_dir,
+                         "old-pack")
+            ]
+        gnunet_update.package.main()
+
+        # Run packager on new Package
+        sys.argv = ["package"] + self.common_argv + [
+            # The source directory
+            os.path.join(self.test_dir, 
+                         "new/test-package"),
+            # The path where the package has to be kept
+            os.path.join(self.install_dir,
+                         "new-pack")
+            ]
+        gnunet_update.package.main()
+
+
+        # Run installer on the old package
+        sys.argv = ["install"] + self.common_argv + [
+            # The install package file
+            os.path.join(self.install_dir, "old-pack.tgz"),
+            # installation location
+            os.path.join(self.install_dir, "install-prefix")
+            ]
+        gnunet_update.install.main()
+
+
+        # Update old package installation to new package installation
+        sys.argv = ["update"] + self.common_argv + [
+            # The new package file
+            os.path.join(self.install_dir, "new-pack.tgz"),
+            # installation location
+            os.path.join(self.install_dir, "install-prefix")
+            ]
+        gnunet_update.update.main()
+
+if __name__ == '__main__':
+    unittest.main()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]