blob: 0ce1838833f6f1a38810ee8cf530ae9749068e17 [file] [log] [blame]
Tom Rini7f24c192019-10-24 11:59:20 -04001#!/usr/bin/env python3
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
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 Warren3deb8962016-01-26 13:41:31 -070018args = ['py.test', os.path.dirname(__file__) + '/tests']
Stephen Warren10e50632016-01-15 11:15:24 -070019args.extend(sys.argv)
20
21try:
Stephen Warren3deb8962016-01-26 13:41:31 -070022 os.execvp('py.test', args)
Stephen Warren10e50632016-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 Burton00f2d202017-09-14 14:34:43 -070029 print('''
Stephen Warren10e50632016-01-15 11:15:24 -070030exec(py.test) failed; perhaps you are missing some dependencies?
Paul Burton00f2d202017-09-14 14:34:43 -070031See test/py/README.md for the list.''', file=sys.stderr)
Stephen Warren1979cbb2016-02-03 10:42:11 -070032 sys.exit(1)