Add support for DT_RELR/SHT_RELR compressed relocation sections (#395)
[pyelftools.git] / test / run_all_unittests.py
1 #!/usr/bin/env python
2 #-------------------------------------------------------------------------------
3 # test/run_all_unittests.py
4 #
5 # Run all unit tests (alternative to running 'python -m unittest discover ...')
6 #
7 # Eli Bendersky (eliben@gmail.com)
8 # This code is in the public domain
9 #-------------------------------------------------------------------------------
10 from __future__ import print_function
11
12 import os, sys
13 import unittest
14
15 # Make it possible to run this file from the root dir of pyelftools without
16 # installing pyelftools; useful for CI testing, etc.
17 sys.path[0:0] = ['.']
18
19
20 def main():
21 if not os.path.isdir('test'):
22 print('!! Please execute from the root directory of pyelftools')
23 return 1
24 else:
25 tests = unittest.TestLoader().discover('test', 'test*.py', 'test')
26 result = unittest.TextTestRunner().run(tests)
27 if result.wasSuccessful():
28 return 0
29 else:
30 return 1
31
32 if __name__ == '__main__':
33 sys.exit(main())