Expand test
This commit is contained in:
parent
cd1fa4c4d8
commit
aa5b969961
1 changed files with 34 additions and 1 deletions
|
|
@ -82,8 +82,16 @@ def test_basic_jit_use():
|
||||||
errio = StringIO()
|
errio = StringIO()
|
||||||
print m
|
print m
|
||||||
|
|
||||||
# build pass manager
|
# verifier
|
||||||
|
action = api.VerifierFailureAction.ReturnStatusAction
|
||||||
|
|
||||||
|
corrupted = api.verifyFunction(fn, action)
|
||||||
|
assert not corrupted
|
||||||
|
corrupted = api.verifyModule(m, action, errio)
|
||||||
|
print corrupted
|
||||||
|
assert not corrupted, errio.getvalue()
|
||||||
|
|
||||||
|
# build pass manager
|
||||||
pmb = api.PassManagerBuilder.new()
|
pmb = api.PassManagerBuilder.new()
|
||||||
pmb.OptLevel = 3
|
pmb.OptLevel = 3
|
||||||
assert pmb.OptLevel == 3
|
assert pmb.OptLevel == 3
|
||||||
|
|
@ -156,6 +164,11 @@ def test_basic_jit_use():
|
||||||
m3.setModuleIdentifier(m.getModuleIdentifier())
|
m3.setModuleIdentifier(m.getModuleIdentifier())
|
||||||
assert str(m3) == str(m)
|
assert str(m3) == str(m)
|
||||||
|
|
||||||
|
# test clone
|
||||||
|
m4 = api.CloneModule(m)
|
||||||
|
assert m4 is not m
|
||||||
|
assert str(m4) == str(m)
|
||||||
|
|
||||||
def test_engine_builder():
|
def test_engine_builder():
|
||||||
api.InitializeNativeTarget()
|
api.InitializeNativeTarget()
|
||||||
context = api.getGlobalContext()
|
context = api.getGlobalContext()
|
||||||
|
|
@ -286,6 +299,26 @@ def test_globalvariable():
|
||||||
|
|
||||||
print m.list_globals()
|
print m.list_globals()
|
||||||
|
|
||||||
|
|
||||||
|
def test_sequentialtypes():
|
||||||
|
context = api.getGlobalContext()
|
||||||
|
int32ty = api.Type.getInt32Ty(context)
|
||||||
|
ary_int32x4 = api.ArrayType.get(int32ty, 4)
|
||||||
|
assert '[4 x i32]' == str(ary_int32x4)
|
||||||
|
ptr_int32 = api.PointerType.get(int32ty, 1)
|
||||||
|
assert 'i32 addrspace(1)*' == str(ptr_int32)
|
||||||
|
vec_int32x4 = api.VectorType.get(int32ty, 4)
|
||||||
|
assert '<4 x i32>' == str(vec_int32x4)
|
||||||
|
|
||||||
|
|
||||||
|
def test_constants():
|
||||||
|
context = api.getGlobalContext()
|
||||||
|
int32ty = api.Type.getInt32Ty(context)
|
||||||
|
ary_int32x4 = api.ArrayType.get(int32ty, 4)
|
||||||
|
intconst = api.ConstantInt.get(int32ty, 123)
|
||||||
|
aryconst = api.ConstantArray.get(ary_int32x4, [intconst] * 4)
|
||||||
|
assert str(aryconst.getAggregateElement(0)) == str(intconst)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
for name, value in globals().items():
|
for name, value in globals().items():
|
||||||
if name.startswith('test_') and callable(value):
|
if name.startswith('test_') and callable(value):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue