mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
acrn-config: use ordered dictionary to guarantee dict order
For python versions prior to 3.7, dict order is not guaranteed. Use ordered dict to ensure consistent ordering for the same input, otherwise, the generated config files may change every time the config tool runs Fix some error messages in code/comment Tracked-On: #5229 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
This commit is contained in:
parent
0882f92457
commit
530703e85c
@ -63,7 +63,7 @@ def main(args):
|
||||
# check if this is the scenario config which matched board info
|
||||
(err_dic, status) = common.is_config_file_match()
|
||||
if not status:
|
||||
err_dic['board config: Not match'] = "The board xml and scenario xml should be matched"
|
||||
err_dic['board config'] = "The board xml file does not match scenario xml file!"
|
||||
return err_dic
|
||||
|
||||
output = ''
|
||||
|
@ -365,12 +365,12 @@ class Bar_Attr:
|
||||
|
||||
class Pci_Dev_Bar_Desc:
|
||||
def __init__(self):
|
||||
self.pci_dev_dic = {}
|
||||
self.pci_bar_dic = {}
|
||||
self.shm_bar_dic = {}
|
||||
self.pci_dev_dic = collections.OrderedDict()
|
||||
self.pci_bar_dic = collections.OrderedDict()
|
||||
self.shm_bar_dic = collections.OrderedDict()
|
||||
|
||||
PCI_DEV_BAR_DESC = Pci_Dev_Bar_Desc()
|
||||
SUB_NAME_COUNT = {}
|
||||
SUB_NAME_COUNT = collections.OrderedDict()
|
||||
|
||||
|
||||
def get_value_after_str(line, key):
|
||||
@ -471,7 +471,8 @@ def parser_pci():
|
||||
tmp_bar_dic = {}
|
||||
|
||||
# output all the pci device list to pci_device.h
|
||||
SUB_NAME_COUNT = collections.Counter(cal_sub_pci_name)
|
||||
for item in cal_sub_pci_name:
|
||||
SUB_NAME_COUNT[item] = SUB_NAME_COUNT.get(item, 0) + 1
|
||||
|
||||
if tmp_bar_dic:
|
||||
PCI_DEV_BAR_DESC.pci_bar_dic[cur_bdf] = tmp_bar_dic
|
||||
|
@ -126,7 +126,7 @@ def get_param(args):
|
||||
return (err_dic, params)
|
||||
|
||||
if not os.path.exists(par_v):
|
||||
err_dic['wrong usage'] = "{} is not exist!".format(par_v)
|
||||
err_dic['wrong usage'] = "{} does not exist!".format(par_v)
|
||||
return (err_dic, params)
|
||||
|
||||
return (err_dic, params)
|
||||
|
@ -84,7 +84,7 @@ def get_param(args):
|
||||
|
||||
if arg_str not in args:
|
||||
usage(args[0])
|
||||
err_dic['common error: get wrong parameter'] = "wrong usage"
|
||||
err_dic['common error: wrong parameter'] = "wrong usage"
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), output_folder)
|
||||
|
||||
args_list = args[1:]
|
||||
@ -102,24 +102,24 @@ def get_param(args):
|
||||
if arg_k == '--uosid':
|
||||
vm_th = arg_v
|
||||
if not vm_th.isnumeric():
|
||||
err_dic['common error: get wrong parameter'] = "--uosid should be a number"
|
||||
err_dic['common error: wrong parameter'] = "--uosid should be a number"
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), output_folder)
|
||||
|
||||
if not board_info_file or not scenario_info_file or not launch_info_file:
|
||||
usage(args[0])
|
||||
err_dic['common error: get wrong parameter'] = "wrong usage"
|
||||
err_dic['common error: wrong parameter'] = "wrong usage"
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), output_folder)
|
||||
|
||||
if not os.path.exists(board_info_file):
|
||||
err_dic['common error: get wrong parameter'] = "{} is not exist!".format(board_info_file)
|
||||
err_dic['common error: wrong parameter'] = "{} does not exist!".format(board_info_file)
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), output_folder)
|
||||
|
||||
if not os.path.exists(scenario_info_file):
|
||||
err_dic['common error: get wrong parameter'] = "{} is not exist!".format(scenario_info_file)
|
||||
err_dic['common error: wrong parameter'] = "{} does not exist!".format(scenario_info_file)
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), output_folder)
|
||||
|
||||
if not os.path.exists(launch_info_file):
|
||||
err_dic['common error: get wrong parameter'] = "{} is not exist!".format(launch_info_file)
|
||||
err_dic['common error: wrong parameter'] = "{} does not exist!".format(launch_info_file)
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), output_folder)
|
||||
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), output_folder)
|
||||
@ -190,13 +190,13 @@ def is_config_file_match():
|
||||
(err_dic, scenario_for_board) = common.get_xml_attrib(common.SCENARIO_INFO_FILE, "board")
|
||||
(err_dic, board_name) = common.get_xml_attrib(common.BOARD_INFO_FILE, "board")
|
||||
if scenario_for_board != board_name:
|
||||
err_dic['scenario config: Not match'] = "The board xml and scenario xml should be matched!"
|
||||
err_dic['scenario config'] = "The board xml file does not match scenario xml file!"
|
||||
match = False
|
||||
|
||||
# check if the board config match launch config
|
||||
(err_dic, launch_for_board) = common.get_xml_attrib(common.LAUNCH_INFO_FILE, "board")
|
||||
if launch_for_board != board_name:
|
||||
err_dic['launch config: Not match'] = "The board xml and launch xml should be matched!"
|
||||
err_dic['launch config'] = "The board xml file does not match scenario xml file!"
|
||||
match = False
|
||||
|
||||
return (err_dic, match)
|
||||
|
Loading…
Reference in New Issue
Block a user