blob: a5140945d4b95107de3c118f9dac339fec82101b [file] [log] [blame]
Masahiro Yamada94b13bb2018-01-21 18:34:57 +09001#!/usr/bin/env python2
Tom Rini83d290c2018-05-06 17:58:06 -04002# SPDX-License-Identifier: GPL-2.0
Stephen Warrend2015062016-01-15 11:15:24 -07003
4# Copyright (c) 2015 Stephen Warren
5# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
Stephen Warrend2015062016-01-15 11:15:24 -07006
7# Wrapper script to invoke pytest with the directory name that contains the
8# U-Boot tests.
9
Paul Burtondffd56d2017-09-14 14:34:43 -070010from __future__ import print_function
11
Stephen Warrend2015062016-01-15 11:15:24 -070012import os
13import os.path
14import sys
15
16# Get rid of argv[0]
17sys.argv.pop(0)
18
19# argv; py.test test_directory_name user-supplied-arguments
Stephen Warrena2ec5602016-01-26 13:41:31 -070020args = ['py.test', os.path.dirname(__file__) + '/tests']
Stephen Warrend2015062016-01-15 11:15:24 -070021args.extend(sys.argv)
22
23try:
Stephen Warrena2ec5602016-01-26 13:41:31 -070024 os.execvp('py.test', args)
Stephen Warrend2015062016-01-15 11:15:24 -070025except:
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 Burtondffd56d2017-09-14 14:34:43 -070031 print('''
Stephen Warrend2015062016-01-15 11:15:24 -070032exec(py.test) failed; perhaps you are missing some dependencies?
Paul Burtondffd56d2017-09-14 14:34:43 -070033See test/py/README.md for the list.''', file=sys.stderr)
Stephen Warrenac998312016-02-03 10:42:11 -070034 sys.exit(1)