Rev 4912: Threads don't have 'get_ident()' attributes. I think spiv meant 'getName()'. in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Fri Dec 18 21:55:02 GMT 2009


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 4912
revision-id: john at arbash-meinel.com-20091218215454-g8fpi3sb8nnstof0
parent: pqm at pqm.ubuntu.com-20091218174336-wrixy9etbc1yw8cf
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Fri 2009-12-18 15:54:54 -0600
message:
  Threads don't have 'get_ident()' attributes. I think spiv meant 'getName()'.
  
  Regardless, switching back to ident and adding a smoke test that -Dhpss
  doesn't crash 'bzr serve'.
-------------- next part --------------
=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2009-12-16 18:11:26 +0000
+++ b/bzrlib/smart/protocol.py	2009-12-18 21:54:54 +0000
@@ -1147,7 +1147,7 @@
         self.response_sent = False
         self._headers = {'Software version': bzrlib.__version__}
         if 'hpss' in debug.debug_flags:
-            self._thread_id = threading.currentThread().get_ident()
+            self._thread_id = threading.currentThread().ident
             self._response_start_time = None
 
     def _trace(self, action, message, extra_bytes=None, include_time=False):

=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py	2009-12-14 16:16:05 +0000
+++ b/bzrlib/smart/request.py	2009-12-18 21:54:54 +0000
@@ -291,7 +291,7 @@
         self._command = None
         if 'hpss' in debug.debug_flags:
             self._request_start_time = osutils.timer_func()
-            self._thread_id = threading.currentThread().get_ident()
+            self._thread_id = threading.currentThread().ident
 
     def _trace(self, action, message, extra_bytes=None, include_time=False):
         # It is a bit of a shame that this functionality overlaps with that of 

=== modified file 'bzrlib/tests/blackbox/test_serve.py'
--- a/bzrlib/tests/blackbox/test_serve.py	2009-11-25 13:21:52 +0000
+++ b/bzrlib/tests/blackbox/test_serve.py	2009-12-18 21:54:54 +0000
@@ -27,6 +27,7 @@
 
 from bzrlib import (
     builtins,
+    debug,
     errors,
     osutils,
     revision as _mod_revision,
@@ -45,6 +46,7 @@
 from bzrlib.trace import mutter
 from bzrlib.transport import get_transport, remote
 
+
 class TestBzrServeBase(TestCaseWithTransport):
 
     def run_bzr_serve_then_func(self, serve_args, retcode=0, func=None,
@@ -130,7 +132,9 @@
             finish_bzr_subprocess, a client for the server, and a transport.
         """
         # Serve from the current directory
-        process = self.start_bzr_subprocess(['serve', '--inet'])
+        args = ['serve', '--inet']
+        args.extend(extra_options)
+        process = self.start_bzr_subprocess(args)
 
         # Connect to the server
         # We use this url because while this is no valid URL to connect to this
@@ -180,9 +184,10 @@
 
         process, transport = self.start_server_inet(['--allow-writes'])
 
-        # We get a working branch
+        # We get a working branch, and can create a directory
         branch = BzrDir.open_from_transport(transport).open_branch()
         self.make_read_requests(branch)
+        transport.mkdir('adir')
         self.assertInetServerShutsdownCleanly(process)
 
     def test_bzr_serve_port_readonly(self):
@@ -215,6 +220,21 @@
         self.make_read_requests(branch)
         self.assertServerFinishesCleanly(process)
 
+    def test_bzr_serve_dhpss(self):
+        # This is a smoke test that the server doesn't crash when run with
+        # -Dhpss, and does drop some hpss logging to the file.
+        self.make_branch('.')
+        log_fname = os.getcwd() + '/server.log'
+        self._captureVar('BZR_LOG', log_fname)
+        process, transport = self.start_server_inet(['-Dhpss'])
+        branch = BzrDir.open_from_transport(transport).open_branch()
+        self.make_read_requests(branch)
+        self.assertInetServerShutsdownCleanly(process)
+        f = open(log_fname, 'rb')
+        content = f.read()
+        f.close()
+        self.assertContainsRe(content, 'hpss request: \[')
+
 
 class TestCmdServeChrooting(TestBzrServeBase):
 



More information about the bazaar-commits mailing list