Commit e905a7af authored by John Zhang's avatar John Zhang

added some heap tests; modified framework to include heap initialisation for python test scripts

parent f650f6ae
Pipeline #203 failed with stage
in 25 minutes
This diff is collapsed.
......@@ -575,7 +575,7 @@ def test_threadtran_fib():
"result_type": i64
}
fnp, (mu, ctx, bldr) = fncptr_from_py_script(build_test_bundle, 'fib', [ctypes.c_longlong])
fnp, (mu, ctx, bldr) = fncptr_from_py_script(build_test_bundle, None, 'fib', [ctypes.c_longlong])
mu.current_thread_as_mu_thread(rmu.null(rmu.MuCPtr))
......@@ -646,7 +646,7 @@ def test_new():
"@i64": i64
}
fnp, (mu, ctx, bldr) = fncptr_from_py_script(build_test_bundle, 'test_fnc')
fnp, (mu, ctx, bldr) = fncptr_from_py_script(build_test_bundle, None, 'test_fnc')
mu.current_thread_as_mu_thread(rmu.null(rmu.MuCPtr))
assert fnp() == 1
......@@ -712,7 +712,7 @@ def test_new_cmpeq():
"@i64": i64
}
fnp, (mu, ctx, bldr) = fncptr_from_py_script(build_test_bundle, 'test_fnc')
fnp, (mu, ctx, bldr) = fncptr_from_py_script(build_test_bundle, None, 'test_fnc')
mu.current_thread_as_mu_thread(rmu.null(rmu.MuCPtr))
assert fnp() == 0
......
......@@ -66,7 +66,7 @@ def fncptr_from_c_script(c_src_name, name, argtypes=[], restype=ctypes.c_ulonglo
return fncptr_from_lib(lib, name, argtypes, restype), lib
def fncptr_from_py_script(py_fnc, name, argtypes=[], restype=ctypes.c_longlong):
def fncptr_from_py_script(py_fnc, heapinit_fnc, name, argtypes=[], restype=ctypes.c_longlong):
import os
# NOTE: requires mu-client-pypy
from rpython.rlib import rmu_fast as rmu
......@@ -82,6 +82,8 @@ def fncptr_from_py_script(py_fnc, name, argtypes=[], restype=ctypes.c_longlong):
id_dict = py_fnc(bldr, rmu)
bldr.load()
if heapinit_fnc:
heapinit_fnc(ctx, id_dict, rmu)
libpath = py.path.local('lib%(name)s.dylib' % locals())
mu.compile_to_sharedlib(libpath.strpath, [])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment