Rev 6043: (jameinel) Bug #837293, in file:///home/pqm/archives/thelove/bzr/2.4/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Sep 2 19:03:59 UTC 2011


At file:///home/pqm/archives/thelove/bzr/2.4/

------------------------------------------------------------
revno: 6043 [merge]
revision-id: pqm at pqm.ubuntu.com-20110902190356-klgmcwh1b2tqv7jv
parent: pqm at pqm.ubuntu.com-20110831103140-tmbqgxm1o2wea1rz
parent: john at arbash-meinel.com-20110830104540-nd6yewkcq0hvt9s1
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.4
timestamp: Fri 2011-09-02 19:03:56 +0000
message:
  (jameinel) Bug #837293,
   disable fsync and fdatasync while running 'bzr selftest'. (John A Meinel)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-07-06 13:30:21 +0000
+++ b/bzrlib/builtins.py	2011-08-30 10:45:40 +0000
@@ -3733,6 +3733,9 @@
                                 param_name='starting_with', short_name='s',
                                 help=
                                 'Load only the tests starting with TESTID.'),
+                     Option('sync',
+                            help="By default we disable fsync and fdatasync"
+                                 " while running the test suite.")
                      ]
     encoding_type = 'replace'
 
@@ -3746,7 +3749,8 @@
             first=False, list_only=False,
             randomize=None, exclude=None, strict=False,
             load_list=None, debugflag=None, starting_with=None, subunit=False,
-            parallel=None, lsprof_tests=False):
+            parallel=None, lsprof_tests=False,
+            sync=False):
         from bzrlib import tests
 
         if testspecs_list is not None:
@@ -3781,6 +3785,8 @@
             exclude_pattern = None
         else:
             exclude_pattern = '(' + '|'.join(exclude) + ')'
+        if not sync:
+            self._disable_fsync()
         selftest_kwargs = {"verbose": verbose,
                           "pattern": pattern,
                           "stop_on_failure": one,
@@ -3808,6 +3814,15 @@
             cleanup()
         return int(not result)
 
+    def _disable_fsync(self):
+        """Change the 'os' functionality to not synchronize."""
+        self._orig_fsync = getattr(os, 'fsync', None)
+        if self._orig_fsync is not None:
+            os.fsync = lambda filedes: None
+        self._orig_fdatasync = getattr(os, 'fdatasync', None)
+        if self._orig_fdatasync is not None:
+            os.fdatasync = lambda filedes: None
+
 
 class cmd_version(Command):
     __doc__ = """Show version of bzr."""

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-08-30 14:35:11 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-09-02 19:03:56 +0000
@@ -38,6 +38,10 @@
 * ``dirstate.fdatasync`` and ``repository.fdatasync`` can now properly be
   disabled. (Vincent Ladeuil, #824513)
 
+* Disable ``os.fsync`` and ``os.fdatasync`` by default when running
+  ``bzr selftest``. You can use ``--sync`` to re-enable them.
+  (John Arbash Meinel, #837293)
+
 * Fix i18n use when no environment variables are set. (Jelmer Vernooij, #810701)
 
 * Avoid UnicodeDecode error when reporting EINVAL from transports.




More information about the bazaar-commits mailing list