Rev 3414: Add --debugflags/-E option to selftest. (Andrew Bennetts) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu May 8 01:31:30 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3414
revision-id:pqm at pqm.ubuntu.com-20080508003116-ps46dreqbprfr166
parent: pqm at pqm.ubuntu.com-20080507203144-i3ayws9rh7mf97rv
parent: andrew.bennetts at canonical.com-20080507224756-upxgmud0bdo4ysuf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-05-08 01:31:16 +0100
message:
  Add --debugflags/-E option to selftest. (Andrew Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
  bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
  doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
    ------------------------------------------------------------
    revno: 3390.1.3
    revision-id:andrew.bennetts at canonical.com-20080507224756-upxgmud0bdo4ysuf
    parent: andrew.bennetts at canonical.com-20080507224624-ymdbku232tf4fqk3
    parent: pqm at pqm.ubuntu.com-20080507100452-ya8ofjjd5f5pb9q7
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: selftest-debug-flags
    timestamp: Thu 2008-05-08 08:47:56 +1000
    message:
      Merge from bzr.dev.
    added:
      bzrlib/tests/branch_implementations/test_check.py test_check.py-20080429151303-1sbfclxhddpz0tnj-1
      bzrlib/tests/branch_implementations/test_reconcile.py test_reconcile.py-20080429161555-qlmccuyeyt6pvho7-1
      bzrlib/tests/interrepository_implementations/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
      doc/developers/releasing.txt   releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/add.py                  add.py-20050323030017-3a77d63feda58e33
      bzrlib/benchmarks/bench_bundle.py bench_bundle.py-20060719055338-o1c6ieybbwt6c3zv-1
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/bundle_data.py   read_changeset.py-20050619171944-c0d95aa685537640
      bzrlib/bundle/serializer/v4.py v10.py-20070611062757-5ggj7k18s9dej0fr-1
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/help.py                 help.py-20050505025907-4dd7a6d63912f894
      bzrlib/hooks.py                hooks.py-20070325015548-ix4np2q0kd8452au-1
      bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/lockable_files.py       control_files.py-20051111201905-bb88546e799d669f
      bzrlib/missing.py              missing.py-20050812153334-097f7097e2a8bcd1
      bzrlib/mutabletree.py          mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/smart/branch.py         branch.py-20061124031907-mzh3pla28r83r97f-1
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/store/revision/text.py  text.py-20060303020652-e49155f0da4d14ab
      bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
      bzrlib/tests/blackbox/test_hooks.py test_hooks.py-20080308163236-xljgf9j41hik1x21-1
      bzrlib/tests/blackbox/test_reconcile.py test_fix.py-20060223013051-9a188e15a5ee9451
      bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
      bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/branch_implementations/test_commit.py test_commit.py-20070206022134-117z1i5b644p63r0-1
      bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
      bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
      bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
      bzrlib/tests/branch_implementations/test_uncommit.py test_uncommit.py-20070205180410-ge7058d9138mvq3x-1
      bzrlib/tests/interrepository_implementations/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_ancestry.py  test_ancestry.py-20050913023709-69768e94848312c6
      bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_hooks.py     test_hooks.py-20070628030849-89rtsbe5dmer5npz-1
      bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
      bzrlib/tests/test_missing.py   test_missing.py-20051212000028-694fa4f658a81f48
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_reconcile.py test_reconcile.py-20060225054842-50aa618584a86f26
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
      bzrlib/tests/test_revisiontree.py test_revisiontree.py-20060615095324-aij44ndxbv1h4c9f-1
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_status.py    test_status.py-20060516190614-fbf6432e4a6e8aa5
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_version_info.py test_version_info.py-20051228204928-2c364e30b702b41b
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/tests/transport_util.py transportutil.py-20070525113600-5v2igk89s8fensom-1
      bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
      bzrlib/tests/workingtree_implementations/test_basis_inventory.py test_basis_inventory.py-20051218151655-3650468941091309
      bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
      bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
      bzrlib/tests/workingtree_implementations/test_set_root_id.py test_set_root_id.py-20061004073850-0r1c7qikmnkb8m9k-1
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/sftp.py       sftp.py-20051019050329-ab48ce71b7e32dfe
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/version_info_formats/__init__.py generate_version_info.py-20051228204928-8358edabcddcd97e
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      doc/default.css                default.css-20060622101119-tgwtdci8z769bjb9-1
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
      doc/developers/index.txt       index.txt-20070508041241-qznziunkg0nffhiw-1
      doc/developers/network-protocol.txt networkprotocol.txt-20070903044232-woustorrjbmg5zol-1
      doc/en/user-guide/hooks.txt    hooks.txt-20070829200551-7nr6e5a1io6x78uf-1
    ------------------------------------------------------------
    revno: 3390.1.2
    revision-id:andrew.bennetts at canonical.com-20080507224624-ymdbku232tf4fqk3
    parent: andrew.bennetts at canonical.com-20080502060046-bpyc9jgfdcvrckdt
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: selftest-debug-flags
    timestamp: Thu 2008-05-08 08:46:24 +1000
    message:
      Improve NEWS entry.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3390.1.1
    revision-id:andrew.bennetts at canonical.com-20080502060046-bpyc9jgfdcvrckdt
    parent: pqm at pqm.ubuntu.com-20080429155137-0w5littcl831pq4m
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: selftest-debug-flags
    timestamp: Fri 2008-05-02 16:00:46 +1000
    message:
      Add --debugflags/-E option to selftest.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
=== modified file 'NEWS'
--- a/NEWS	2008-05-07 10:04:52 +0000
+++ b/NEWS	2008-05-07 22:47:56 +0000
@@ -90,6 +90,11 @@
       make it easy to identify which test spawned a thread with an unhandled
       exception. (Andrew Bennetts)
 
+    * New ``--debugflag``/``-E`` option to ``bzr selftest`` for setting
+      options for debugging tests, these are complementary to the the -D
+      options.  The ``-Dselftest_debug`` global option has been replaced by the
+      ``-E=allow_debug`` option for selftest. (Andrew Bennetts)
+
     * Parameterised test ids are preserved correctly to aid diagnosis of test
       failures. (Robert Collins, Andrew Bennetts)
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-05-07 05:09:19 +0000
+++ b/bzrlib/builtins.py	2008-05-07 22:47:56 +0000
@@ -2639,6 +2639,8 @@
                             'known failures.'),
                      Option('load-list', type=str, argname='TESTLISTFILE',
                             help='Load a test id list from a text file.'),
