summaryrefslogtreecommitdiffstats
path: root/scripts/lib/resulttool/manualexecution.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/resulttool/manualexecution.py')
-rwxr-xr-xscripts/lib/resulttool/manualexecution.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/scripts/lib/resulttool/manualexecution.py b/scripts/lib/resulttool/manualexecution.py
index ecdc4e7a7a..a44cc86190 100755
--- a/scripts/lib/resulttool/manualexecution.py
+++ b/scripts/lib/resulttool/manualexecution.py
@@ -19,6 +19,7 @@ import datetime
19import re 19import re
20from oeqa.core.runner import OETestResultJSONHelper 20from oeqa.core.runner import OETestResultJSONHelper
21 21
22
22def load_json_file(file): 23def load_json_file(file):
23 with open(file, "r") as f: 24 with open(file, "r") as f:
24 return json.load(f) 25 return json.load(f)
@@ -46,31 +47,34 @@ class ManualTestRunner(object):
46 def _get_input(self, config): 47 def _get_input(self, config):
47 while True: 48 while True:
48 output = input('{} = '.format(config)) 49 output = input('{} = '.format(config))
49 if re.match('^[a-zA-Z0-9_]+$', output): 50 if re.match('^[a-zA-Z0-9_-]+$', output):
50 break 51 break
51 print('Only alphanumeric and underscore are allowed. Please try again') 52 print('Only alphanumeric and underscore/hyphen are allowed. Please try again')
52 return output 53 return output
53 54
54 def _create_config(self): 55 def _create_config(self):
56 from oeqa.utils.metadata import get_layers
57 from oeqa.utils.commands import get_bb_var
58 from resulttool.resultutils import store_map
59
60 layers = get_layers(get_bb_var('BBLAYERS'))
55 self.configuration = {} 61 self.configuration = {}
56 while True: 62 self.configuration['LAYERS'] = layers
57 try: 63 current_datetime = datetime.datetime.now()
58 conf_total = int(input('\nPlease provide how many configuration you want to save \n')) 64 self.starttime = current_datetime.strftime('%Y%m%d%H%M%S')
59 break 65 self.configuration['STARTTIME'] = self.starttime
60 except ValueError: 66 self.configuration['TEST_TYPE'] = 'manual'
61 print('Invalid input. Please provide input as a number not character.') 67 self.configuration['TEST_MODULE'] = self.test_module
62 for i in range(conf_total): 68
69 extra_config = set(store_map['manual']) - set(self.configuration)
70 for config in sorted(extra_config):
63 print('---------------------------------------------') 71 print('---------------------------------------------')
64 print('This is configuration #%s ' % (i + 1) + '. Please provide configuration name and its value') 72 print('This is configuration #%s. Please provide configuration value(use "None" if not applicable).'
73 % config)
65 print('---------------------------------------------') 74 print('---------------------------------------------')
66 name_conf = self._get_input('Configuration Name')
67 value_conf = self._get_input('Configuration Value') 75 value_conf = self._get_input('Configuration Value')
68 print('---------------------------------------------\n') 76 print('---------------------------------------------\n')
69 self.configuration[name_conf.upper()] = value_conf 77 self.configuration[config] = value_conf
70 current_datetime = datetime.datetime.now()
71 self.starttime = current_datetime.strftime('%Y%m%d%H%M%S')
72 self.configuration['STARTTIME'] = self.starttime
73 self.configuration['TEST_TYPE'] = self.test_module
74 78
75 def _create_result_id(self): 79 def _create_result_id(self):
76 self.result_id = 'manual_' + self.test_module + '_' + self.starttime 80 self.result_id = 'manual_' + self.test_module + '_' + self.starttime