[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / bindings / python / llvm / tests / base.py
blobaa435bc1f35f5603c7dc67642c9b286e85c29abf
1 import os.path
2 import sys
3 import unittest
6 POSSIBLE_TEST_BINARIES = [
7 'libreadline.so.5',
8 'libreadline.so.6',
11 POSSIBLE_TEST_BINARY_PATHS = [
12 '/usr/lib/debug',
13 '/lib',
14 '/usr/lib',
15 '/usr/local/lib',
16 '/lib/i386-linux-gnu',
19 class TestBase(unittest.TestCase):
20 if sys.version_info.major == 2:
21 assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
23 def get_test_binary(self):
24 """Helper to obtain a test binary for object file testing.
26 FIXME Support additional, highly-likely targets or create one
27 ourselves.
28 """
29 for d in POSSIBLE_TEST_BINARY_PATHS:
30 for lib in POSSIBLE_TEST_BINARIES:
31 path = os.path.join(d, lib)
33 if os.path.exists(path):
34 return path
36 raise Exception('No suitable test binaries available!')
37 get_test_binary.__test__ = False
39 def get_test_file(self):
40 return os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_file")
42 def get_test_bc(self):
43 return os.path.join(os.path.dirname(os.path.abspath(__file__)), "test.bc")