[python] Add some paths where to find test binary
[oota-llvm.git] / bindings / python / llvm / tests / base.py
1 import os.path
2 import unittest
3
4 POSSIBLE_TEST_BINARIES = [
5     'libreadline.so.5',
6     'libreadline.so.6',
7 ]
8
9 POSSIBLE_TEST_BINARY_PATHS = [
10     '/usr/lib/debug',
11     '/lib',
12     '/usr/lib',
13     '/usr/local/lib',
14     '/lib/i386-linux-gnu',
15 ]
16
17 class TestBase(unittest.TestCase):
18     def get_test_binary(self):
19         """Helper to obtain a test binary for object file testing.
20
21         FIXME Support additional, highly-likely targets or create one
22         ourselves.
23         """
24         for d in POSSIBLE_TEST_BINARY_PATHS:
25             for lib in POSSIBLE_TEST_BINARIES:
26                 path = os.path.join(d, lib)
27
28                 if os.path.exists(path):
29                     return path
30
31         raise Exception('No suitable test binaries available!')
32     get_test_binary.__test__ = False