summaryrefslogtreecommitdiffstats
path: root/llvm/bindings/python/tests
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-03-09 09:07:35 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-03-09 09:07:35 +0000
commitc04bbd27afa27846e3b981fe48099c2b8aab7efc (patch)
tree24f69a1f015c4c664d5812157ec731ac062f667d /llvm/bindings/python/tests
parent5023188315e2cf5091c74cf0d3eec6d358337152 (diff)
downloadbcm5719-llvm-c04bbd27afa27846e3b981fe48099c2b8aab7efc.tar.gz
bcm5719-llvm-c04bbd27afa27846e3b981fe48099c2b8aab7efc.zip
[llvm.py] Initial skeleton for Python LLVM bindings
This contains a semi-functional skeleton for the implementation of the LLVM bindings for Python. The API for the Object.h interface is roughly designed but not implemented. MemoryBufferRef is implemented and actually appears to work! The ObjectFile unit test fails with a segmentation fault because the LLVM library isn't being properly initialized. The build system doesn't know about this code yet, so no alerts should fire. llvm-svn: 152397
Diffstat (limited to 'llvm/bindings/python/tests')
-rw-r--r--llvm/bindings/python/tests/test_core.py11
-rw-r--r--llvm/bindings/python/tests/test_object.py9
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/bindings/python/tests/test_core.py b/llvm/bindings/python/tests/test_core.py
new file mode 100644
index 00000000000..8c4e9337053
--- /dev/null
+++ b/llvm/bindings/python/tests/test_core.py
@@ -0,0 +1,11 @@
+from llvm.common import find_library
+from llvm.core import MemoryBuffer
+
+import unittest
+
+class TestCore(unittest.TestCase):
+ def test_memory_buffer_create_from_file(self):
+ source = find_library()
+ self.assertIsNotNone(source)
+
+ mb = MemoryBuffer(filename=source)
diff --git a/llvm/bindings/python/tests/test_object.py b/llvm/bindings/python/tests/test_object.py
new file mode 100644
index 00000000000..afb02019672
--- /dev/null
+++ b/llvm/bindings/python/tests/test_object.py
@@ -0,0 +1,9 @@
+from llvm.common import find_library
+from llvm.object import ObjectFile
+
+import unittest
+
+class TestObjectFile(unittest.TestCase):
+ def test_create_from_file(self):
+ source = find_library()
+ of = ObjectFile(filename=source)
OpenPOWER on IntegriCloud