~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

(vila) Release 2.4.1 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3733
3733
                                param_name='starting_with', short_name='s',
3734
3734
                                help=
3735
3735
                                'Load only the tests starting with TESTID.'),
 
3736
                     Option('sync',
 
3737
                            help="By default we disable fsync and fdatasync"
 
3738
                                 " while running the test suite.")
3736
3739
                     ]
3737
3740
    encoding_type = 'replace'
3738
3741
 
3746
3749
            first=False, list_only=False,
3747
3750
            randomize=None, exclude=None, strict=False,
3748
3751
            load_list=None, debugflag=None, starting_with=None, subunit=False,
3749
 
            parallel=None, lsprof_tests=False):
 
3752
            parallel=None, lsprof_tests=False,
 
3753
            sync=False):
3750
3754
        from bzrlib import tests
3751
3755
 
3752
3756
        if testspecs_list is not None:
3781
3785
            exclude_pattern = None
3782
3786
        else:
3783
3787
            exclude_pattern = '(' + '|'.join(exclude) + ')'
 
3788
        if not sync:
 
3789
            self._disable_fsync()
3784
3790
        selftest_kwargs = {"verbose": verbose,
3785
3791
                          "pattern": pattern,
3786
3792
                          "stop_on_failure": one,
3808
3814
            cleanup()
3809
3815
        return int(not result)
3810
3816
 
 
3817
    def _disable_fsync(self):
 
3818
        """Change the 'os' functionality to not synchronize."""
 
3819
        self._orig_fsync = getattr(os, 'fsync', None)
 
3820
        if self._orig_fsync is not None:
 
3821
            os.fsync = lambda filedes: None
 
3822
        self._orig_fdatasync = getattr(os, 'fdatasync', None)
 
3823
        if self._orig_fdatasync is not None:
 
3824
            os.fdatasync = lambda filedes: None
 
3825
 
3811
3826
 
3812
3827
class cmd_version(Command):
3813
3828
    __doc__ = """Show version of bzr."""