From 984bfece2d5070ce92480c60261b25953034f6c7 Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Sat, 22 Sep 2012 22:18:39 -0500 Subject: [PATCH] add native asm test --- llvm/test_llvmpy.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/llvm/test_llvmpy.py b/llvm/test_llvmpy.py index 79b1239..8719f8b 100644 --- a/llvm/test_llvmpy.py +++ b/llvm/test_llvmpy.py @@ -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):