buildman.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.insert(1, os.path.join(our_path, '../patman'))
  16. # Our modules
  17. import board
  18. import bsettings
  19. import builder
  20. import checkpatch
  21. import cmdline
  22. import control
  23. import doctest
  24. import gitutil
  25. import patchstream
  26. import terminal
  27. import toolchain
  28. def RunTests():
  29. import func_test
  30. import test
  31. import doctest
  32. result = unittest.TestResult()
  33. for module in ['toolchain', 'gitutil']:
  34. suite = doctest.DocTestSuite(module)
  35. suite.run(result)
  36. sys.argv = [sys.argv[0]]
  37. for module in (test.TestBuild, func_test.TestFunctional):
  38. suite = unittest.TestLoader().loadTestsFromTestCase(module)
  39. suite.run(result)
  40. print result
  41. for test, err in result.errors:
  42. print err
  43. for test, err in result.failures:
  44. print err
  45. options, args = cmdline.ParseArgs()
  46. # Run our meagre tests
  47. if options.test:
  48. RunTests()
  49. # Build selected commits for selected boards
  50. else:
  51. bsettings.Setup(options.config_file)
  52. ret_code = control.DoBuildman(options, args)
  53. sys.exit(ret_code)