Masahiro Yamada | 94b13bb | 2018-01-21 18:34:57 +0900 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 2 | # SPDX-License-Identifier: GPL-2.0 |
Stephen Warren | d201506 | 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 | d201506 | 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 | |
Paul Burton | dffd56d | 2017-09-14 14:34:43 -0700 | [diff] [blame] | 10 | from __future__ import print_function |
| 11 | |
Stephen Warren | d201506 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 12 | import os |
| 13 | import os.path |
| 14 | import sys |
| 15 | |
| 16 | # Get rid of argv[0] |
| 17 | sys.argv.pop(0) |
| 18 | |
| 19 | # argv; py.test test_directory_name user-supplied-arguments |
Stephen Warren | a2ec560 | 2016-01-26 13:41:31 -0700 | [diff] [blame] | 20 | args = ['py.test', os.path.dirname(__file__) + '/tests'] |
Stephen Warren | d201506 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 21 | args.extend(sys.argv) |
| 22 | |
| 23 | try: |
Stephen Warren | a2ec560 | 2016-01-26 13:41:31 -0700 | [diff] [blame] | 24 | os.execvp('py.test', args) |
Stephen Warren | d201506 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 25 | except: |
| 26 | # Log full details of any exception for detailed analysis |
| 27 | import traceback |
| 28 | traceback.print_exc() |
| 29 | # Hint to the user that they likely simply haven't installed the required |
| 30 | # dependencies. |
Paul Burton | dffd56d | 2017-09-14 14:34:43 -0700 | [diff] [blame] | 31 | print(''' |
Stephen Warren | d201506 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 32 | exec(py.test) failed; perhaps you are missing some dependencies? |
Paul Burton | dffd56d | 2017-09-14 14:34:43 -0700 | [diff] [blame] | 33 | See test/py/README.md for the list.''', file=sys.stderr) |
Stephen Warren | ac99831 | 2016-02-03 10:42:11 -0700 | [diff] [blame] | 34 | sys.exit(1) |