summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/testresultlog/gitstore.py (renamed from scripts/lib/testresultlog/testresultgitstore.py)4
-rw-r--r--scripts/lib/testresultlog/oeqalogparser.py (renamed from scripts/lib/testresultlog/testlogparser.py)2
-rw-r--r--scripts/lib/testresultlog/oeqatestdiscover.py (renamed from scripts/lib/testresultlog/oeqatestcasecreator.py)10
-rw-r--r--scripts/lib/testresultlog/storeauto.py (renamed from scripts/lib/testresultlog/testresultupdator.py)71
-rw-r--r--scripts/lib/testresultlog/storemanual.py20
-rw-r--r--scripts/lib/testresultlog/testplan.py (renamed from scripts/lib/testresultlog/testresultcreator.py)51
-rw-r--r--scripts/lib/testresultlog/testplanconfigparser.py (renamed from scripts/lib/testresultlog/testresultlogconfigparser.py)2
-rw-r--r--scripts/lib/testresultlog/testresultmanualcreator.py19
-rw-r--r--scripts/lib/testresultlog/view.py (renamed from scripts/lib/testresultlog/testresultviewer.py)26
-rwxr-xr-xscripts/test-result-log101
10 files changed, 174 insertions, 132 deletions
diff --git a/scripts/lib/testresultlog/testresultgitstore.py b/scripts/lib/testresultlog/gitstore.py
index b19118a1464..67f274931d1 100644
--- a/scripts/lib/testresultlog/testresultgitstore.py
+++ b/scripts/lib/testresultlog/gitstore.py
@@ -9,7 +9,7 @@ scriptpath.add_bitbake_lib_path()
scriptpath.add_oe_lib_path()
from oeqa.utils.git import GitRepo, GitError
-class TestResultGitStore(object):
+class GitStore(object):
def __init__(self):
self.script_path = os.path.dirname(os.path.realpath(__file__))
@@ -289,7 +289,7 @@ class TestResultGitStore(object):
if self._check_if_git_dir_contain_project_and_environment_directory(git_dir, project, environment_list):
print('Found project and environment inside git_dir: %s' % git_dir)
print('Since project and environment already exist, could not proceed to create.')
- if force_create == 'True':
+ if force_create:
print('Force create activated: proceed to create.')
self._create_automated_test_result_from_existing_git(git_dir, git_branch, project, environment_list, testmodule_testsuite_dict, testsuite_testcase_dict, {}, {})
else:
diff --git a/scripts/lib/testresultlog/testlogparser.py b/scripts/lib/testresultlog/oeqalogparser.py
index d34e074a3cc..0afba18ff3f 100644
--- a/scripts/lib/testresultlog/testlogparser.py
+++ b/scripts/lib/testresultlog/oeqalogparser.py
@@ -1,6 +1,6 @@
import re
-class TestLogParser(object):
+class OeqaLogParser(object):
def get_test_status(self, log_file):
regex = ".*RESULTS - (?P<case_name>.*) - Testcase .*: (?P<status>PASSED|FAILED|SKIPPED|ERROR|UNKNOWN).*$"
diff --git a/scripts/lib/testresultlog/oeqatestcasecreator.py b/scripts/lib/testresultlog/oeqatestdiscover.py
index 01c6e9d553a..b1b6ccab5f6 100644
--- a/scripts/lib/testresultlog/oeqatestcasecreator.py
+++ b/scripts/lib/testresultlog/oeqatestdiscover.py
@@ -1,6 +1,6 @@
import unittest
-class OeqaTestCaseCreator(object):
+class OeqaTestDiscover(object):
def _discover_unittest_testsuite_testcase(self, test_dir):
loader = unittest.TestLoader()
@@ -54,12 +54,12 @@ class OeqaTestCaseCreator(object):
if testcase_remove in testcase_list:
testcase_list.remove(testcase_remove)
- def get_oeqa_testcase_list(self, work_dir, testcase_remove_source_file):
- unittest_testsuite_testcase = self._discover_unittest_testsuite_testcase(work_dir)
+ def get_oeqa_testcase_list(self, testcase_dir, testcase_remove_file):
+ unittest_testsuite_testcase = self._discover_unittest_testsuite_testcase(testcase_dir)
unittest_testcase_list = self._generate_flat_list_of_unittest_testcase(unittest_testsuite_testcase)
testcase_list = self._get_testcase_list(unittest_testcase_list)
- if len(testcase_remove_source_file) > 0:
- testcase_remove_pattern_list = self._get_testcase_remove_pattern_list(testcase_remove_source_file)
+ if len(testcase_remove_file) > 0:
+ testcase_remove_pattern_list = self._get_testcase_remove_pattern_list(testcase_remove_file)
self._remove_test_case_from_removal_pattern_list(testcase_list, testcase_remove_pattern_list)
return testcase_list
diff --git a/scripts/lib/testresultlog/testresultupdator.py b/scripts/lib/testresultlog/storeauto.py
index 6318a087515..58622edca7b 100644
--- a/scripts/lib/testresultlog/testresultupdator.py
+++ b/scripts/lib/testresultlog/storeauto.py
@@ -1,9 +1,8 @@
-import unittest
-from testresultlog.testresultgitstore import TestResultGitStore
-from testresultlog.oeqatestcasecreator import OeqaTestCaseCreator
-from testresultlog.testlogparser import TestLogParser
+from testresultlog.gitstore import GitStore
+from testresultlog.oeqatestdiscover import OeqaTestDiscover
+from testresultlog.oeqalogparser import OeqaLogParser
-class TestResultUpdator(object):
+class StoreAuto(object):
def _get_testsuite_from_testcase(self, testcase):
testsuite = testcase[0:testcase.rfind(".")]
@@ -34,21 +33,21 @@ class TestResultUpdator(object):
environment_list = '%s,%s' % (environment_list, new_environment)
return environment_list
- def get_environment_list_for_test_log(self, log_file, log_file_source, environment_list, testlogparser):
+ def get_environment_list_for_test_log(self, log_file, log_file_source, environment_list, oeqa_logparser):
print('Getting test environment information from test log at %s' % log_file)
if log_file_source == 'runtime':
- runtime_image_env = testlogparser.get_runtime_test_image_environment(log_file)
+ runtime_image_env = oeqa_logparser.get_runtime_test_image_environment(log_file)
print('runtime image environment: %s' % runtime_image_env)
- runtime_qemu_env = testlogparser.get_runtime_test_qemu_environment(log_file)
+ runtime_qemu_env = oeqa_logparser.get_runtime_test_qemu_environment(log_file)
print('runtime qemu environment: %s' % runtime_qemu_env)
environment_list = self._add_new_environment_to_environment_list(environment_list, runtime_image_env)
environment_list = self._add_new_environment_to_environment_list(environment_list, runtime_qemu_env)
return environment_list.split(",")
- def get_testsuite_testcase_dictionary(self, work_dir, testcase_remove_source_file):
- print('Getting testsuite testcase information from oeqa directory at %s' % work_dir)
- oeqatestcasecreator = OeqaTestCaseCreator()
- testcase_list = oeqatestcasecreator.get_oeqa_testcase_list(work_dir, testcase_remove_source_file)
+ def get_testsuite_testcase_dictionary(self, testcase_dir, testcase_remove_file):
+ print('Getting testsuite testcase information from oeqa directory at %s' % testcase_dir)
+ oeqatestdiscover = OeqaTestDiscover()
+ testcase_list = oeqatestdiscover.get_oeqa_testcase_list(testcase_dir, testcase_remove_file)
testsuite_testcase_dict = {}
for testcase in testcase_list:
testsuite = self._get_testsuite_from_testcase(testcase)
@@ -72,7 +71,7 @@ class TestResultUpdator(object):
def get_testcase_failed_or_error_logs_dictionary(self, log_file, testcase_status_dict):
print('Getting testcase failed or error log from %s' % log_file)
- testlogparser = TestLogParser()
+ testresultlogparser = OeqaLogParser()
testcase_list = testcase_status_dict.keys()
testcase_failed_or_error_logs_dict = {}
for testcase in testcase_list:
@@ -80,42 +79,44 @@ class TestResultUpdator(object):
if test_status == 'FAILED' or test_status == 'ERROR':
testsuite = self._get_testsuite_from_testcase(testcase)
testfunction = self._remove_testsuite_from_testcase(testcase, testsuite)
- logs = testlogparser.get_test_log(log_file, test_status, testfunction, testsuite)
+ logs = testresultlogparser.get_test_log(log_file, test_status, testfunction, testsuite)
testcase_failed_or_error_logs_dict[testcase] = logs
return testcase_failed_or_error_logs_dict
def main(args):
- testlogparser = TestLogParser()
- testcase_status_dict = testlogparser.get_test_status(args.log_file)
+ oeqa_logparser = OeqaLogParser()
+ testcase_status_dict = oeqa_logparser.get_test_status(args.log_file)
- testresultupdator = TestResultUpdator()
- environment_list = testresultupdator.get_environment_list_for_test_log(args.log_file, args.source, args.environment_list, testlogparser)
- testsuite_testcase_dict = testresultupdator.get_testsuite_testcase_dictionary(args.oeqa_dir, args.testcase_remove_source_file)
- testmodule_testsuite_dict = testresultupdator.get_testmodule_testsuite_dictionary(testsuite_testcase_dict)
- test_logs_dict = testresultupdator.get_testcase_failed_or_error_logs_dictionary(args.log_file, testcase_status_dict)
+ store_auto = StoreAuto()
+ environment_list = store_auto.get_environment_list_for_test_log(args.log_file, args.source, args.environment_list, oeqa_logparser)
+ testsuite_testcase_dict = store_auto.get_testsuite_testcase_dictionary(args.case_dir, args.testcase_remove_file)
+ testmodule_testsuite_dict = store_auto.get_testmodule_testsuite_dictionary(testsuite_testcase_dict)
+ test_logs_dict = store_auto.get_testcase_failed_or_error_logs_dictionary(args.log_file, testcase_status_dict)
- testresultstore = TestResultGitStore()
- testresultstore.smart_update_automated_test_result(args.git_repo, args.git_branch, args.component, environment_list, testmodule_testsuite_dict, testsuite_testcase_dict, testcase_status_dict, test_logs_dict)
+ gitstore = GitStore()
+ gitstore.smart_update_automated_test_result(args.git_repo, args.git_branch, args.component, environment_list, testmodule_testsuite_dict, testsuite_testcase_dict, testcase_status_dict, test_logs_dict)
if (len(args.git_remote) > 0):
- testresultstore.git_remote_fetch_rebase_push(args.git_repo, args.git_branch, args.git_remote)
+ gitstore.git_remote_fetch_rebase_push(args.git_repo, args.git_branch, args.git_remote)
+ return 0
def register_commands(subparsers):
"""Register subcommands from this plugin"""
- parser_build = subparsers.add_parser('update', help='Store OEQA automated test status & log into git repository',
- description='Store OEQA automated test status & log into git repository')
+ parser_build = subparsers.add_parser('store-auto', help='Store OEQA automated test status & log into git repository',
+ description='Store OEQA automated test status & log into git repository',
+ group='store')
parser_build.set_defaults(func=main)
- parser_build.add_argument('-c', '--component', required=True, help='Component folder (as the top folder) to store the test status & log')
- parser_build.add_argument('-l', '--log_file', required=True, help='Full path to the test log file to be used for test result update')
- parser_build.add_argument('-b', '--git_branch', required=True, help='Git branch to store the test status & log')
+ parser_build.add_argument('component', help='Component folder (as the top folder) to store the test status & log')
+ parser_build.add_argument('git_branch', help='Git branch to store the test status & log')
+ parser_build.add_argument('log_file', help='Full path to the OEQA automated test log file to be used for test result storing')
SOURCE = ('runtime', 'selftest', 'sdk', 'sdkext')
- parser_build.add_argument('-s', '--source', required=True, choices=SOURCE,
+ parser_build.add_argument('source', choices=SOURCE,
help='Selected testcase sources to be used for OEQA testcase discovery and testcases discovered will be used as the base testcases for storing test status & log. '
'"runtime" will search testcase available in meta/lib/oeqa/runtime/cases. '
'"selftest" will search testcase available in meta/lib/oeqa/selftest/cases. '
'"sdk" will search testcase available in meta/lib/oeqa/sdk/cases. '
'"sdkext" will search testcase available in meta/lib/oeqa/sdkext/cases. ')
- parser_build.add_argument('-g', '--git_repo', required=False, default='default', help='(Optional) Git repository used for storage, default will be <top_dir>/test-result-log.git')
- parser_build.add_argument('-e', '--environment_list', required=False, default='', help='(Optional) List of environment seperated by comma (",") used to label the test environments for the stored test status & log')
- parser_build.add_argument('-r', '--git_remote', required=False, default='', help='(Optional) Git remote repository used for storage')
- parser_build.add_argument('-d', '--poky_dir', required=False, default='default', help='(Optional) Top directory to be used for OEQA testcase discovery, default will use current <top_dir> directory')
- parser_build.add_argument('-m', '--testcase_remove_source_file', required=False, default='', help='(Optional) Full path to the file (created during test planning) used to define list of testcases to be excluded from storage')
+ parser_build.add_argument('-g', '--git_repo', default='default', help='(Optional) Full path to the git repository used for storage, default will be <top_dir>/test-result-log.git')
+ parser_build.add_argument('-e', '--environment_list', default='default', help='(Optional) List of environment seperated by comma (",") used to label the test environments for the stored test status & log')
+ parser_build.add_argument('-r', '--git_remote', default='default', help='(Optional) Git remote repository used for storage')
+ parser_build.add_argument('-o', '--oe_dir', default='default', help='(Optional) OE top directory to be used for OEQA testcase discovery, default will use current <top_dir> directory')
+ parser_build.add_argument('-m', '--testcase_remove_file', default='default', help='(Optional) Full path to the file (created during test planning) used to define list of testcases to be excluded from storage')
diff --git a/scripts/lib/testresultlog/storemanual.py b/scripts/lib/testresultlog/storemanual.py
new file mode 100644
index 00000000000..83285597c0b
--- /dev/null
+++ b/scripts/lib/testresultlog/storemanual.py
@@ -0,0 +1,20 @@
+from testresultlog.gitstore import GitStore
+
+def main(args):
+ if len(args.environment_list) > 0:
+ env_list = args.environment_list.split(",")
+ gitstore = GitStore()
+ gitstore.create_manual_test_result(args.git_repo, args.git_branch, args.component, env_list, args.manual_tests_dir)
+ return 0
+
+def register_commands(subparsers):
+ """Register subcommands from this plugin"""
+ parser_build = subparsers.add_parser('store-manual', help='Store manual test status & log from manual-test-helper into git repository',
+ description='Store manual test status & log from manual-test-helper into git repository',
+ group='store')
+ parser_build.set_defaults(func=main)
+ parser_build.add_argument('component', help='Component folder (as the top folder) to store the test status & log')
+ parser_build.add_argument('git_branch', help='Git branch to store the test status & log')
+ parser_build.add_argument('manual_tests_dir', help='Directory with manual test result files from manual-test-helper to be stored')
+ parser_build.add_argument('-g', '--git_repo', default='default', help='(Optional) Git repository used for storage, default will be <top_dir>/test-result-log.git')
+ parser_build.add_argument('-e', '--environment_list', default='default', help='(Optional) List of environment seperated by comma (",") used to label the test environments for the stored test status & log')
diff --git a/scripts/lib/testresultlog/testresultcreator.py b/scripts/lib/testresultlog/testplan.py
index 979cfffeee7..10b3cd07ba5 100644
--- a/scripts/lib/testresultlog/testresultcreator.py
+++ b/scripts/lib/testresultlog/testplan.py
@@ -1,12 +1,12 @@
import os
-from testresultlog.testresultlogconfigparser import TestResultLogConfigParser
-from testresultlog.oeqatestcasecreator import OeqaTestCaseCreator
-from testresultlog.testresultgitstore import TestResultGitStore
+from testresultlog.testplanconfigparser import TestPlanConfigParser
+from testresultlog.oeqatestdiscover import OeqaTestDiscover
+from testresultlog.gitstore import GitStore
-class TestPlanCreator(object):
+class TestPlan(object):
def _get_test_configuration_list(self, conf_path, section):
- config_parser = TestResultLogConfigParser(conf_path)
+ config_parser = TestPlanConfigParser(conf_path)
return config_parser.get_config_items(section)
def _init_environment_multiplication_matrix(self, env_matrix, new_env_list):
@@ -38,15 +38,15 @@ class TestPlanCreator(object):
env_value_list = self._get_test_configuration_list(environment_conf, env)
print('test environment value(s): %s' % env_value_list)
if len(env_matrix) == 0:
- self._init_environment_multiplication_matrix(env_matrix, env_value_list, env)
+ self._init_environment_multiplication_matrix(env_matrix, env_value_list)
else:
- env_matrix = self._multiply_current_env_list_with_new_env_list(env_matrix, env_value_list, env)
+ env_matrix = self._multiply_current_env_list_with_new_env_list(env_matrix, env_value_list)
return env_matrix
- def get_testsuite_testcase_dictionary(self, work_dir, testcase_remove_source_file):
- print('Getting testsuite testcase information from oeqa directory at %s' % work_dir)
- oeqatestcasecreator = OeqaTestCaseCreator()
- testcase_list = oeqatestcasecreator.get_oeqa_testcase_list(work_dir, testcase_remove_source_file)
+ def get_testsuite_testcase_dictionary(self, testcase_dir, testcase_remove_file):
+ print('Getting testsuite testcase information from oeqa directory at %s' % testcase_dir)
+ oeqatestdiscover = OeqaTestDiscover()
+ testcase_list = oeqatestdiscover.get_oeqa_testcase_list(testcase_dir, testcase_remove_file)
testsuite_testcase_dict = {}
for testcase in testcase_list:
testsuite = self._get_testsuite_from_testcase(testcase)
@@ -73,31 +73,32 @@ def main(args):
component_conf = os.path.join(scripts_path, 'conf/testplan_component.conf')
environment_conf = os.path.join(scripts_path, 'conf/testplan_component_environment.conf')
- testplan_creator = TestPlanCreator()
- test_env_matrix = testplan_creator.get_test_environment_multiplication_matrix(args.component, component_conf, environment_conf)
- testsuite_testcase_dict = testplan_creator.get_testsuite_testcase_dictionary(args.oeqa_dir, args.testcase_remove_source_file)
- testmodule_testsuite_dict = testplan_creator.get_testmodule_testsuite_dictionary(testsuite_testcase_dict)
+ testplan = TestPlan()
+ test_env_matrix = testplan.get_test_environment_multiplication_matrix(args.component, component_conf, environment_conf)
+ testsuite_testcase_dict = testplan.get_testsuite_testcase_dictionary(args.case_dir, args.testcase_remove_file)
+ testmodule_testsuite_dict = testplan.get_testmodule_testsuite_dictionary(testsuite_testcase_dict)
for env in test_env_matrix:
env_list = env.split(",")
- testresultstore = TestResultGitStore()
+ testresultstore = GitStore()
testresultstore.create_automated_test_result(args.git_repo, args.git_branch, args.component, env_list, testmodule_testsuite_dict, testsuite_testcase_dict, args.force_create)
def register_commands(subparsers):
"""Register subcommands from this plugin"""
- parser_build = subparsers.add_parser('create', help='Create testplan and test result template',
- description='Create testplan and test result template based on environment configuration inside testresultlog/conf/testplan_component.conf and testresultlog/conf/testplan_component_environment.conf')
+ parser_build = subparsers.add_parser('create-testplan', help='Create testplan template',
+ description='Create testplan and test result template based on environment configuration inside testresultlog/conf/testplan_component.conf and testresultlog/conf/testplan_component_environment.conf',
+ group='testplan')
parser_build.set_defaults(func=main)
+ parser_build.add_argument('component', help='Component to be selected from testresultlog/conf/testplan_component.conf for creation of test environments')
+ parser_build.add_argument('git_branch', help='Git branch to be created for the git repository')
SOURCE = ('runtime', 'selftest', 'sdk', 'sdkext')
- parser_build.add_argument('-s', '--source', required=True, choices=SOURCE,
+ parser_build.add_argument('source', choices=SOURCE,
help='Testcase source to be selected from the list (runtime, selftest, sdk or sdkext). '
'"runtime" will search testcase available in meta/lib/oeqa/runtime/cases. '
'"selftest" will search testcase available in meta/lib/oeqa/selftest/cases. '
'"sdk" will search testcase available in meta/lib/oeqa/sdk/cases. '
'"sdkext" will search testcase available in meta/lib/oeqa/sdkext/cases. ')
- parser_build.add_argument('-d', '--poky_dir', required=False, default='default', help='(Optional) Poky directory to be used for oeqa testcase(s) discovery, default will use current poky directory')
- parser_build.add_argument('-c', '--component', required=True, help='Component to be selected from testresultlog/conf/testplan_component.conf for creation of test environments')
- parser_build.add_argument('-g', '--git_repo', required=False, default='default', help='(Optional) Git repository to be created, default will be <top_dir>/test-result-log-git')
- parser_build.add_argument('-b', '--git_branch', required=True, help='Git branch to be created for the git repository')
- parser_build.add_argument('-m', '--testcase_remove_source_file', required=False, default='', help='(Optional) Testcase remove source file used to define pattern(s) for testcase to be removed')
- parser_build.add_argument('-f', '--force_create', required=False, default='False', help='Force create even when test result files already exist')
+ parser_build.add_argument('-g', '--git_repo', default='default', help='(Optional) Git repository to be created, default will be <top_dir>/test-result-log-git')
+ parser_build.add_argument('-o', '--oe_dir', default='default', help='(Optional) OE top directory to be used for OEQA testcase discovery, default will use current <top_dir> directory')
+ parser_build.add_argument('-m', '--testcase_remove_file', default='default', help='(Optional) Testcase remove source file used to define pattern(s) for testcase to be removed')
+ parser_build.add_argument('-f', '--force_create', action='store_true', help='(Optional) To force create when test result files already exist')
diff --git a/scripts/lib/testresultlog/testresultlogconfigparser.py b/scripts/lib/testresultlog/testplanconfigparser.py
index 7185a909987..a5eb95bbed0 100644
--- a/scripts/lib/testresultlog/testresultlogconfigparser.py
+++ b/scripts/lib/testresultlog/testplanconfigparser.py
@@ -1,6 +1,6 @@
from configparser import ConfigParser
-class TestResultLogConfigParser(object):
+class TestPlanConfigParser(object):
def __init__(self, config):
self.parser = ConfigParser()
diff --git a/scripts/lib/testresultlog/testresultmanualcreator.py b/scripts/lib/testresultlog/testresultmanualcreator.py
deleted file mode 100644
index d0e33723a82..00000000000
--- a/scripts/lib/testresultlog/testresultmanualcreator.py
+++ /dev/null
@@ -1,19 +0,0 @@
-import os
-from testresultlog.testresultgitstore import TestResultGitStore
-
-def main(args):
- if len(args.environment_list) > 0:
- env_list = args.environment_list.split(",")
- testresultstore = TestResultGitStore()
- testresultstore.create_manual_test_result(args.git_repo, args.git_branch, args.component, env_list, args.manual_tests_dir)
-
-def register_commands(subparsers):
- """Register subcommands from this plugin"""
- parser_build = subparsers.add_parser('create_manual', help='Create test result for manual test result files',
- description='Create test result for manual test result files')
- parser_build.set_defaults(func=main)
- parser_build.add_argument('-c', '--component', required=True, help='Component to be selected from conf/testplan_component.conf for creation of test environments')
- parser_build.add_argument('-g', '--git_repo', required=False, default='default', help='(Optional) Git repository to be created, default will be <top_dir>/test-result-log-git')
- parser_build.add_argument('-b', '--git_branch', required=True, help='Git branch to be created for the git repository')
- parser_build.add_argument('-m', '--manual_tests_dir', required=True, help='Directory with manual test result files to be stored')
- parser_build.add_argument('-e', '--environment_list', required=False, default='', help='List of environment to be used to perform update')
diff --git a/scripts/lib/testresultlog/testresultviewer.py b/scripts/lib/testresultlog/view.py
index cd2ec426384..9edd3ec2ae7 100644
--- a/scripts/lib/testresultlog/testresultviewer.py
+++ b/scripts/lib/testresultlog/view.py
@@ -2,9 +2,9 @@ import glob
import os
import json
from jinja2 import Environment, FileSystemLoader
-from testresultlog.testresultgitstore import TestResultGitStore
+from testresultlog.gitstore import GitStore
-class TestResultViewer(object):
+class TestResultView(object):
def _check_if_existing_dir_list_contain_parent_for_new_dir(self, dir_list, new_dir):
for existing_dir in dir_list:
@@ -160,12 +160,12 @@ class TestResultViewer(object):
print('Printing text-based test report:')
print(output)
- def create_text_based_test_report(self, git_repo, show_idle):
+ def create_text_based_test_report(self, git_repo, show_completion):
report_dir_list = self._get_test_report_directory_list(git_repo)
test_result_list = []
for report_dir in report_dir_list:
print('Compiling test result for %s:' % report_dir)
- if show_idle == 'True':
+ if show_completion:
template_file_name = 'test_report_include_idle_full_text.txt'
test_result = self._compile_test_result_include_idle_for_test_report_directory(report_dir)
else:
@@ -181,16 +181,18 @@ class TestResultViewer(object):
self._rendering_text_based_test_report(template_file_name, test_result_list, max_len_component, max_len_environment)
def main(args):
- testresultstore = TestResultGitStore()
- if testresultstore.checkout_git_branch(args.git_repo, args.git_branch):
- testresultviewer = TestResultViewer()
- testresultviewer.create_text_based_test_report(args.git_repo, args.show_idle)
+ gitstore = GitStore()
+ if gitstore.checkout_git_branch(args.git_repo, args.git_branch):
+ testresultview = TestResultView()
+ testresultview.create_text_based_test_report(args.git_repo, args.show_completion)
+ return 0
def register_commands(subparsers):
"""Register subcommands from this plugin"""
parser_build = subparsers.add_parser('view', help='View text-based summary test report',
- description='View text-based summary test report')
+ description='View text-based summary test report',
+ group='view')
parser_build.set_defaults(func=main)
- parser_build.add_argument('-b', '--git_branch', required=True, help='Git branch to be used to compute test summary report')
- parser_build.add_argument('-g', '--git_repo', required=False, default='default', help='(Optional) Git repository to be used to compute the test summary report, default will be <top_dir>/test-result-log.git')
- parser_build.add_argument('-i', '--show_idle', required=False, default='', help='(Optional) Input "True" to show idle test case and its statistic')
+ parser_build.add_argument('git_branch', help='Git branch to be used to compute test summary report')
+ parser_build.add_argument('-g', '--git_repo', default='default', help='(Optional) Full path to the git repository to be used to compute the test summary report, default will be <top_dir>/test-result-log.git')
+ parser_build.add_argument('-i', '--show_completion', action='store_true', help='(Optional) To show completion test case and its statistic')
diff --git a/scripts/test-result-log b/scripts/test-result-log
index 2b9879cf981..a66be0b453e 100755
--- a/scripts/test-result-log
+++ b/scripts/test-result-log
@@ -1,7 +1,12 @@
#!/usr/bin/python3
-#
-# Helper script for storing test result & log data it git repository
-# Then view summary test report
+# As part of the initiative to provide LITE version Test Case Management System
+# with command-line and plain-text files (eg. manual test case file, test plan
+# file to specify list of test case to be executed, test result and log file)
+# to replace Testopia.
+# Test-result-log script was designed as part of the helper script for below purpose:
+# 1. To store test result & log file inside git repository
+# 2. To view text-based test summary report
+# 3. To enable planning of test cases for execution and track its completion
#
import os
import sys
@@ -9,49 +14,81 @@ import argparse
script_path = os.path.dirname(os.path.realpath(__file__))
lib_path = script_path + '/lib'
sys.path = sys.path + [lib_path]
-import testresultlog.testresultcreator
-import testresultlog.testresultupdator
-import testresultlog.testresultviewer
-import testresultlog.testresultmanualcreator
+import argparse_oe
+import testresultlog.testplan
+import testresultlog.storeauto
+import testresultlog.storemanual
+import testresultlog.view
-def _get_default_git_dir(git_dir):
+def _get_git_dir(git_dir):
base_path = script_path + '/..'
if git_dir == 'default':
git_dir = os.path.join(base_path, 'test-result-log.git')
return git_dir
-def _get_oeqa_source_dir(poky_dir, source):
+def _get_oe_dir(oe_dir):
+ base_path = script_path + '/..'
+ if oe_dir == 'default':
+ oe_dir = base_path
+ return oe_dir
+
+def _get_oeqa_case_dir(oe_dir, source):
if source == 'runtime':
- oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/runtime/cases')
+ case_dir = os.path.join(oe_dir, 'meta/lib/oeqa/runtime/cases')
elif source == 'selftest':
- oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/selftest/cases')
+ case_dir = os.path.join(oe_dir, 'meta/lib/oeqa/selftest/cases')
elif source == 'sdk':
- oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/sdk/cases')
+ case_dir = os.path.join(oe_dir, 'meta/lib/oeqa/sdk/cases')
else:
- oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/sdkext/cases')
- return oeqa_dir
+ case_dir = os.path.join(oe_dir, 'meta/lib/oeqa/sdkext/cases')
+ return case_dir
-def _get_poky_dir(poky_dir):
- base_path = script_path + '/..'
- if poky_dir == 'default':
- poky_dir = base_path
- return poky_dir
+def _get_default_attribute_value(attribute_value):
+ if attribute_value == 'default':
+ attribute_value = ''
+ return attribute_value
+
+def _set_args_attribute_default_value(args):
+ if getattr(args, "environment_list", False):
+ print('Found environment_list attribute')
+ args.environment_list = _get_default_attribute_value(args.environment_list)
+ if getattr(args, "git_remote", False):
+ print('Found git_remote attribute')
+ args.git_remote = _get_default_attribute_value(args.git_remote)
+ if getattr(args, "testcase_remove_file", False):
+ print('Found testcase_remove_file attribute')
+ args.testcase_remove_file = _get_default_attribute_value(args.testcase_remove_file)
def main():
- parser = argparse.ArgumentParser(description="test-result-log script to store test status and failure log then view summary test report.")
- subparser = parser.add_subparsers()
- testresultlog.testresultcreator.register_commands(subparser)
- testresultlog.testresultupdator.register_commands(subparser)
- testresultlog.testresultviewer.register_commands(subparser)
- testresultlog.testresultmanualcreator.register_commands(subparser)
+ parser = argparse_oe.ArgumentParser(description="OpenEmbedded testcase management tool, to store test result then to view test summary report.",
+ add_help=False,
+ epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
+ parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS,
+ help='show this help message and exit')
+ subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>')
+ subparsers.required = True
+ subparsers.add_subparser_group('store', 'Store test result', 100)
+ subparsers.add_subparser_group('view', 'Analyze test result', -1)
+ subparsers.add_subparser_group('testplan', 'Plan test', 1000)
+ testresultlog.storeauto.register_commands(subparsers)
+ testresultlog.storemanual.register_commands(subparsers)
+ testresultlog.view.register_commands(subparsers)
+ testresultlog.testplan.register_commands(subparsers)
args = parser.parse_args()
- args.script_path = script_path
- args.git_repo = _get_default_git_dir(args.git_repo)
- poky_dir = getattr(args,"poky_dir",None)
- if poky_dir:
- args.poky_dir = _get_poky_dir(args.poky_dir)
- args.oeqa_dir = _get_oeqa_source_dir(args.poky_dir, args.source)
- args.func(args)
+ if getattr(args, "git_repo", False):
+ print('Found git_repo attribute')
+ args.git_repo = _get_git_dir(args.git_repo)
+ if getattr(args, "oe_dir", False):
+ print('Found oe_dir attribute')
+ args.oe_dir = _get_oe_dir(args.oe_dir)
+ args.case_dir = _get_oeqa_case_dir(args.oe_dir, args.source)
+ _set_args_attribute_default_value(args)
+
+ try:
+ ret = args.func(args)
+ except argparse_oe.ArgumentUsageError as ae:
+ parser.error_subcommand(ae.message, ae.subcommand)
+ return ret
if __name__ == "__main__":
sys.exit(main())