コード例 #1
0
ファイル: conftest.py プロジェクト: zcxowwww/pypy
 def pytest_runtest_setup(self, item):
     if not isinstance(item, py.test.collect.Function):
         return
     if not getattr(item.obj, 'dont_track_allocations', False):
         leakfinder.start_tracking_allocations()
     from rpython.rlib import rgil
     rgil._reset_emulated_gil_holder()
コード例 #2
0
ファイル: test_leakfinder.py プロジェクト: sbw111/lab4
def test_start_stop_nested():
    leakfinder.start_tracking_allocations()
    p2 = leakfinder.start_tracking_allocations()
    assert leakfinder.TRACK_ALLOCATIONS
    leakfinder.stop_tracking_allocations(True, prev=p2)
    assert leakfinder.TRACK_ALLOCATIONS
    leakfinder.stop_tracking_allocations(True)
    assert not leakfinder.TRACK_ALLOCATIONS
コード例 #3
0
ファイル: test_leakfinder.py プロジェクト: Darriall/pypy
def test_nested_remember_forget_1():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    p2 = leakfinder.start_tracking_allocations()
    leakfinder.stop_tracking_allocations(True, prev=p2)
    py.test.raises(leakfinder.MallocMismatch,
                   leakfinder.stop_tracking_allocations, True)
コード例 #4
0
ファイル: test_leakfinder.py プロジェクト: sbw111/lab4
def test_nested_remember_forget_1():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    p2 = leakfinder.start_tracking_allocations()
    leakfinder.stop_tracking_allocations(True, prev=p2)
    py.test.raises(leakfinder.MallocMismatch,
                   leakfinder.stop_tracking_allocations, True)
コード例 #5
0
ファイル: test_leakfinder.py プロジェクト: Darriall/pypy
def test_start_stop_nested():
    leakfinder.start_tracking_allocations()
    p2 = leakfinder.start_tracking_allocations()
    assert leakfinder.TRACK_ALLOCATIONS
    leakfinder.stop_tracking_allocations(True, prev=p2)
    assert leakfinder.TRACK_ALLOCATIONS
    leakfinder.stop_tracking_allocations(True)
    assert not leakfinder.TRACK_ALLOCATIONS
コード例 #6
0
ファイル: test_leakfinder.py プロジェクト: sbw111/lab4
def test_traceback():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    res = leakfinder.stop_tracking_allocations(check=False)
    assert res.keys() == [x]
    print res[x]
    assert isinstance(res[x], str)
    assert 'test_traceback' in res[x]
    assert 'leakfinder.remember_malloc(x)' in res[x]
コード例 #7
0
ファイル: test_leakfinder.py プロジェクト: Darriall/pypy
def test_traceback():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    res = leakfinder.stop_tracking_allocations(check=False)
    assert res.keys() == [x]
    print res[x]
    assert isinstance(res[x], str)
    assert 'test_traceback' in res[x]
    assert 'leakfinder.remember_malloc(x)' in res[x]
コード例 #8
0
ファイル: test_llinterp.py プロジェクト: GaussDing/pypy
def interpret(
    func,
    values,
    view="auto",
    viewbefore="auto",
    policy=None,
    type_system="lltype",
    backendopt=False,
    config=None,
    malloc_check=True,
    **kwargs
):
    interp, graph = get_interpreter(
        func, values, view, viewbefore, policy, type_system=type_system, backendopt=backendopt, config=config, **kwargs
    )
    if not malloc_check:
        result = interp.eval_graph(graph, values)
    else:
        prev = leakfinder.start_tracking_allocations()
        try:
            result = interp.eval_graph(graph, values)
        finally:
            leaks = leakfinder.stop_tracking_allocations(False, prev)
        if leaks:
            raise leakfinder.MallocMismatch(leaks)
    return result
コード例 #9
0
def interpret(func,
              values,
              view='auto',
              viewbefore='auto',
              policy=None,
              backendopt=False,
              config=None,
              malloc_check=True,
              **kwargs):
    interp, graph = get_interpreter(func,
                                    values,
                                    view,
                                    viewbefore,
                                    policy,
                                    backendopt=backendopt,
                                    config=config,
                                    **kwargs)
    if not malloc_check:
        result = interp.eval_graph(graph, values)
    else:
        prev = leakfinder.start_tracking_allocations()
        try:
            result = interp.eval_graph(graph, values)
        finally:
            leaks = leakfinder.stop_tracking_allocations(False, prev)
        if leaks:
            raise leakfinder.MallocMismatch(leaks)
    return result
コード例 #10
0
ファイル: test_leakfinder.py プロジェクト: sbw111/lab4
def test_start_stop():
    leakfinder.start_tracking_allocations()
    assert leakfinder.TRACK_ALLOCATIONS
    leakfinder.stop_tracking_allocations(True)
    assert not leakfinder.TRACK_ALLOCATIONS
コード例 #11
0
ファイル: conftest.py プロジェクト: soIu/rpython
 def pytest_runtest_setup(self, item):
     if not isinstance(item, py.test.collect.Function):
         return
     if not getattr(item.obj, 'dont_track_allocations', False):
         leakfinder.start_tracking_allocations()
コード例 #12
0
ファイル: test_leakfinder.py プロジェクト: sbw111/lab4
def test_remember_forget():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    py.test.raises(leakfinder.MallocMismatch,
                   leakfinder.stop_tracking_allocations, True)
コード例 #13
0
ファイル: test_leakfinder.py プロジェクト: sbw111/lab4
def test_remember_free():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    leakfinder.remember_free(x)
    leakfinder.stop_tracking_allocations(True)
コード例 #14
0
ファイル: test_leakfinder.py プロジェクト: Darriall/pypy
def test_remember_free():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    leakfinder.remember_free(x)
    leakfinder.stop_tracking_allocations(True)
コード例 #15
0
ファイル: test_leakfinder.py プロジェクト: Darriall/pypy
def test_remember_forget():
    leakfinder.start_tracking_allocations()
    x = 1234
    leakfinder.remember_malloc(x)
    py.test.raises(leakfinder.MallocMismatch,
                   leakfinder.stop_tracking_allocations, True)
コード例 #16
0
ファイル: conftest.py プロジェクト: abhinavthomas/pypy
 def pytest_runtest_setup(self, __multicall__, item):
     __multicall__.execute()
     if not isinstance(item, py.test.collect.Function):
         return
     if not getattr(item.obj, 'dont_track_allocations', False):
         leakfinder.start_tracking_allocations()
コード例 #17
0
ファイル: test_leakfinder.py プロジェクト: Darriall/pypy
def test_start_stop():
    leakfinder.start_tracking_allocations()
    assert leakfinder.TRACK_ALLOCATIONS
    leakfinder.stop_tracking_allocations(True)
    assert not leakfinder.TRACK_ALLOCATIONS