~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_debug.py

  • Committer: Martin Pool
  • Date: 2007-04-24 04:51:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2450.
  • Revision ID: mbp@sourcefrog.net-20070424045131-gyjo7l8oa99ndyrv
Add BZR_SIGQUIT_PDB=0 option to disable breakin.

Split tests for this into test_breakin, and make them a bit more robust.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        # here but it may be missing if the source is not in sync with the
35
35
        # pyc file.
36
36
        self.assertContainsRe(err, "Traceback \\(most recent call last\\)")
37
 
 
38
 
class TestBreakin(TestCase):
39
 
 
40
 
    def test_breakin(self):
41
 
        # Break in to a debugger while bzr is running
42
 
        # we need to test against a command that will wait for 
43
 
        # a while -- bzr serve should do
44
 
        #
45
 
        # this may not work on windows but i don't think this use of signals
46
 
        # will work there
47
 
        if sys.platform == 'win32':
48
 
            raise TestSkipped('breakin signal not tested on win32')
49
 
        proc = self.start_bzr_subprocess(['serve'])
50
 
        # wait for it to get started
51
 
        time.sleep(.5)
52
 
        # first sigquit pops into debugger
53
 
        os.kill(proc.pid, signal.SIGQUIT)
54
 
        proc.stdin.write("q\n")
55
 
        time.sleep(.5)
56
 
        err = proc.stderr.readline()
57
 
        self.assertContainsRe(err, r'entering debugger')
58
 
 
59
 
    def test_breakin_harder(self):
60
 
        if sys.platform == 'win32':
61
 
            raise TestSkipped('breakin signal not tested on win32')
62
 
        proc = self.start_bzr_subprocess(['serve'])
63
 
        # wait for it to get started
64
 
        time.sleep(.5)
65
 
        # another hit gives the default behaviour of terminating it
66
 
        os.kill(proc.pid, signal.SIGQUIT)
67
 
        # wait for it to go into pdb
68
 
        time.sleep(.5)
69
 
        os.kill(proc.pid, signal.SIGQUIT)
70
 
        proc.wait()