fix(ci): scan_test missing build apps without tests

This commit is contained in:
Fu Hanxi 2021-01-25 15:00:29 +08:00
parent f7a8593a3b
commit be3d74efb2

View File

@ -126,34 +126,33 @@ def main():
scan_info_dict = defaultdict(dict) scan_info_dict = defaultdict(dict)
# store the test cases dir, exclude these folders when scan for standalone apps # store the test cases dir, exclude these folders when scan for standalone apps
default_exclude = args.exclude if args.exclude else [] default_exclude = args.exclude if args.exclude else []
exclude_apps = deepcopy(default_exclude)
build_system = args.build_system.lower() build_system = args.build_system.lower()
build_system_class = BUILD_SYSTEMS[build_system] build_system_class = BUILD_SYSTEMS[build_system]
if build_test_case_apps: for target in SUPPORTED_TARGETS:
for target in SUPPORTED_TARGETS: exclude_apps = deepcopy(default_exclude)
target_dict = scan_info_dict[target]
test_case_apps = target_dict['test_case_apps'] = set() if build_test_case_apps:
scan_info_dict[target]['test_case_apps'] = set()
for case in test_cases: for case in test_cases:
app_dir = case.case_info['app_dir'] app_dir = case.case_info['app_dir']
app_target = case.case_info['target'] app_target = case.case_info['target']
if app_target.lower() != target.lower(): if app_target.lower() != target.lower():
continue continue
test_case_apps.update(find_apps(build_system_class, app_dir, True, default_exclude, target.lower())) _apps = find_apps(build_system_class, app_dir, True, exclude_apps, target.lower())
exclude_apps.append(app_dir) if _apps:
else: scan_info_dict[target]['test_case_apps'].update(_apps)
for target in SUPPORTED_TARGETS: exclude_apps.append(app_dir)
else:
scan_info_dict[target]['test_case_apps'] = set() scan_info_dict[target]['test_case_apps'] = set()
if build_standalone_apps: if build_standalone_apps:
for target in SUPPORTED_TARGETS: scan_info_dict[target]['standalone_apps'] = set()
target_dict = scan_info_dict[target]
standalone_apps = target_dict['standalone_apps'] = set()
for path in paths: for path in paths:
standalone_apps.update(find_apps(build_system_class, path, True, exclude_apps, target.lower())) scan_info_dict[target]['standalone_apps'].update(
else: find_apps(build_system_class, path, True, exclude_apps, target.lower()))
for target in SUPPORTED_TARGETS: else:
scan_info_dict[target]['standalone_apps'] = set() scan_info_dict[target]['standalone_apps'] = set()
test_case_apps_preserve_default = True if build_system == 'cmake' else False test_case_apps_preserve_default = True if build_system == 'cmake' else False