Masahiro Yamada | c05e791 | 2018-01-21 18:34:57 +0900 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 2 | |
| 3 | # Copyright (c) 2015 Stephen Warren |
| 4 | # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. |
| 5 | # |
| 6 | # SPDX-License-Identifier: GPL-2.0 |
| 7 | |
| 8 | # Wrapper script to invoke pytest with the directory name that contains the |
| 9 | # U-Boot tests. |
| 10 | |
| 11 | import os |
| 12 | import os.path |
| 13 | import sys |
| 14 | |
| 15 | # Get rid of argv[0] |
| 16 | sys.argv.pop(0) |
| 17 | |
| 18 | # argv; py.test test_directory_name user-supplied-arguments |
Stephen Warren | 3deb896 | 2016-01-26 13:41:31 -0700 | [diff] [blame] | 19 | args = ['py.test', os.path.dirname(__file__) + '/tests'] |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 20 | args.extend(sys.argv) |
| 21 | |
| 22 | try: |
Stephen Warren | 3deb896 | 2016-01-26 13:41:31 -0700 | [diff] [blame] | 23 | os.execvp('py.test', args) |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 24 | except: |
| 25 | # Log full details of any exception for detailed analysis |
| 26 | import traceback |
| 27 | traceback.print_exc() |
| 28 | # Hint to the user that they likely simply haven't installed the required |
| 29 | # dependencies. |
Stephen Warren | 3deb896 | 2016-01-26 13:41:31 -0700 | [diff] [blame] | 30 | print >>sys.stderr, ''' |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 31 | exec(py.test) failed; perhaps you are missing some dependencies? |
Stephen Warren | 3deb896 | 2016-01-26 13:41:31 -0700 | [diff] [blame] | 32 | See test/py/README.md for the list.''' |
Stephen Warren | 1979cbb | 2016-02-03 10:42:11 -0700 | [diff] [blame] | 33 | sys.exit(1) |