blob: a5140945d4b95107de3c118f9dac339fec82101b [file] [log] [blame]
Masahiro Yamadac05e7912018-01-21 18:34:57 +09001#!/usr/bin/env python2
Tom Rini10e47792018-05-06 17:58:06 -04002# SPDX-License-Identifier: GPL-2.0
Stephen Warren10e50632016-01-15 11:15:24 -07003
4# Copyright (c) 2015 Stephen Warren
5# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
Stephen Warren10e50632016-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 Burton00f2d202017-09-14 14:34:43 -070010from __future__ import print_function
11
Stephen Warren10e50632016-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 Warren3deb8962016-01-26 13:41:31 -070020args = ['py.test', os.path.dirname(__file__) + '/tests']
Stephen Warren10e50632016-01-15 11:15:24 -070021args.extend(sys.argv)
22
23try:
Stephen Warren3deb8962016-01-26 13:41:31 -070024 os.execvp('py.test', args)
Stephen Warren10e50632016-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 Burton00f2d202017-09-14 14:34:43 -070031 print('''
Stephen Warren10e50632016-01-15 11:15:24 -070032exec(py.test) failed; perhaps you are missing some dependencies?
Paul Burton00f2d202017-09-14 14:34:43 -070033See test/py/README.md for the list.''', file=sys.stderr)
Stephen Warren1979cbb2016-02-03 10:42:11 -070034 sys.exit(1)