aboutsummaryrefslogtreecommitdiff
path: root/bindings/python/llvm/tests/base.py
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-03-10 04:41:24 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-03-10 04:41:24 +0000
commit61e22cd85cd4c84fff391da67018c92bf21a8e19 (patch)
tree9f3f6b06d25b5735247ea51b665ed16a858cab3b /bindings/python/llvm/tests/base.py
parent51cf8661637c114e4b4f178bd2677a6bb246be0d (diff)
[llvm.py] Implement interface to object files
It is now possible to load object files and scan over sections, symbols, and relocations! Includes test code with partial coverage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/llvm/tests/base.py')
-rw-r--r--bindings/python/llvm/tests/base.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/bindings/python/llvm/tests/base.py b/bindings/python/llvm/tests/base.py
new file mode 100644
index 0000000000..420423cd18
--- /dev/null
+++ b/bindings/python/llvm/tests/base.py
@@ -0,0 +1,29 @@
+import os.path
+import unittest
+
+POSSIBLE_TEST_BINARIES = [
+ 'libreadline.so.5',
+ 'libreadline.so.6',
+]
+
+POSSIBLE_TEST_BINARY_PATHS = [
+ '/lib',
+ '/usr/lib',
+ '/usr/local/lib',
+]
+
+class TestBase(unittest.TestCase):
+ def get_test_binary(self):
+ """Helper to obtain a test binary for object file testing.
+
+ FIXME Support additional, highly-likely targets or create one
+ ourselves.
+ """
+ for d in POSSIBLE_TEST_BINARY_PATHS:
+ for lib in POSSIBLE_TEST_BINARIES:
+ path = os.path.join(d, lib)
+
+ if os.path.exists(path):
+ return path
+
+ raise Exception('No suitable test binaries available!')