Merge pull request #4687 from Guozhanxin/utest

[fix] Fix the problem of an error when opening menuconfig after the p…
This commit is contained in:
Bernard Xiong 2021-05-14 20:31:12 +08:00 committed by GitHub
commit 19db57cde4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -105,6 +105,18 @@ def bsp_update_sconstruct(dist_dir):
f.write('if not os.getenv("RTT_ROOT"): \n RTT_ROOT="rt-thread"\n\n') f.write('if not os.getenv("RTT_ROOT"): \n RTT_ROOT="rt-thread"\n\n')
f.write(line) f.write(line)
def bsp_update_kconfig_testcases(dist_dir):
# delete testcases in rt-thread/Kconfig
if not os.path.isfile(os.path.join(dist_dir, 'rt-thread/Kconfig')):
return
with open(os.path.join(dist_dir, 'rt-thread/Kconfig'), 'r') as f:
data = f.readlines()
with open(os.path.join(dist_dir, 'rt-thread/Kconfig'), 'w') as f:
for line in data:
if line.find('examples/utest/testcases/Kconfig') == -1:
f.write(line)
def bsp_update_kconfig(dist_dir): def bsp_update_kconfig(dist_dir):
# change RTT_ROOT in Kconfig # change RTT_ROOT in Kconfig
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')): if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
@ -307,11 +319,14 @@ def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env):
do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'Kconfig'), os.path.join(target_path, 'libcpu', 'Kconfig')) do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'Kconfig'), os.path.join(target_path, 'libcpu', 'Kconfig'))
do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'SConscript'), os.path.join(target_path, 'libcpu', 'SConscript')) do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'SConscript'), os.path.join(target_path, 'libcpu', 'SConscript'))
print('Update configuration files...')
# change RTT_ROOT in SConstruct # change RTT_ROOT in SConstruct
bsp_update_sconstruct(dist_dir) bsp_update_sconstruct(dist_dir)
# change RTT_ROOT in Kconfig # change RTT_ROOT in Kconfig
bsp_update_kconfig(dist_dir) bsp_update_kconfig(dist_dir)
bsp_update_kconfig_library(dist_dir) bsp_update_kconfig_library(dist_dir)
# delete testcases in Kconfig
bsp_update_kconfig_testcases(dist_dir)
# update all project files # update all project files
bs_update_ide_project(dist_dir, target_path) bs_update_ide_project(dist_dir, target_path)
@ -374,12 +389,14 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env, rttide = None):
do_copy_file(os.path.join(RTT_ROOT, 'README.md'), os.path.join(target_path, 'README.md')) do_copy_file(os.path.join(RTT_ROOT, 'README.md'), os.path.join(target_path, 'README.md'))
do_copy_file(os.path.join(RTT_ROOT, 'README_zh.md'), os.path.join(target_path, 'README_zh.md')) do_copy_file(os.path.join(RTT_ROOT, 'README_zh.md'), os.path.join(target_path, 'README_zh.md'))
print('Update configuration files...')
# change RTT_ROOT in SConstruct # change RTT_ROOT in SConstruct
bsp_update_sconstruct(dist_dir) bsp_update_sconstruct(dist_dir)
# change RTT_ROOT in Kconfig # change RTT_ROOT in Kconfig
bsp_update_kconfig(dist_dir) bsp_update_kconfig(dist_dir)
bsp_update_kconfig_library(dist_dir) bsp_update_kconfig_library(dist_dir)
# delete testcases in Kconfig
bsp_update_kconfig_testcases(dist_dir)
# update all project files # update all project files
if rttide == None: if rttide == None:
bs_update_ide_project(dist_dir, target_path) bs_update_ide_project(dist_dir, target_path)