+                     ListOption('debugflag', type=str, short_name='E',
+                                help='Turn on a selftest debug flag.'),
                      ]
     encoding_type = 'replace'
 
@@ -2647,7 +2649,7 @@
             lsprof_timed=None, cache_dir=None,
             first=False, list_only=False,
             randomize=None, exclude=None, strict=False,
-            load_list=None):
+            load_list=None, debugflag=None):
         import bzrlib.ui
         from bzrlib.tests import selftest
         import bzrlib.benchmarks as benchmarks
@@ -2690,6 +2692,7 @@
                               exclude_pattern=exclude,
                               strict=strict,
                               load_list=load_list,
+                              debug_flags=debugflag,
                               )
         finally:
             if benchfile is not None:

=== modified file 'bzrlib/debug.py'
--- a/bzrlib/debug.py	2008-04-25 19:03:24 +0000
+++ b/bzrlib/debug.py	2008-05-07 22:47:56 +0000
@@ -39,6 +39,5 @@
  * lock - trace when lockdir locks are taken or released
  * merge - emit information for debugging merges
  * pack - emit information about pack operations
- * selftest_debug - do not disable all debug flags when running selftest
 
 """

=== modified file 'bzrlib/help_topics/__init__.py'
--- a/bzrlib/help_topics/__init__.py	2008-04-24 05:33:19 +0000
+++ b/bzrlib/help_topics/__init__.py	2008-05-02 06:00:46 +0000
@@ -292,7 +292,6 @@
 -Dlock            Trace when lockdir locks are taken or released.
 -Dmerge           Emit information for debugging merges.
 -Dpack            Emit information about pack operations.
--Dselftest_debug  Do not disable all debug flags when running selftest.
 """
 
 _standard_options = \

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-05-07 05:09:19 +0000
+++ b/bzrlib/tests/__init__.py	2008-05-07 22:47:56 +0000
@@ -805,7 +805,7 @@
         Tests that want to use debug flags can just set them in the
         debug_flags set during setup/teardown.
         """
-        if 'selftest_debug' not in debug.debug_flags:
+        if 'allow_debug' not in selftest_debug_flags:
             self._preserved_debug_flags = set(debug.debug_flags)
             debug.debug_flags.clear()
             self.addCleanup(self._restore_debug_flags)
@@ -2454,6 +2454,10 @@
     return result.wasSuccessful()
 
 
+# Controlled by "bzr selftest -E=..." option
+selftest_debug_flags = set()
+
+
 def selftest(verbose=False, pattern=".*", stop_on_failure=True,
              transport=None,
              test_suite_factory=None,
@@ -2465,6 +2469,7 @@
              exclude_pattern=None,
              strict=False,
              load_list=None,
+             debug_flags=None,
              ):
     """Run the whole test suite under the enhanced runner"""
     # XXX: Very ugly way to do this...
@@ -2478,6 +2483,10 @@
         transport = default_transport
     old_transport = default_transport
     default_transport = transport
+    global selftest_debug_flags
+    old_debug_flags = selftest_debug_flags
+    if debug_flags is not None:
+        selftest_debug_flags = set(debug_flags)
     try:
         if load_list is None:
             keep_only = None
@@ -2499,6 +2508,7 @@
                      strict=strict)
     finally:
         default_transport = old_transport
+        selftest_debug_flags = old_debug_flags
 
 
 def load_test_id_list(file_name):

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2008-05-05 21:06:35 +0000
+++ b/bzrlib/tests/test_osutils.py	2008-05-07 22:47:56 +0000
@@ -1119,7 +1119,6 @@
  * lock - trace when lockdir locks are taken or released
  * merge - emit information for debugging merges
  * pack - emit information about pack operations
- * selftest_debug - do not disable all debug flags when running selftest
 
 """
 '''

=== modified file 'doc/developers/HACKING.txt'
--- a/doc/developers/HACKING.txt	2008-05-02 02:32:18 +0000
+++ b/doc/developers/HACKING.txt	2008-05-07 22:47:56 +0000
@@ -284,6 +284,17 @@
 filter patterns to understand their effect.
 
 
+Test suite debug flags
+----------------------
+
+Similar to the global ``-Dfoo`` debug options, bzr selftest accepts
+``-E=foo`` debug flags.  These flags are:
+
+:allow_debug: do *not* clear the global debug flags when running a test.
+  This can provide useful logging to help debug test failures when used
+  with e.g. ``bzr -Dhpss selftest -E=allow_debug``
+
+
 Writing Tests
 =============
 




More information about the bazaar-commits mailing list