mirror of
https://gitee.com/openharmony/testfwk_xdevice
synced 2025-02-15 15:58:59 +00:00
Update 补丁标签抽出为单独的用例
Signed-off-by: zhangjingyu <zhangjingyu20@huawei.com>
This commit is contained in:
parent
deb08ec01f
commit
b088d1e1ed
@ -943,9 +943,9 @@ class OHYaraTestDriver(IDriver):
|
|||||||
if "fail" in self.system_version:
|
if "fail" in self.system_version:
|
||||||
self._get_full_name_by_tool_hap()
|
self._get_full_name_by_tool_hap()
|
||||||
|
|
||||||
vul_info_file = get_config_value('vul-info-file',json_config.get_driver(), False)
|
vul_info_file = get_config_value('vul-info-file', json_config.get_driver(), False)
|
||||||
# Extract patch labels into separate testcase
|
# Extract patch labels into separate testcase
|
||||||
if vul_info_file== "vul_info_patch_label_test":
|
if vul_info_file == "vul_info_patch_label_test":
|
||||||
vul_items = list()
|
vul_items = list()
|
||||||
item = VulItem()
|
item = VulItem()
|
||||||
item.vul_id = "Patch-label-test"
|
item.vul_id = "Patch-label-test"
|
||||||
@ -979,7 +979,7 @@ class OHYaraTestDriver(IDriver):
|
|||||||
vul_version = ".".join(vul_version_list)
|
vul_version = ".".join(vul_version_list)
|
||||||
if vul_version is None:
|
if vul_version is None:
|
||||||
LOG.debug("The system version is not in the maintenance scope, skip it. "
|
LOG.debug("The system version is not in the maintenance scope, skip it. "
|
||||||
"system versions is {}".format(self.system_version))
|
"system versions is {}".format(self.system_version))
|
||||||
else:
|
else:
|
||||||
for _, item in enumerate(vul_items):
|
for _, item in enumerate(vul_items):
|
||||||
LOG.debug("Affected files: {}".format(item.affected_files))
|
LOG.debug("Affected files: {}".format(item.affected_files))
|
||||||
@ -992,12 +992,12 @@ class OHYaraTestDriver(IDriver):
|
|||||||
break
|
break
|
||||||
if not has_inter:
|
if not has_inter:
|
||||||
LOG.debug("Yara rule [{}] affected versions has no intersection "
|
LOG.debug("Yara rule [{}] affected versions has no intersection "
|
||||||
"in mapping version, skip it. Mapping version is {}, "
|
"in mapping version, skip it. Mapping version is {}, "
|
||||||
"affected versions is {}".format(item.vul_id, vul_version,
|
"affected versions is {}".format(item.vul_id, vul_version,
|
||||||
item.affected_versions))
|
item.affected_versions))
|
||||||
continue
|
continue
|
||||||
local_path = os.path.join(request.config.report_path, OHYaraConfig.AFFECTED_FILES.value,
|
local_path = os.path.join(request.config.report_path, OHYaraConfig.AFFECTED_FILES.value,
|
||||||
request.get_module_name(), item.yara_rules[index].split('.')[0])
|
request.get_module_name(), item.yara_rules[index].split('.')[0])
|
||||||
if not os.path.exists(local_path):
|
if not os.path.exists(local_path):
|
||||||
os.makedirs(local_path)
|
os.makedirs(local_path)
|
||||||
if item.object_type == "kernel_linux":
|
if item.object_type == "kernel_linux":
|
||||||
@ -1045,7 +1045,7 @@ class OHYaraTestDriver(IDriver):
|
|||||||
# if no risk delete files, if rule has risk keep it
|
# if no risk delete files, if rule has risk keep it
|
||||||
if item.final_risk != OHYaraConfig.FAIL.value:
|
if item.final_risk != OHYaraConfig.FAIL.value:
|
||||||
local_path = os.path.join(request.config.report_path, OHYaraConfig.AFFECTED_FILES.value,
|
local_path = os.path.join(request.config.report_path, OHYaraConfig.AFFECTED_FILES.value,
|
||||||
request.get_module_name(), item.yara_rules[index].split('.')[0])
|
request.get_module_name(), item.yara_rules[index].split('.')[0])
|
||||||
if os.path.exists(local_path):
|
if os.path.exists(local_path):
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
"Yara rule [{}] has no risk, remove affected files.".format(
|
"Yara rule [{}] has no risk, remove affected files.".format(
|
||||||
@ -1168,8 +1168,6 @@ class OHYaraTestDriver(IDriver):
|
|||||||
LOG.error("An error occurred when pasing the kernel file.")
|
LOG.error("An error occurred when pasing the kernel file.")
|
||||||
return None
|
return None
|
||||||
return output_file
|
return output_file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _get_vul_items(self):
|
def _get_vul_items(self):
|
||||||
vul_items = list()
|
vul_items = list()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user