buildman.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. #
  3. # Copyright (c) 2012 The Chromium OS Authors.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0+
  6. #
  7. """See README for more information"""
  8. import multiprocessing
  9. import os
  10. import re
  11. import sys
  12. import unittest
  13. # Bring in the patman libraries
  14. our_path = os.path.dirname(os.path.realpath(__file__))
  15. sys.path.append(os.path.join(our_path, '../patman'))
  16. # Our modules
  17. import board
  18. import builder
  19. import checkpatch
  20. import cmdline
  21. import control
  22. import doctest
  23. import gitutil
  24. import patchstream
  25. import terminal
  26. import toolchain
  27. def RunTests():
  28. import test
  29. import doctest
  30. result = unittest.TestResult()
  31. for module in ['toolchain']:
  32. suite = doctest.DocTestSuite(module)
  33. suite.run(result)
  34. # TODO: Surely we can just 'print' result?
  35. print result
  36. for test, err in result.errors:
  37. print err
  38. for test, err in result.failures:
  39. print err
  40. sys.argv = [sys.argv[0]]
  41. suite = unittest.TestLoader().loadTestsFromTestCase(test.TestBuild)
  42. result = unittest.TestResult()
  43. suite.run(result)
  44. # TODO: Surely we can just 'print' result?
  45. print result
  46. for test, err in result.errors:
  47. print err
  48. for test, err in result.failures:
  49. print err
  50. options, args = cmdline.ParseArgs()
  51. # Run our meagre tests
  52. if options.test:
  53. RunTests()
  54. # Build selected commits for selected boards
  55. else:
  56. ret_code = control.DoBuildman(options, args)
  57. sys.exit(ret_code)