resulttool 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python3
  2. #
  3. # test results tool - tool for manipulating OEQA test result json files
  4. # (merge results, summarise results, regression analysis, generate manual test results file)
  5. #
  6. # To look for help information.
  7. # $ resulttool
  8. #
  9. # To store test results from oeqa automated tests, execute the below
  10. # $ resulttool store <source_dir> <git_branch>
  11. #
  12. # To merge test results, execute the below
  13. # $ resulttool merge <base_result_file> <target_result_file>
  14. #
  15. # To report test report, execute the below
  16. # $ resulttool report <source_dir>
  17. #
  18. # To perform regression file analysis, execute the below
  19. # $ resulttool regression-file <base_result_file> <target_result_file>
  20. #
  21. # To execute manual test cases, execute the below
  22. # $ resulttool manualexecution <manualjsonfile>
  23. #
  24. # By default testresults.json for manualexecution store in <build>/tmp/log/manual/
  25. #
  26. # Copyright (c) 2019, Intel Corporation.
  27. #
  28. # This program is free software; you can redistribute it and/or modify it
  29. # under the terms and conditions of the GNU General Public License,
  30. # version 2, as published by the Free Software Foundation.
  31. #
  32. # This program is distributed in the hope it will be useful, but WITHOUT
  33. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  34. # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  35. # more details.
  36. #
  37. import os
  38. import sys
  39. import argparse
  40. import logging
  41. script_path = os.path.dirname(os.path.realpath(__file__))
  42. lib_path = script_path + '/lib'
  43. sys.path = sys.path + [lib_path]
  44. import argparse_oe
  45. import scriptutils
  46. import resulttool.merge
  47. import resulttool.store
  48. import resulttool.regression
  49. import resulttool.report
  50. import resulttool.manualexecution
  51. import resulttool.log
  52. logger = scriptutils.logger_create('resulttool')
  53. def main():
  54. parser = argparse_oe.ArgumentParser(description="OEQA test result manipulation tool.",
  55. epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
  56. parser.add_argument('-d', '--debug', help='enable debug output', action='store_true')
  57. parser.add_argument('-q', '--quiet', help='print only errors', action='store_true')
  58. subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>')
  59. subparsers.required = True
  60. subparsers.add_subparser_group('manualexecution', 'manual testcases', 300)
  61. resulttool.manualexecution.register_commands(subparsers)
  62. subparsers.add_subparser_group('setup', 'setup', 200)
  63. resulttool.merge.register_commands(subparsers)
  64. resulttool.store.register_commands(subparsers)
  65. subparsers.add_subparser_group('analysis', 'analysis', 100)
  66. resulttool.regression.register_commands(subparsers)
  67. resulttool.report.register_commands(subparsers)
  68. resulttool.log.register_commands(subparsers)
  69. args = parser.parse_args()
  70. if args.debug:
  71. logger.setLevel(logging.DEBUG)
  72. elif args.quiet:
  73. logger.setLevel(logging.ERROR)
  74. try:
  75. ret = args.func(args, logger)
  76. except argparse_oe.ArgumentUsageError as ae:
  77. parser.error_subcommand(ae.message, ae.subcommand)
  78. return ret
  79. if __name__ == "__main__":
  80. sys.exit(main())