Rev 6040: Bug #837293, make 'bzr selftest' disable fsync/fdatasync while running. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-disable-selftest-fdatasync-837293
John Arbash Meinel
john at arbash-meinel.com
Tue Aug 30 10:46:10 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.4-disable-selftest-fdatasync-837293
------------------------------------------------------------
revno: 6040
revision-id: john at arbash-meinel.com-20110830104540-nd6yewkcq0hvt9s1
parent: pqm at pqm.ubuntu.com-20110824141634-e0mk34gej3pitt54
fixes bug(s): https://launchpad.net/bugs/837293
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-disable-selftest-fdatasync-837293
timestamp: Tue 2011-08-30 12:45:40 +0200
message:
Bug #837293, make 'bzr selftest' disable fsync/fdatasync while running.
-------------- next part --------------
=== 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-24 08:02:23 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-08-30 10:45:40 +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)
Documentation
More information about the bazaar-commits
mailing list