xref: /openbmc/u-boot/test/py/test.py (revision 21299d3a)
1#!/usr/bin/env python2
2# SPDX-License-Identifier: GPL-2.0
3
4# Copyright (c) 2015 Stephen Warren
5# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
6
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
18args = ['py.test', os.path.dirname(__file__) + '/tests']
19args.extend(sys.argv)
20
21try:
22    os.execvp('py.test', args)
23except:
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.
29    print >>sys.stderr, '''
30exec(py.test) failed; perhaps you are missing some dependencies?
31See test/py/README.md for the list.'''
32    sys.exit(1)
33