]> git.ipfire.org Git - people/ms/u-boot.git/blame - test/py/test.py
test/py: exit(1) if there are problems running py.test
[people/ms/u-boot.git] / test / py / test.py
CommitLineData
d201506c
SW
1#!/usr/bin/env python
2
3# Copyright (c) 2015 Stephen Warren
4# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
5#
6# SPDX-License-Identifier: GPL-2.0
7
8# Wrapper script to invoke pytest with the directory name that contains the
9# U-Boot tests.
10
11import os
12import os.path
13import sys
14
15# Get rid of argv[0]
16sys.argv.pop(0)
17
18# argv; py.test test_directory_name user-supplied-arguments
a2ec5606 19args = ['py.test', os.path.dirname(__file__) + '/tests']
d201506c
SW
20args.extend(sys.argv)
21
22try:
a2ec5606 23 os.execvp('py.test', args)
d201506c
SW
24except:
25 # Log full details of any exception for detailed analysis
26 import traceback
27 traceback.print_exc()
28 # Hint to the user that they likely simply haven't installed the required
29 # dependencies.
a2ec5606 30 print >>sys.stderr, '''
d201506c 31exec(py.test) failed; perhaps you are missing some dependencies?
a2ec5606 32See test/py/README.md for the list.'''
ac99831b 33 sys.exit(1)