test.py 871 B

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