~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Andrew Bennetts
  • Date: 2010-07-29 11:17:57 UTC
  • mfrom: (5050.3.17 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: andrew.bennetts@canonical.com-20100729111757-018h3pcefo7z0dnq
Merge lp:bzr/2.2 into lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2689
2689
                "NAME_PATTERN or --default-rules.")
2690
2690
        name_pattern_list = [globbing.normalize_pattern(p)
2691
2691
                             for p in name_pattern_list]
 
2692
        bad_patterns = ''
 
2693
        for p in name_pattern_list:
 
2694
            if not globbing.Globster.is_pattern_valid(p):
 
2695
                bad_patterns += ('\n  %s' % p)
 
2696
        if bad_patterns:
 
2697
            msg = ('Invalid ignore pattern(s) found. %s' % bad_patterns)
 
2698
            ui.ui_factory.show_error(msg)
 
2699
            raise errors.InvalidPattern('')
2692
2700
        for name_pattern in name_pattern_list:
2693
2701
            if (name_pattern[0] == '/' or
2694
2702
                (len(name_pattern) > 1 and name_pattern[1] == ':')):
3506
3514
                                 'throughout the test suite.',
3507
3515
                            type=get_transport_type),
3508
3516
                     Option('benchmark',
3509
 
                            help='Run the benchmarks rather than selftests.'),
 
3517
                            help='Run the benchmarks rather than selftests.',
 
3518
                            hidden=True),
3510
3519
                     Option('lsprof-timed',
3511
3520
                            help='Generate lsprof output for benchmarked'
3512
3521
                                 ' sections of code.'),
3513
3522
                     Option('lsprof-tests',
3514
3523
                            help='Generate lsprof output for each test.'),
3515
 
                     Option('cache-dir', type=str,
3516
 
                            help='Cache intermediate benchmark output in this '
3517
 
                                 'directory.'),
3518
3524
                     Option('first',
3519
3525
                            help='Run all tests, but run specified tests first.',
3520
3526
                            short_name='f',
3554
3560
 
3555
3561
    def run(self, testspecs_list=None, verbose=False, one=False,
3556
3562
            transport=None, benchmark=None,
3557
 
            lsprof_timed=None, cache_dir=None,
 
3563
            lsprof_timed=None,
3558
3564
            first=False, list_only=False,
3559
3565
            randomize=None, exclude=None, strict=False,
3560
3566
            load_list=None, debugflag=None, starting_with=None, subunit=False,
3561
3567
            parallel=None, lsprof_tests=False):
3562
3568
        from bzrlib.tests import selftest
3563
 
        import bzrlib.benchmarks as benchmarks
3564
 
        from bzrlib.benchmarks import tree_creator
3565
3569
 
3566
3570
        # Make deprecation warnings visible, unless -Werror is set
3567
3571
        symbol_versioning.activate_deprecation_warnings(override=False)
3568
3572
 
3569
 
        if cache_dir is not None:
3570
 
            tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
3571
3573
        if testspecs_list is not None:
3572
3574
            pattern = '|'.join(testspecs_list)
3573
3575
        else:
3592
3594
            self.additional_selftest_args.setdefault(
3593
3595
                'suite_decorators', []).append(parallel)
3594
3596
        if benchmark:
3595
 
            test_suite_factory = benchmarks.test_suite
3596
 
            # Unless user explicitly asks for quiet, be verbose in benchmarks
3597
 
            verbose = not is_quiet()
3598
 
            # TODO: should possibly lock the history file...
3599
 
            benchfile = open(".perf_history", "at", buffering=1)
3600
 
            self.add_cleanup(benchfile.close)
3601
 
        else:
3602
 
            test_suite_factory = None
3603
 
            benchfile = None
 
3597
            raise errors.BzrCommandError(
 
3598
                "--benchmark is no longer supported from bzr 2.2; "
 
3599
                "use bzr-usertest instead")
 
3600
        test_suite_factory = None
3604
3601
        selftest_kwargs = {"verbose": verbose,
3605
3602
                          "pattern": pattern,
3606
3603
                          "stop_on_failure": one,
3608
3605
                          "test_suite_factory": test_suite_factory,
3609
3606
                          "lsprof_timed": lsprof_timed,
3610
3607
                          "lsprof_tests": lsprof_tests,
3611
 
                          "bench_history": benchfile,
3612
3608
                          "matching_tests_first": first,
3613
3609
                          "list_only": list_only,
3614
3610
                          "random_seed": randomize,