Rev 5425: (gz) Warn if platform doesn't support selftest --parallel=fork (Martin [gz]) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Sep 14 17:31:24 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5425 [merge]
revision-id: pqm at pqm.ubuntu.com-20100914163122-geipr89d2myl2299
parent: pqm at pqm.ubuntu.com-20100914123018-2ozoky6crajelpkr
parent: gzlist at googlemail.com-20100914092957-l43cx2v23vlnm33o
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-09-14 17:31:22 +0100
message:
  (gz) Warn if platform doesn't support selftest --parallel=fork (Martin [gz])
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
=== modified file 'NEWS'
--- a/NEWS	2010-09-13 11:11:42 +0000
+++ b/NEWS	2010-09-14 09:29:57 +0000
@@ -289,6 +289,9 @@
 * HTTP test servers will leak less threads (and sockets) and will not hang on
   AIX anymore. (Vincent Ladeuil, #405745)
 
+* On platforms that don't support forking give a nice error message saying so
+  when ``bzr selftest --parallel=fork`` is used. (Martin [gz], #528730)
+
 * Rearrange thread leak detection code to eliminate global state and make it
   possible to extend the reporting. (Marting [gz], #633462)
 

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2010-09-13 11:11:42 +0000
+++ b/bzrlib/tests/__init__.py	2010-09-14 09:29:57 +0000
@@ -2981,6 +2981,9 @@
 
 
 def fork_decorator(suite):
+    if getattr(os, "fork", None) is None:
+        raise errors.BzrCommandError("platform does not support fork,"
+            " try --parallel=subprocess instead.")
     concurrency = osutils.local_concurrency()
     if concurrency == 1:
         return suite

=== modified file 'bzrlib/tests/blackbox/test_selftest.py'
--- a/bzrlib/tests/blackbox/test_selftest.py	2010-07-18 14:28:12 +0000
+++ b/bzrlib/tests/blackbox/test_selftest.py	2010-09-03 20:49:17 +0000
@@ -16,6 +16,8 @@
 
 """UI tests for the test framework."""
 
+import os
+
 from bzrlib import (
     tests,
     )
@@ -148,3 +150,12 @@
     def test_lsprof_tests(self):
         params = self.get_params_passed_to_core('selftest --lsprof-tests')
         self.assertEqual(True, params[1]["lsprof_tests"])
+
+    def test_parallel_fork_unsupported(self):
+        if getattr(os, "fork", None) is not None:
+            self.addCleanup(setattr, os, "fork", os.fork)
+            del os.fork
+        out, err = self.run_bzr(["selftest", "--parallel=fork", "-s", "bt.x"],
+            retcode=3)
+        self.assertIn("platform does not support fork", err)
+        self.assertFalse(out)




More information about the bazaar-commits mailing list