main.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python3
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Copyright (c) 2012 The Chromium OS Authors.
  5. #
  6. """See README for more information"""
  7. import multiprocessing
  8. import os
  9. import re
  10. import sys
  11. import unittest
  12. # Bring in the patman libraries
  13. our_path = os.path.dirname(os.path.realpath(__file__))
  14. sys.path.insert(1, os.path.join(our_path, '../patman'))
  15. # Our modules
  16. import board
  17. import bsettings
  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(skip_net_tests):
  28. import func_test
  29. import test
  30. import doctest
  31. result = unittest.TestResult()
  32. for module in ['toolchain', 'gitutil']:
  33. suite = doctest.DocTestSuite(module)
  34. suite.run(result)
  35. sys.argv = [sys.argv[0]]
  36. if skip_net_tests:
  37. test.use_network = False
  38. for module in (test.TestBuild, func_test.TestFunctional):
  39. suite = unittest.TestLoader().loadTestsFromTestCase(module)
  40. suite.run(result)
  41. print(result)
  42. for test, err in result.errors:
  43. print(err)
  44. for test, err in result.failures:
  45. print(err)
  46. options, args = cmdline.ParseArgs()
  47. # Run our meagre tests
  48. if options.test:
  49. RunTests(options.skip_net_tests)
  50. # Build selected commits for selected boards
  51. else:
  52. bsettings.Setup(options.config_file)
  53. ret_code = control.DoBuildman(options, args)
  54. sys.exit(ret_code)