代码拉取完成,页面将自动刷新
同步操作将从 openEuler/mugen 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright (c) [2023] Huawei Technologies Co.,Ltd.ALL rights reserved.
This program is licensed under Mulan PSL v2.
You can use it according to the terms and conditions of the Mulan PSL v2.
http://license.coscl.org.cn/MulanPSL2
THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
@Author : saarloos
@email : 9090-90-90-9090@163.com
@Date : 2023-02-06 14:09:36
@License : Mulan PSL v2
@Version : 1.0
@Desc : 检查mugen测试套,测试名称是否重复(不区分大小写)
"""
import os
import sys
import json
suitecase_path = "suite2cases"
curr_path = os.getcwd()
def check_testsuite():
suitecase_list = os.listdir(os.path.join(curr_path, suitecase_path))
suitecase_set = {}
repeat_list = []
for one_suite in suitecase_list:
lower_name = one_suite.lower()
if lower_name not in suitecase_set:
suitecase_set[lower_name] = 1
else:
repeat_list.append(one_suite)
print("%s/%s had repeat from other suitecase name ignore case"%(curr_path, one_suite))
return len(repeat_list)
def find_case(case_name, check_path):
find_path = []
if not os.path.exists(check_path):
return [-1]
all_files = os.listdir(check_path)
for one_file in all_files:
file_name = os.path.splitext(one_file)[0]
if os.path.isdir(os.path.join(check_path, one_file)):
find_path.extend(find_case(case_name, os.path.join(check_path, one_file)))
else:
if case_name.lower() == file_name.lower():
find_path.append(os.path.join(check_path, one_file))
return find_path
def check_one_suite(cases_names, case_path, suitename):
repeat_case = []
for one_case in cases_names:
get_path = find_case(one_case["name"], case_path)
if len(get_path) > 1:
repeat_case.append(one_case)
print("testsuite %s path has repeat case:"%suitename)
for one_path in get_path:
print("\trepeat patch name:%s"%one_path)
return repeat_case
def check_testcase():
suitecase_list = os.listdir(os.path.join(curr_path, suitecase_path))
ret = 0
for one_suite in suitecase_list:
if not os.path.isfile(os.path.join(curr_path, suitecase_path, one_suite)):
# 处理路径是目录的情况
continue
with open(os.path.join(curr_path, suitecase_path, one_suite), "r") as f:
case_info = json.load(f)
case_path = os.path.join(curr_path, "/".join(case_info["path"].split("/")[1:]))
cases_names = case_info["cases"]
if len(check_one_suite(cases_names, case_path, one_suite)) > 0:
ret = 1
return ret
def main():
suite_ret = check_testsuite()
case_ret = check_testcase()
return suite_ret + case_ret
if __name__ == "__main__":
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。