summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChen Wang <[email protected]>2025-07-24 16:47:09 +0800
committerR b b666 <[email protected]>2025-08-26 10:26:47 +0800
commit06c5cc0846980b7d0842d348e3615e8997975249 (patch)
treebbee92c0139dda255f94d0dfed42d87b4f00b22c /tools
parent1892b27a45cf39794fef91dcdc2d3bae08957112 (diff)
utest: move entry from examples to utest
Change the entry of utest's Kconfig from 'examples/utest/testcases/Kconfig' to 'Kconfig.utestcases'. Modified the build scripts where the path name is "examples/utest/testcases/Kconfig" and changed it to 'Kconfig.utestcases', otherwise build operations such 'scons --dist' may fail. In the future, the testcase source code of utest will be placed in each module for maintenance, but the entry of Kconfig will all be placed in Kconfig.utestcases for unified maintenance. In this way, when executing menuconfig, people can enter and configure from one place, avoiding searching for utest configuration switches here and there in the menuconfig interface. For each module, you can maintain unit-test in a unified manner in the following way: - Create a subdirectory named 'utest' in the directory where your module is located. - Store the following files in the utest subdirectory: - Unit test case program source code files for this module. - Kconfig file, add configuration options for the unit test files of this module, the recommended option is named RT_UTEST_TC_USING_XXXX, XXXX is the global unique module name of this module. - SConscript file, note that when adding src files, in addition to relying on RT_UTEST_TC_USING_XXXX, you must also rely on RT_UTEST_USING_ALL_CASES, the two dependencies are in an "or" relationship. The role of RT_UTEST_USING_ALL_CASES is that once this option is turned on, all unit tests will be enabled to avoid selecting one by one. After completing the above steps, add the path of the Kconfig file of utest of this module to the Kconfig.utestcases file. Signed-off-by: Chen Wang <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/env_utility.py4
-rw-r--r--tools/mkdist.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/env_utility.py b/tools/env_utility.py
index d950d07733..d7904ff005 100644
--- a/tools/env_utility.py
+++ b/tools/env_utility.py
@@ -327,7 +327,7 @@ def get_file_md5(file):
# Exclude utestcases
def exclude_utestcases(RTT_ROOT):
- if os.path.isfile(os.path.join(RTT_ROOT, 'examples/utest/testcases/Kconfig')):
+ if os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig.utestcases')):
return
if not os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig')):
@@ -337,7 +337,7 @@ def exclude_utestcases(RTT_ROOT):
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:
+ if line.find('Kconfig.utestcases') == -1:
f.write(line)
diff --git a/tools/mkdist.py b/tools/mkdist.py
index 89665719d5..838ae15ad5 100644
--- a/tools/mkdist.py
+++ b/tools/mkdist.py
@@ -118,7 +118,7 @@ def bsp_update_kconfig_testcases(dist_dir):
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:
+ if line.find('Kconfig.utestcases') == -1:
f.write(line)
def bsp_update_kconfig(dist_dir):