blob: 04baf8df3ba5581df53629c4da8f451b47be5394 [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
10import os
11import os.path
12import sys
13
14# Get rid of argv[0]
15sys.argv.pop(0)
16
17# argv; py.test test_directory_name user-supplied-arguments
Stephen Warrena2ec5602016-01-26 13:41:31 -070018args = ['py.test', os.path.dirname(__file__) + '/tests']
Stephen Warrend2015062016-01-15 11:15:24 -070019args.extend(sys.argv)
20
21try:
Stephen Warrena2ec5602016-01-26 13:41:31 -070022 os.execvp('py.test', args)
Stephen Warrend2015062016-01-15 11:15:24 -070023except:
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.
Stephen Warrena2ec5602016-01-26 13:41:31 -070029 print >>sys.stderr, '''
Stephen Warrend2015062016-01-15 11:15:24 -070030exec(py.test) failed; perhaps you are missing some dependencies?
Stephen Warrena2ec5602016-01-26 13:41:31 -070031See test/py/README.md for the list.'''
Stephen Warrenac998312016-02-03 10:42:11 -070032 sys.exit(1)