コード例 #1
0
ファイル: test_remote.py プロジェクト: crashvb/python-hunter
def test_gdb():
    with process_tests.TestProcess(sys.executable, '-mtarget', 'manhole') as target, \
         process_tests.dump_on_error(target.read):
            with process_tests.TestProcess('hunter-trace', '-p', str(target.proc.pid),
                                           '--gdb', 'stdlib=False') as tracer,\
                 process_tests.dump_on_error(tracer.read):

                process_tests.wait_for_strings(
                    tracer.read, TIMEOUT,
                    'WARNING: Using GDB may deadlock the process or create unpredictable results!',
                    'Output stream active. Starting tracer',
                    'call      => stuff()',
                    'line         time.sleep(1)',
                    'return    <= stuff: None',
                )
            process_tests.wait_for_strings(target.read, TIMEOUT, 'Broken pipe. Stopping tracer.')
コード例 #2
0
ファイル: test_remote.py プロジェクト: crashvb/python-hunter
def test_manhole():
    with process_tests.TestProcess(sys.executable, '-mtarget', 'manhole') as target, \
         process_tests.dump_on_error(target.read):

            process_tests.wait_for_strings(target.read, TIMEOUT, 'Oneshot activation is done by signal')

            with process_tests.TestProcess('hunter-trace', '-p', str(target.proc.pid), 'stdlib=False') as tracer,\
                 process_tests.dump_on_error(tracer.read):

                process_tests.wait_for_strings(
                    tracer.read, TIMEOUT,
                    'Output stream active. Starting tracer',
                    'call      => stuff()',
                    'line         time.sleep(1)',
                    'return    <= stuff: None',
                )
            process_tests.wait_for_strings(target.read, TIMEOUT, 'Broken pipe. Stopping tracer.')
コード例 #3
0
ファイル: test_remote.py プロジェクト: crashvb/python-hunter
def test_manhole_clean_exit():
    with process_tests.TestProcess(sys.executable, '-mtarget', 'manhole') as target, \
         process_tests.dump_on_error(target.read):

            process_tests.wait_for_strings(target.read, TIMEOUT, 'Oneshot activation is done by signal')

            with process_tests.TestProcess('hunter-trace', '-p', str(target.proc.pid), 'stdlib=False') as tracer,\
                 process_tests.dump_on_error(tracer.read):

                process_tests.wait_for_strings(
                    tracer.read, TIMEOUT,
                    'Output stream active. Starting tracer',
                    'call      => stuff()',
                    'line         time.sleep(1)',
                    'return    <= stuff: None',
                )
                target.reset()
                tracer.proc.send_signal(signal.SIGINT)
            process_tests.wait_for_strings(target.read, TIMEOUT,
                                           'remote.deactivate()',
                                           'Doing stuff',
                                           'Doing stuff',
                                           'Doing stuff')