aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/python/llvm/tests/base.py
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2012-03-24 04:18:09 -0700
committerShih-wei Liao <sliao@google.com>2012-03-24 04:18:09 -0700
commitc59a7995d22e2889706810c90a20a51ecfec278b (patch)
treeef37472f01d4b6258755680b4561a667bc337dd6 /bindings/python/llvm/tests/base.py
parentd1acd051dd8446a013b6c35b4bfe64ec68417206 (diff)
parent98a92d199ce9993dca1b65927009013ad3e5297f (diff)
downloadexternal_llvm-c59a7995d22e2889706810c90a20a51ecfec278b.zip
external_llvm-c59a7995d22e2889706810c90a20a51ecfec278b.tar.gz
external_llvm-c59a7995d22e2889706810c90a20a51ecfec278b.tar.bz2
Merge branch 'upstream' into sliao_d
Diffstat (limited to 'bindings/python/llvm/tests/base.py')
-rw-r--r--bindings/python/llvm/tests/base.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/bindings/python/llvm/tests/base.py b/bindings/python/llvm/tests/base.py
new file mode 100644
index 0000000..ff9eb2f
--- /dev/null
+++ b/bindings/python/llvm/tests/base.py
@@ -0,0 +1,32 @@
+import os.path
+import unittest
+
+POSSIBLE_TEST_BINARIES = [
+ 'libreadline.so.5',
+ 'libreadline.so.6',
+]
+
+POSSIBLE_TEST_BINARY_PATHS = [
+ '/usr/lib/debug',
+ '/lib',
+ '/usr/lib',
+ '/usr/local/lib',
+ '/lib/i386-linux-gnu',
+]
+
+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!')
+ get_test_binary.__test__ = False