~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-06-20 14:25:06 UTC
  • mfrom: (2540 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070620142506-txsb1v8538kpsafw
merge bzr.dev @ 2540

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                env_changes=dict(BZR_SIGQUIT_PDB=None))
58
58
        # wait for it to get started, and print the 'listening' line
59
59
        proc.stdout.readline()
60
 
        # another hit gives the default behaviour of terminating it
61
 
        os.kill(proc.pid, signal.SIGQUIT)
62
 
        # wait for it to go into pdb
63
 
        time.sleep(.5)
64
 
        os.kill(proc.pid, signal.SIGQUIT)
65
 
        proc.wait()
 
60
        # break into the debugger
 
61
        os.kill(proc.pid, signal.SIGQUIT)
 
62
        # now send a second sigquit, which should cause it to exit.  That
 
63
        # won't happen until the original signal has been noticed by the
 
64
        # child and it's run its signal handler.  We don't know quite how long
 
65
        # this will take, but if it's more than 10s then it's probably not
 
66
        # going to work.
 
67
        for i in range(100):
 
68
            time.sleep(0.1)
 
69
            os.kill(proc.pid, signal.SIGQUIT)
 
70
            # note: waitpid is different on win32, but this test only runs on
 
71
            # unix
 
72
            r = os.waitpid(proc.pid, os.WNOHANG)
 
73
            if r != (0, 0):
 
74
                # high bit says if core was dumped; we don't care
 
75
                self.assertEquals(r[1] & 0x7f, signal.SIGQUIT)
 
76
                break
 
77
        else:
 
78
            self.fail("subprocess wasn't terminated by repeated SIGQUIT")
66
79
 
67
80
    def test_breakin_disabled(self):
68
81
        proc = self.start_bzr_subprocess(self._test_process_args,