blob: 0ce1838833f6f1a38810ee8cf530ae9749068e17 [file] [log] [blame]
Tom Rinife1193e2019-10-24 11:59:20 -04001#!/usr/bin/env python3
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.
Paul Burtondffd56d2017-09-14 14:34:43 -070029 print('''
Stephen Warrend2015062016-01-15 11:15:24 -070030exec(py.test) failed; perhaps you are missing some dependencies?
Paul Burtondffd56d2017-09-14 14:34:43 -070031See test/py/README.md for the list.''', file=sys.stderr)
Stephen Warrenac998312016-02-03 10:42:11 -070032 sys.exit(1)