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