From f0ca8be39d8102e7d779a31fae510f8ee94ee431 Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Mon, 17 May 2021 15:11:34 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91studio=20?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=B7=A5=E7=A8=8B=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/building.py | 3 ++- tools/menuconfig.py | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tools/building.py b/tools/building.py index 90554a3082..bfdd1ff55a 100644 --- a/tools/building.py +++ b/tools/building.py @@ -448,7 +448,8 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ duplicate=0, exports='remove_components')) # include testcases - objs.extend(SConscript(Rtt_Root + '/examples/utest/testcases/SConscript', + if os.path.isfile(os.path.join(Rtt_Root, 'examples/utest/testcases/SConscript')): + objs.extend(SConscript(Rtt_Root + '/examples/utest/testcases/SConscript', variant_dir=kernel_vdir + '/examples/utest/testcases', duplicate=0)) diff --git a/tools/menuconfig.py b/tools/menuconfig.py index c0a33718de..853e4fe7f8 100644 --- a/tools/menuconfig.py +++ b/tools/menuconfig.py @@ -217,8 +217,27 @@ def touch_env(): if os.path.exists(os.path.join(env_dir, 'tools', 'scripts')): os.environ["PATH"] = os.path.join(env_dir, 'tools', 'scripts') + ';' + os.environ["PATH"] +# Exclude utestcases +def exclude_utestcases(RTT_ROOT): + if os.path.isfile(os.path.join(RTT_ROOT, 'examples/utest/testcases/Kconfig')): + return + + if not os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig')): + return + + with open(os.path.join(RTT_ROOT, 'Kconfig'), 'r') as f: + data = f.readlines() + with open(os.path.join(RTT_ROOT, 'Kconfig'), 'w') as f: + for line in data: + if line.find('examples/utest/testcases/Kconfig') == -1: + f.write(line) + # menuconfig for Linux def menuconfig(RTT_ROOT): + + # Exclude utestcases + exclude_utestcases(RTT_ROOT) + kconfig_dir = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends') os.system('scons -C ' + kconfig_dir) @@ -250,6 +269,9 @@ def menuconfig(RTT_ROOT): def guiconfig(RTT_ROOT): import pyguiconfig + # Exclude utestcases + exclude_utestcases(RTT_ROOT) + if sys.platform != 'win32': touch_env() @@ -260,7 +282,7 @@ def guiconfig(RTT_ROOT): fn = '.config' fn_old = '.config.old' - sys.argv = ['guiconfig', 'Kconfig']; + sys.argv = ['guiconfig', 'Kconfig'] pyguiconfig._main() if os.path.isfile(fn): @@ -281,6 +303,9 @@ def guiconfig(RTT_ROOT): def guiconfig_silent(RTT_ROOT): import defconfig + # Exclude utestcases + exclude_utestcases(RTT_ROOT) + if sys.platform != 'win32': touch_env()