add native asm test

This commit is contained in:
Ilan Schnell 2012-09-22 22:18:39 -05:00
commit 984bfece2d

View file

@ -635,6 +635,29 @@ tests.append(TestNative)
# ---------------------------------------------------------------------------
class TestNativeAsm(unittest.TestCase):
def test_asm(self):
m = Module.new('module1')
foo = m.add_function(Type.function(Type.int(),
[Type.int(), Type.int()]),
name="foo")
bldr = Builder.new(foo.append_basic_block('entry'))
x = bldr.add(foo.args[0], foo.args[1])
bldr.ret(x)
att_syntax = m.to_native_assembly()
os.environ["LLVMPY_OPTIONS"] = "-x86-asm-syntax=intel"
lc.parse_environment_options(sys.argv[0], "LLVMPY_OPTIONS")
intel_syntax = m.to_native_assembly()
self.assertNotEqual(att_syntax, intel_syntax)
tests.append(TestNativeAsm)
# ---------------------------------------------------------------------------
class TestUses(unittest.TestCase):
def test_uses(self):