jhbuild r1868 - in trunk: . jhbuild/modtypes tests



Author: fpeters
Date: Mon Jan 21 10:36:43 2008
New Revision: 1868
URL: http://svn.gnome.org/viewvc/jhbuild?rev=1868&view=rev

Log:
* jhbuild/modtypes/waf.py, tests/tests.py: added checks for waf module
type.



Modified:
   trunk/ChangeLog
   trunk/jhbuild/modtypes/waf.py
   trunk/tests/tests.py

Modified: trunk/jhbuild/modtypes/waf.py
==============================================================================
--- trunk/jhbuild/modtypes/waf.py	(original)
+++ trunk/jhbuild/modtypes/waf.py	Mon Jan 21 10:36:43 2008
@@ -98,12 +98,12 @@
                 not buildscript.config.alwaysautogen)
 
     def do_configure(self, buildscript):
+        builddir = self.get_builddir(buildscript)
+        buildscript.set_action('Configuring', self)
         if not inpath(self.waf_cmd, os.environ['PATH'].split(os.pathsep)):
             raise CommandError('Missing waf, try jhbuild -m bootstrap buildone waf')
-        builddir = self.get_builddir(buildscript)
         if buildscript.config.buildroot and not os.path.exists(builddir):
             os.makedirs(builddir)
-        buildscript.set_action('Configuring', self)
         cmd = [self.waf_cmd, 'configure', '--prefix', buildscript.config.prefix]
         buildscript.execute(cmd, cwd=builddir)
     do_configure.next_state = STATE_CLEAN

Modified: trunk/tests/tests.py
==============================================================================
--- trunk/tests/tests.py	(original)
+++ trunk/tests/tests.py	Mon Jan 21 10:36:43 2008
@@ -211,6 +211,66 @@
                  'foo:Checking [error]'])
 
 
+class WafModTypeTestCase(BuildTestCase):
+    '''Waf steps'''
+
+    def setUp(self):
+        BuildTestCase.setUp(self)
+        from jhbuild.modtypes.waf import WafModule
+        self.modules = [WafModule('foo', self.branch)]
+        self.modules[0].waf_cmd = 'true' # set a command for waf that always exist
+
+    def test_build(self):
+        '''Building a waf module'''
+        self.assertEqual(self.build(),
+                ['foo:Checking out', 'foo:Configuring', 'foo:Building',
+                 'foo:Installing'])
+
+    def test_build_no_network(self):
+        '''Building a waf module, without network'''
+        self.assertEqual(self.build(nonetwork = True),
+                ['foo:Configuring', 'foo:Building', 'foo:Installing'])
+
+    def test_update(self):
+        '''Updating a waf module'''
+        self.assertEqual(self.build(nobuild = True), ['foo:Checking out'])
+
+    def test_build_check(self):
+        '''Building a waf module, with checks'''
+        self.assertEqual(self.build(makecheck = True),
+                ['foo:Checking out', 'foo:Configuring', 'foo:Building',
+                 'foo:Checking', 'foo:Installing'])
+
+    def test_build_clean_and_check(self):
+        '''Building a waf module, with cleaning and checks'''
+        self.assertEqual(self.build(makecheck = True, makeclean = True),
+                ['foo:Checking out', 'foo:Configuring', 'foo:Cleaning',
+                 'foo:Building', 'foo:Checking', 'foo:Installing'])
+
+    def test_build_check_error(self):
+        '''Building a waf module, with an error in make check'''
+
+        def make_check_error(buildscript, *args):
+            self.modules[0].do_check_orig(buildscript, *args)
+            raise CommandError('Mock Command Error Exception')
+        make_check_error.next_state = self.modules[0].do_check.next_state
+        make_check_error.error_states = self.modules[0].do_check.error_states
+        self.modules[0].do_check_orig = self.modules[0].do_check
+        self.modules[0].do_check = make_check_error
+
+        self.assertEqual(self.build(makecheck = True),
+                ['foo:Checking out', 'foo:Configuring', 'foo:Building',
+                 'foo:Checking [error]'])
+
+    def test_build_missing_waf_command(self):
+        '''Building a waf module, on a system missing the waf command'''
+        self.modules[0].waf_cmd = 'foo bar'
+        self.assertEqual(self.build(),
+                ['foo:Checking out', 'foo:Configuring [error]'])
+
+
+
+
 
 class BuildPolicyTestCase(BuildTestCase):
     '''Build Policy'''



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