blob: fc282bda6c61d62341249b1cfdb060a7c810f9c0 [file] [log] [blame]
Brad Bishop40320b12019-03-26 16:08:25 -04001#!/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#
Brad Bishopc342db32019-05-15 21:57:59 -040028# SPDX-License-Identifier: GPL-2.0-only
Brad Bishop40320b12019-03-26 16:08:25 -040029#
30
31import os
32import sys
33import argparse
34import logging
35script_path = os.path.dirname(os.path.realpath(__file__))
36lib_path = script_path + '/lib'
37sys.path = sys.path + [lib_path]
38import argparse_oe
39import scriptutils
40import resulttool.merge
41import resulttool.store
42import resulttool.regression
43import resulttool.report
44import resulttool.manualexecution
Brad Bishopc342db32019-05-15 21:57:59 -040045import resulttool.log
Brad Bishop40320b12019-03-26 16:08:25 -040046logger = scriptutils.logger_create('resulttool')
47
Brad Bishop40320b12019-03-26 16:08:25 -040048def main():
49 parser = argparse_oe.ArgumentParser(description="OEQA test result manipulation tool.",
50 epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
51 parser.add_argument('-d', '--debug', help='enable debug output', action='store_true')
52 parser.add_argument('-q', '--quiet', help='print only errors', action='store_true')
53 subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>')
54 subparsers.required = True
55 subparsers.add_subparser_group('manualexecution', 'manual testcases', 300)
56 resulttool.manualexecution.register_commands(subparsers)
57 subparsers.add_subparser_group('setup', 'setup', 200)
58 resulttool.merge.register_commands(subparsers)
59 resulttool.store.register_commands(subparsers)
60 subparsers.add_subparser_group('analysis', 'analysis', 100)
61 resulttool.regression.register_commands(subparsers)
62 resulttool.report.register_commands(subparsers)
Brad Bishopc342db32019-05-15 21:57:59 -040063 resulttool.log.register_commands(subparsers)
Brad Bishop40320b12019-03-26 16:08:25 -040064
65 args = parser.parse_args()
66 if args.debug:
67 logger.setLevel(logging.DEBUG)
68 elif args.quiet:
69 logger.setLevel(logging.ERROR)
70
Brad Bishop40320b12019-03-26 16:08:25 -040071 try:
72 ret = args.func(args, logger)
73 except argparse_oe.ArgumentUsageError as ae:
74 parser.error_subcommand(ae.message, ae.subcommand)
75 return ret
76
77if __name__ == "__main__":
78 sys.exit(main())