Merge lp:~jameinel/bzr/2.4-disable-selftest-fdatasync-837293 into lp:bzr/2.4

Proposed by John A Meinel
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6043
Proposed branch: lp:~jameinel/bzr/2.4-disable-selftest-fdatasync-837293
Merge into: lp:bzr/2.4
Diff against target: 63 lines (+20/-1)
2 files modified
bzrlib/builtins.py (+16/-1)
doc/en/release-notes/bzr-2.4.txt (+4/-0)
To merge this branch: bzr merge lp:~jameinel/bzr/2.4-disable-selftest-fdatasync-837293
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+73757@code.launchpad.net

Commit message

Bug #837293, disable fsync and fdatasync while running 'bzr selftest'.

Description of the change

This changes 'bzr selftest' to hack out fsync and fdatasync for the runtime of the test suite.

I'd like to land it in 2.4 because it is the version which slowed down, and it would be nice to have any patches we land there not take 2x the time. I could live with just trunk, though, since we land a lot more patches there. (Though secretly I'd like to land this before I have to merge up my 2.3 patch :).

I chose to do os.* rather than osutils.* because that allows me to not change the test suite. (we still call os.fsync it just is a no-op)

I did run this through PQM and it dropped the runtime about in half. (So 1.5hrs down from 2.5-3.5hrs.)

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Do we still have tests that would revert the effect of your patch and explicitly test fdatasync ?

If not, a follow-up addressing that would be nice (features.with_fdatasync or something), I see no point in *always* testing fdatasync, but I'm a bit concerned about *never* testing it.

review: Approve
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/02/2011 11:16 AM, Vincent Ladeuil wrote:
> Review: Approve
> Do we still have tests that would revert the effect of your patch and explicitly test fdatasync ?
>
> If not, a follow-up addressing that would be nice (features.with_fdatasync or something), I see no point in *always* testing fdatasync, but I'm a bit concerned about *never* testing it.

You can run "bzr selftest --sync". We still have the test that is
asserting os.fdatasync is getting called if it exists.

Is there something else that you need?

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5gpEMACgkQJdeBCYSNAAMdKQCgpGSstlSjZV3EyIhNJjWncwPM
PecAoJeThVdSA6jiJDVsT1IKXdz6y6AM
=BGdd
-----END PGP SIGNATURE-----

Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> John A Meinel writes:

    > On 09/02/2011 11:16 AM, Vincent Ladeuil wrote:
    >> Review: Approve
    >> Do we still have tests that would revert the effect of your patch and explicitly test fdatasync ?
    >>

    >> If not, a follow-up addressing that would be nice
    >> (features.with_fdatasync or something), I see no point in
    >> *always* testing fdatasync, but I'm a bit concerned about *never*
    >> testing it.

    > You can run "bzr selftest --sync". We still have the test that is
    > asserting os.fdatasync is getting called if it exists.

I realise that.

    > Is there something else that you need?

More coverage. Doubling the runs on babune for example, won't be a good
usage of resources, but up to 10/20 tests with fdatasync enabled and
always running will be a better fit.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/builtins.py'
2--- bzrlib/builtins.py 2011-07-06 13:30:21 +0000
3+++ bzrlib/builtins.py 2011-09-02 09:08:24 +0000
4@@ -3733,6 +3733,9 @@
5 param_name='starting_with', short_name='s',
6 help=
7 'Load only the tests starting with TESTID.'),
8+ Option('sync',
9+ help="By default we disable fsync and fdatasync"
10+ " while running the test suite.")
11 ]
12 encoding_type = 'replace'
13
14@@ -3746,7 +3749,8 @@
15 first=False, list_only=False,
16 randomize=None, exclude=None, strict=False,
17 load_list=None, debugflag=None, starting_with=None, subunit=False,
18- parallel=None, lsprof_tests=False):
19+ parallel=None, lsprof_tests=False,
20+ sync=False):
21 from bzrlib import tests
22
23 if testspecs_list is not None:
24@@ -3781,6 +3785,8 @@
25 exclude_pattern = None
26 else:
27 exclude_pattern = '(' + '|'.join(exclude) + ')'
28+ if not sync:
29+ self._disable_fsync()
30 selftest_kwargs = {"verbose": verbose,
31 "pattern": pattern,
32 "stop_on_failure": one,
33@@ -3808,6 +3814,15 @@
34 cleanup()
35 return int(not result)
36
37+ def _disable_fsync(self):
38+ """Change the 'os' functionality to not synchronize."""
39+ self._orig_fsync = getattr(os, 'fsync', None)
40+ if self._orig_fsync is not None:
41+ os.fsync = lambda filedes: None
42+ self._orig_fdatasync = getattr(os, 'fdatasync', None)
43+ if self._orig_fdatasync is not None:
44+ os.fdatasync = lambda filedes: None
45+
46
47 class cmd_version(Command):
48 __doc__ = """Show version of bzr."""
49
50=== modified file 'doc/en/release-notes/bzr-2.4.txt'
51--- doc/en/release-notes/bzr-2.4.txt 2011-08-30 14:35:11 +0000
52+++ doc/en/release-notes/bzr-2.4.txt 2011-09-02 09:08:24 +0000
53@@ -38,6 +38,10 @@
54 * ``dirstate.fdatasync`` and ``repository.fdatasync`` can now properly be
55 disabled. (Vincent Ladeuil, #824513)
56
57+* Disable ``os.fsync`` and ``os.fdatasync`` by default when running
58+ ``bzr selftest``. You can use ``--sync`` to re-enable them.
59+ (John Arbash Meinel, #837293)
60+
61 * Fix i18n use when no environment variables are set. (Jelmer Vernooij, #810701)
62
63 * Avoid UnicodeDecode error when reporting EINVAL from transports.

Subscribers

People subscribed via source and target branches