Example #1
0
    def no__test_next_same_level(self):
        return

        # See that we can next with parameter which is the same as 'next 1'
        cmds = ['next', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        x = 5
        y = 6
        d.core.stop()
        out = ['-- x = 5',
               '-- y = 6']
        compare_output(self, out, d, cmds)

        # See that we can next with a computed count value
        cmds = ['next 5-3', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        x = 5  # NOQA
        y = 6  # NOQA
        z = 7  # NOQA
        d.core.stop(options={'remove': True})
        out = ['-- x = 5',
               '-- z = 7']
        compare_output(self, out, d, cmds)
        return
Example #2
0
    def test_break_on_function(self):

        return
        ##############################
        # We had a bug where 'next' (no number) after
        # a hit breakpoint wouldn't 'next'. So test for that
        # in addition to the break on a function name.
        cmds = ['break foo', 'continue', 'next', 'continue']
        d = strarray_setup(cmds)
        d.core.start()

        ##############################

        def foo():
            print('foo here')
            return

        foo()
        y = 6  # NOQA
        ##############################
        d.core.stop()

        out = ['-- foo()', 'xx def foo():', "-- print('foo here')"]
        compare_output(self, out, d, cmds)

        return
Example #3
0
    def no__test_next_in_exception(self):
        return

        def boom(x):
            y = 0/x  # NOQA
            return

        def buggy_fact(x):
            if x <= 1: return boom(0)
            return buggy_fact(x-1)
        cmds = ['next', 'continue']
        d = strarray_setup(cmds)
        try:
            d.core.start()
            x = buggy_fact(4)  # NOQA
            y = 5  # NOQA
            self.assertTrue(False, 'should have raised an exception')
        except ZeroDivisionError:
            self.assertTrue(True, 'Got the exception')
            pass
        d.core.stop(options={'remove': True})

        out = ['-- x = buggy_fact(4)',
               '!! x = buggy_fact(4)']
        compare_output(self, out, d, cmds)
        return
Example #4
0
    def test_jump(self):
        # FIXME
        return

        if sys.version_info[0] == 2 and sys.version_info[1] <= 4:
            print("skipping jump test on Python 2.4")

        # See that we can jump with line number
        curframe = inspect.currentframe()
        cmds = ['step', 'jump %d' % (curframe.f_lineno + 8), 'continue']  # 1
        d = strarray_setup(cmds)  # 2
        d.core.start()  # 3
        ##############################          # 4...
        x = 5
        x = 6
        x = 7
        z = 8  # NOQA
        ##############################
        d.core.stop(options={'remove': True})
        out = [
            '-- x = 5',  # x = 10 is shown in prompt, but not run.
            '-- x = 6',
            '-- z = 8'
        ]
        compare_output(self, out, d, cmds)
        self.assertEqual(5, x)  # Make sure x = 6, 7 were skipped.
        return
Example #5
0
    def NO__test_step_between_fn(self):
        return

        # Step into and out of a function
        def sqr(x):
            return x * x
        for cmds, out, eventset in (
            (['step', 'step', 'continue'],
             ['-- x = sqr(4)',
              '-- return x * x',
              '-- y = 5'],
             frozenset(('line',))),
            (['step', 'step', 'step', 'step', 'continue'],
             ['-- x = sqr(4)',
               '-> def sqr(x):',
               '-- return x * x',
               '<- return x * x',
               '-- y = 5'],
             tracer.ALL_EVENTS),
            ):
            d = strarray_setup(cmds)
            d.settings['events'] = eventset
            d.core.start()
            ##############################
            x = sqr(4)
            y = 5
            ##############################
            d.core.stop(options={'remove': True})
            compare_output(self, out, d, cmds)
            pass
        return
Example #6
0
    def NO__test_step_in_exception(self):
        return
        def boom(x):
            y = 0/x
            return
        def bad(x):
            boom(x)
            return x * x
        cmds = ['step', 'step', 'step', 'step', 'step', 'step',
                'step', 'step', 'step', 'step', 'continue']
        d = strarray_setup(cmds)
        try: 
            d.core.start()
            x = bad(0)
            self.assertTrue(False, 'should have raised an exception')
        except ZeroDivisionError:
            self.assertTrue(True, 'Got the exception')
        finally:
            d.core.stop(options={'remove': True})
            pass

        out = ['-- x = bad(0)',  # line event
               '-> def bad(x):', # call event
               '-- boom(x)',     # line event
               '-> def boom(x):',# call event
               '-- y = 0/x',     # line event
               '!! y = 0/x',     # exception event
               '<- y = 0/x',     # return event
               '!! boom(x)',     # exception event
               '<- boom(x)',     # return event
               '!! x = bad(0)',  # return event
               '-- except ZeroDivisionError:']
        compare_output(self, out, d, cmds)
        return
Example #7
0
    def test_step_between_fn(self):

        # Step into and out of a function
        def sqr(x):
            return x * x

        for cmds, out, eventset in (
            (['step', 'step', 'continue'],
             ['-- x = sqr(4)   # NOQA', '-- return x * x',
              '-- y = 5  # NOQA'], frozenset(('line', ))),
            (['step', 'step', 'step', 'step', 'continue'], [
                '-- d.core.start()', '-- x = sqr(4)   # NOQA',
                '-> def sqr(x):', '-- return x * x', '<- return x * x'
            ], tracer.ALL_EVENTS),
        ):
            d = strarray_setup(cmds)
            d.settings['events'] = eventset
            d.core.start()
            ##############################
            x = sqr(4)  # NOQA
            y = 5  # NOQA
            ##############################
            d.core.stop(options={'remove': True})
            compare_output(self, out, d, cmds)
            pass
        return
Example #8
0
    def test_break_on_function(self):

        return
        ##############################
        # We had a bug where 'next' (no number) after
        # a hit breakpoint wouldn't 'next'. So test for that
        # in addition to the break on a function name.
        cmds = ['break foo', 'continue', 'next', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################

        def foo():
            print('foo here')
            return
        foo()
        y = 6  # NOQA
        ##############################
        d.core.stop()

        out = ['-- foo()',
               'xx def foo():',
               "-- print('foo here')"]
        compare_output(self, out, d, cmds)

        return
Example #9
0
    def test_next_in_exception(self):
        return

        def boom(x):
            y = 0 / x  # NOQA
            return

        def buggy_fact(x):
            if x <= 1: return boom(0)
            return buggy_fact(x - 1)

        cmds = ['next', 'continue']
        d = strarray_setup(cmds)
        try:
            d.core.start()
            x = buggy_fact(4)  # NOQA
            y = 5  # NOQA
            self.assertTrue(False, 'should have raised an exception')
        except ZeroDivisionError:
            self.assertTrue(True, 'Got the exception')
            pass
        d.core.stop(options={'remove': True})

        out = ['-- x = buggy_fact(4)  # NOQA', '!! x = buggy_fact(4)  # NOQA']
        compare_output(self, out, d, cmds)
        return
Example #10
0
 def test_break_on_os_function(self):
     # Try a break with a module.function name
     return
     import os
     cmds = ['break os.path.join', 'continue']
     d = strarray_setup(cmds)
     d.core.start()
     p = os.path.join("a", "b")  # NOQA
     ##############################
     d.core.stop()
     out = ['-- p = os.path.join("a", "b")', 'xx def join(a, *p):']
     compare_output(self, out, d, cmds)
     return
Example #11
0
    def test_break_on_function(self):
        print("test ", __file__, "break_on_function skipped")
        return

        ##############################
        # We had a bug where 'next' (no number) after
        # a hit breakpoint wouldn't 'next'. So test for that
        # in addition to the break on a function name.
        cmds = ['break foo', 'continue', 'next', 'continue']
        d = strarray_setup(cmds)
        d.core.start()

        ##############################

        def foo():
            print('foo here')
            return

        foo()
        y = 6  # NOQA
        ##############################
        d.core.stop()

        out = [
            'xx def foo():\n(test-break.py:18): foo', "-- print 'foo here'\n"
        ]
        compare_output(self, out, d, cmds)

        # Try a break with a module name
        import os
        cmds = ['break os.path.join', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        p = os.path.join("a", "b")  # NOQA
        ##############################
        d.core.stop()
        out = ['-- p = os.path.join("a", "b")', 'xx def join(a, *p):']
        compare_output(self, out, d, cmds)
        return
Example #12
0
    def test_skip(self):

        # See that we can skip without parameter. (Same as 'skip 1'.)
        cmds = ['skip', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 4
        x = 5
        y = 7  # NOQA
        ##############################
        d.core.stop()
        out = [
            '-- x = 4',  # x = 4 is shown in prompt, but not *run*.
            '-- x = 5'
        ]
        compare_output(self, out, d, cmds)
        self.assertEqual(5, x)  # Make sure lines were skipped.

        # See that we can skip with a count value
        print("skipping second skip test")
        return
        cmds = ['skip 2', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 10
        x = 9
        z = 7  # NOQA
        ##############################
        d.core.stop(options={'remove': True})
        out = [
            '-- x = 10',  # x = 10 is shown in prompt, but not run.
            '-- z = 7'
        ]
        compare_output(self, out, d, cmds)
        self.assertEqual(5, x)  # Make sure x = 10, 9 were skipped.
        return
Example #13
0
    def test_next_same_level(self):

        # See that we can next with parameter which is the same as 'next 1'
        cmds = ['next', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        x = 5
        y = 6
        d.core.stop()
        out = ['-- x = 5', '-- y = 6']
        compare_output(self, out, d, cmds)

        # See that we can next with a computed count value
        cmds = ['next 5-3', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        x = 5  # NOQA
        y = 6  # NOQA
        z = 7  # NOQA
        d.core.stop(options={'remove': True})
        out = ['-- x = 5  # NOQA', '-- z = 7  # NOQA']
        compare_output(self, out, d, cmds)
        return
Example #14
0
 def test_break_on_os_function(self):
     # Try a break with a module.function name
     return
     import os
     cmds = ['break os.path.join', 'continue']
     d = strarray_setup(cmds)
     d.core.start()
     p = os.path.join("a", "b")  # NOQA
     ##############################
     d.core.stop()
     out = ['-- p = os.path.join("a", "b")',
            'xx def join(a, *p):']
     compare_output(self, out, d, cmds)
     return
Example #15
0
    def test_break_on_function(self):
        print("test ", __file__, "break_on_function skipped")
        return

        ##############################
        # We had a bug where 'next' (no number) after
        # a hit breakpoint wouldn't 'next'. So test for that
        # in addition to the break on a function name.
        cmds = ['break foo', 'continue', 'next', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################

        def foo():
            print('foo here')
            return
        foo()
        y = 6  # NOQA
        ##############################
        d.core.stop()

        out = ['xx def foo():\n(test-break.py:18): foo',
               "-- print 'foo here'\n"]
        compare_output(self, out, d, cmds)

        # Try a break with a module name
        import os
        cmds = ['break os.path.join', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        p = os.path.join("a", "b")  # NOQA
        ##############################
        d.core.stop()
        out = ['-- p = os.path.join("a", "b")',
               'xx def join(a, *p):']
        compare_output(self, out, d, cmds)
        return
Example #16
0
 def test_next_between_fn(self):
     # Next over a function
     def fact(x):
         if x <= 1: return 1
         return fact(x-1)
     cmds = ['next', 'continue']
     d = strarray_setup(cmds)
     d.core.start()
     x = fact(4)  # NOQA
     y = 5  # NOQA
     d.core.stop(options={'remove': True})
     out = ['-- x = fact(4)  # NOQA',
            '-- y = 5  # NOQA']
     compare_output(self, out, d, cmds)
     return
Example #17
0
    def test_next_between_fn(self):
        # Next over a function
        def fact(x):
            if x <= 1: return 1
            return fact(x - 1)

        cmds = ['next', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        x = fact(4)  # NOQA
        y = 5  # NOQA
        d.core.stop(options={'remove': True})
        out = ['-- x = fact(4)  # NOQA', '-- y = 5  # NOQA']
        compare_output(self, out, d, cmds)
        return
Example #18
0
    def test_step_same_level(self):
        return

        # See that we can step with parameter which is the same as 'step 1'
        cmds = ['step', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5  # NOQA
        y = 6  # NOQA
        ##############################
        d.core.stop()
        out = ['-- x = 5', '-- y = 6\n']
        compare_output(self, out, d, cmds)
        return
Example #19
0
    def test_skip(self):
        # FIXME
        return

        # See that we can skip without parameter. (Same as 'skip 1'.)
        cmds = ['skip', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 4
        x = 5
        y = 7  # NOQA
        ##############################
        d.core.stop()
        out = ['-- x = 4',   # x = 4 is shown in prompt, but not *run*.
               '-- x = 5']
        compare_output(self, out, d, cmds)
        self.assertEqual(5, x)  # Make sure lines were skipped.

        # See that we can skip with a count value
        print("skipping second skip test")
        return
        cmds = ['skip 2', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 10
        x = 9
        z = 7  # NOQA
        ##############################
        d.core.stop(options={'remove': True})
        out = ['-- x = 10',   # x = 10 is shown in prompt, but not run.
               '-- z = 7']
        compare_output(self, out, d, cmds)
        self.assertEqual(5, x)  # Make sure x = 10, 9 were skipped.
        return
Example #20
0
 def test_break_at_line_number(self):
     import inspect
     curframe = inspect.currentframe()
     cmds = ['break %d' % (curframe.f_lineno + 7), 'continue', 'c']  # 1
     d = strarray_setup(cmds)  # 2
     d.core.start()  # 3
     ##############################        # 4...
     x = 5  # NOQA
     y = 6  # NOQA
     z = 7  # NOQA
     ##############################
     d.core.stop()
     out = ["-- x = 5  # NOQA", 'xx z = 7  # NOQA']
     compare_output(self, out, d, cmds)
     return
Example #21
0
    def test_step_same_level(self):
        return

        # See that we can step with parameter which is the same as 'step 1'
        cmds = ['step', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5
        y = 6
        ##############################
        d.core.stop()
        out = ['-- x = 5',
               '-- y = 6\n']
        compare_output(self, out, d, cmds)
        return
 def test_break_at_line_number(self):
     import inspect
     curframe = inspect.currentframe()
     cmds = ['break %d' % (curframe.f_lineno+7),
             'continue', 'c']              # 1
     d = strarray_setup(cmds)              # 2
     d.core.start()                        # 3
     ##############################        # 4...
     x = 5  # NOQA
     y = 6  # NOQA
     z = 7  # NOQA
     ##############################
     d.core.stop()
     out = ["-- x = 5  # NOQA",
            'xx z = 7  # NOQA']
     compare_output(self, out, d, cmds)
     return
Example #23
0
 def test_break_at_line_number(self):
     print("test", __file__, "break_at_line_number skipped")
     return
     import inspect
     curframe = inspect.currentframe()
     cmds = ['break %d' % (curframe.f_lineno+7),
             'continue', 'c']              # 1
     d = strarray_setup(cmds)              # 2
     d.core.start()                        # 3
     ##############################        # 4...
     x = 5  # NOQA
     y = 6  # NOQA
     z = 7  # NOQA
     ##############################
     d.core.stop()
     out = ["-- x = 5\nBreakpoint 1 set at line 53 of file test-break.py",
            'xx z = 7\n']
     compare_output(self, out, d, cmds)
     return
Example #24
0
 def test_break_at_line_number(self):
     print("test", __file__, "break_at_line_number skipped")
     return
     import inspect
     curframe = inspect.currentframe()
     cmds = ['break %d' % (curframe.f_lineno + 7), 'continue', 'c']  # 1
     d = strarray_setup(cmds)  # 2
     d.core.start()  # 3
     ##############################        # 4...
     x = 5  # NOQA
     y = 6  # NOQA
     z = 7  # NOQA
     ##############################
     d.core.stop()
     out = [
         "-- x = 5\nBreakpoint 1 set at line 53 of file test-break.py",
         'xx z = 7\n'
     ]
     compare_output(self, out, d, cmds)
     return
Example #25
0
    def test_step_in_exception(self):
        return

        def boom(x):
            y = 0 / x  # NOQA
            return

        def bad(x):
            boom(x)
            return x * x

        cmds = [
            'step', 'step', 'step', 'step', 'step', 'step', 'step', 'step',
            'step', 'step', 'continue'
        ]
        d = strarray_setup(cmds)
        try:
            d.core.start()
            x = bad(0)
            self.assertTrue(False, 'should have raised an exception')
        except ZeroDivisionError:
            self.assertTrue(True, 'Got the exception')
        finally:
            d.core.stop(options={'remove': True})
            pass

        out = [
            '-- x = bad(0)  # NOQA',  # line event
            '-> def bad(x):',  # call event
            '-- boom(x)',  # line event
            '-> def boom(x):',  # call event
            '-- y = 0/x  # NOQA',  # line event
            '!! y = 0/x  # NOQA',  # exception event
            '<- y = 0/x  # NOQA',  # return event
            '!! boom(x)',  # exception event
            '<- boom(x)',  # return event
            '!! x = bad(0)  # NOQA',  # exception event
            '-- except ZeroDivisionError:'
        ]
        compare_output(self, out, d, cmds)
        return
Example #26
0
    def test_jump(self):
        # FIXME
        return

        if sys.version_info[0] == 2 and sys.version_info[1] <= 4:
            print("skipping jump test on Python 2.4")

        # See that we can jump with line number
        curframe = inspect.currentframe()
        cmds = ["step", "jump %d" % (curframe.f_lineno + 8), "continue"]  # 1
        d = strarray_setup(cmds)  # 2
        d.core.start()  # 3
        ##############################          # 4...
        x = 5
        x = 6
        x = 7
        z = 8  # NOQA
        ##############################
        d.core.stop(options={"remove": True})
        out = ["-- x = 5", "-- x = 6", "-- z = 8"]  # x = 10 is shown in prompt, but not run.
        compare_output(self, out, d, cmds)
        self.assertEqual(5, x)  # Make sure x = 6, 7 were skipped.
        return
    def test_finish_same_level(self):
        print("test ", __file__, "finish_same_level skipped")
        return

        cmds = ['step 5', 'finish', 'continue']
        d = strarray_setup(cmds)
        d.core.start()

        def bar():
            x = 3  # NOQA
            return 1

        def foo():
            bar()
            x = 2  # NOQA
            return 5
        foo()
        d.core.stop()
        out = ['-- def foo():',
               '-- x = 3',
               '<- return 1',
               '<- return 5',  # FIXME this isn't right
               ]
        compare_output(self, out, d, cmds)
Example #28
0
    def test_finish_same_level(self):
        print("test ", __file__, "finish_same_level skipped")
        return

        cmds = ['step 5', 'finish', 'continue']
        d = strarray_setup(cmds)
        d.core.start()

        def bar():
            x = 3  # NOQA
            return 1

        def foo():
            bar()
            x = 2  # NOQA
            return 5
        foo()
        d.core.stop()
        out = ['-- def foo():',
               '-- x = 3',
               '<- return 1',
               '<- return 5',  # FIXME this isn't right
               ]
        compare_output(self, out, d, cmds)
Example #29
0
    def test_step_computed_valued(self):
        # See that we can step with a computed count value
        cmds = ['step 5-3', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5
        y = 6
        z = 7
        ##############################
        d.core.stop(options={'remove': True})
        out = ['-- x = 5', '-- z = 7']
        compare_output(self, out, d, cmds)

        # Test step>
        cmds = ['step>', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5

        def foo():
            return

        y = 6  # NOQA
        foo()
        ##############################
        d.core.stop(options={'remove': True})
        out = ['-- x = 5', '-> def foo():']
        compare_output(self, out, d, cmds)

        # # Test step!
        # cmds = ['step!', 'continue']
        # d = strarray_setup(cmds)
        # d.core.start()
        # ##############################
        # x = 5
        # try:
        #     y = 2
        #     z = 1/0
        # except:
        #     pass
        # ##############################
        # d.core.stop(options={'remove': True})
        # out = ['-- x = 5',
        #        '!! z = 1/0\n']
        # compare_output(self, out, d, cmds)

        # Test "step" with sets of events. Part 1
        cmds = ['step call exception', 'step call exception', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5  # NOQA
        try:

            def foo1():
                y = 2  # NOQA
                raise Exception
                return

            foo1()
        except:
            pass
        z = 1  # NOQA
        # ##############################
        # d.core.stop(options={'remove': True})
        # out = ['-- x = 5',
        #        '-> def foo1():',
        #        '!! raise Exception']
        # compare_output(self, out, d, cmds)

        # # Test "step" will sets of events. Part 2
        # cmds = ['step call exception 1+0',
        #         'step call exception 1', 'continue']
        # d = strarray_setup(cmds)
        # d.core.start()
        # ##############################
        # x = 5
        # try:
        #     def foo2():
        #         y = 2
        #         raise Exception
        #         return
        #     foo2()
        # except:
        #     pass
        # z = 1
        # ##############################
        # d.core.stop(options={'remove': True})
        # out = ['-- x = 5',
        #        '-> def foo2():',
        #        '!! raise Exception']
        # compare_output(self, out, d, cmds)

        return
Example #30
0
    def NO__test_step_computed_valued(self):
        return
        # See that we can step with a computed count value
        cmds = ['step 5-3', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5
        y = 6
        z = 7
        ##############################
        d.core.stop(options={'remove': True})
        out = ['-- x = 5',
               '-- z = 7\n']
        compare_output(self, out, d, cmds)

        # Test step>
        cmds = ['step>', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5
        def foo():
            return
        y = 6
        foo()
        ##############################
        d.core.stop(options={'remove': True})
        out = ['-- x = 5',
               '-> def foo():\n']
        compare_output(self, out, d, cmds)

        # # Test step!
        # cmds = ['step!', 'continue']
        # d = strarray_setup(cmds)
        # d.core.start()
        # ##############################
        # x = 5
        # try:
        #     y = 2
        #     z = 1/0
        # except:
        #     pass
        # ##############################
        # d.core.stop(options={'remove': True})
        # out = ['-- x = 5',
        #        '!! z = 1/0\n']
        # compare_output(self, out, d, cmds)

        # Test "step" with sets of events. Part 1
        cmds = ['step call exception',
                'step call exception', 'continue']
        d = strarray_setup(cmds)
        d.core.start()
        ##############################
        x = 5
        try:
            def foo1():
                y = 2
                raise Exception
                return
            foo1()
        except:
            pass
        z = 1
        # ##############################
        # d.core.stop(options={'remove': True})
        # out = ['-- x = 5',
        #        '-> def foo1():',
        #        '!! raise Exception']
        # compare_output(self, out, d, cmds)

        # # Test "step" will sets of events. Part 2
        # cmds = ['step call exception 1+0',
        #         'step call exception 1', 'continue']
        # d = strarray_setup(cmds)
        # d.core.start()
        # ##############################
        # x = 5
        # try:
        #     def foo2():
        #         y = 2
        #         raise Exception
        #         return
        #     foo2()
        # except:
        #     pass
        # z = 1
        # ##############################
        # d.core.stop(options={'remove': True})
        # out = ['-- x = 5',
        #        '-> def foo2():',
        #        '!! raise Exception']
        # compare_output(self, out, d, cmds)

        return
Example #31
0
    def test_handle(self):

        # FIXME!
        self.assertTrue(True)
        return

        # See that we handle a USR1 signal with a 'stop' action
        cmds = ['handle usr1 stop nopass', 'continue', 'where', 'continue']
        d = strarray_setup(cmds)

        def signal_handler(num, f):
            print('signal %d received' % num)
            return

        signal.signal(signal.SIGUSR1, signal_handler)
        d.core.start()
        ##############################
        x = 5
        os.kill(os.getpid(), signal.SIGUSR1)
        y = 6                                 # +1
        ##############################        # +2
        d.core.stop()                         # +3
        kill_line = get_lineno() - 4          # +4
        out = ['-- x = 5',
               ('''?! os.kill(os.getpid(), signal.SIGUSR1)
     called from file 'test-sig.py' at line %d''' %
                kill_line)]
        compare_output(self, out, d, cmds)

        # Now define a signal handler and see that this is skill okay
        # "ignore" is the same as "nopass"
        # FIXME: add this common code to the helper.
        cmds = ['handle usr1 stop ignore', 'continue', 'where', 'continue']
        d.intf[-1].output.output = ['']
        d.core.step_ignore = 0
        d.intf[-1].input.input = cmds

        def signal_handler2(num, f):
            print('signal %d received' % num)
            return
        signal.signal(signal.SIGUSR1, signal_handler2)

        d.core.start()
        ##############################
        x = 7
        os.kill(os.getpid(), signal.SIGUSR1)
        y = 8                                 # +1
        ##############################        # +2
        d.core.stop()                         # +3
        kill_line = get_lineno() - 4          # +4
        out = ['-- x = 7',
               ('''?! os.kill(os.getpid(), signal.SIGUSR1)
     called from file 'test-sig.py' at line %d''' %
                kill_line)]
        compare_output(self, out, d, cmds)

        # How about USR2 signal with 'ignore' and 'noprint' actions?
        cmds = ['handle usr2 ignore nostop noprint',
                'continue', 'info signal usr2', 'continue']
        d.intf[-1].output.output = ['']
        d.core.step_ignore = 0
        d.intf[-1].input.input = cmds

        def signal_handler3(num, f):
            print('signal %d received' % num)
            return
        signal.signal(signal.SIGUSR2, signal_handler2)

        d.core.start()
        ##############################
        x = 9  # NOQA
        os.kill(os.getpid(), signal.SIGUSR2)
        y = 10  # NOQA
        ##############################
        d.core.stop()
        out = ['-- x = 9']
        compare_output(self, out, d, cmds)

        return