mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-07 00:59:00 +08:00
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into nuvoton
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
name: AutoTestCI
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.legs.UTEST }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
legs:
|
||||
- {UTEST: "kernel/ipc", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "vexpress-a9", CONFIG_FILE: "examples/utest/configs/utest_self/config.h"}
|
||||
- {UTEST: "components/utest", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "vexpress-a9", CONFIG_FILE: "examples/utest/configs/utest_self/config.h"}
|
||||
|
||||
env:
|
||||
TEST_BSP_ROOT: ${{ matrix.legs.RTT_BSP }}
|
||||
TEST_CONFIG_FILE: ${{ matrix.legs.CONFIG_FILE }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Prepare env
|
||||
run: |
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get -yqq install scons qemu-system-arm git
|
||||
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/arm-2017q2-v6/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
|
||||
sudo tar xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -C /opt
|
||||
- name: Build bsp
|
||||
run: |
|
||||
export RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin
|
||||
/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc --version
|
||||
cp $TEST_CONFIG_FILE $TEST_BSP_ROOT/rtconfig.h
|
||||
scons -j$(nproc) -C $TEST_BSP_ROOT
|
||||
- name: Start test
|
||||
run: |
|
||||
git clone https://github.com/armink/UtestRunner.git
|
||||
pushd $TEST_BSP_ROOT
|
||||
dd if=/dev/zero of=sd.bin bs=1024 count=65536
|
||||
popd
|
||||
pushd UtestRunner
|
||||
python3 qemu_runner.py --elf ../$TEST_BSP_ROOT/rtthread.elf --sd ../$TEST_BSP_ROOT/sd.bin
|
||||
cat rtt_console.log
|
||||
popd
|
||||
@@ -1,3 +1,4 @@
|
||||
source "$RTT_DIR/src/Kconfig"
|
||||
source "$RTT_DIR/libcpu/Kconfig"
|
||||
source "$RTT_DIR/components/Kconfig"
|
||||
source "$RTT_DIR/examples/utest/testcases/Kconfig"
|
||||
|
||||
@@ -41,7 +41,6 @@ Support GCC, MDK5, IAR IDE/compilers. More information of these compiler version
|
||||
|
||||
Notice:
|
||||
(1) Please install Nu-Link_Keil_Driver or Nu-Link_IAR_Driver for development.
|
||||
(2) You must remove '--c99' flag in <path/to/rtt>/components/drivers/spi/SConscript before generating MDK5 project file.
|
||||
|
||||
## 3. Program firmware
|
||||
### Step 1:
|
||||
|
||||
@@ -15,7 +15,7 @@ if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = r'C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q1-update\bin'
|
||||
elif CROSS_TOOL == 'keil':
|
||||
PLATFORM = 'armcc'
|
||||
PLATFORM = 'armclang'
|
||||
EXEC_PATH = r'C:\Keil_v5'
|
||||
elif CROSS_TOOL == 'iar':
|
||||
PLATFORM = 'iar'
|
||||
@@ -56,9 +56,9 @@ if PLATFORM == 'gcc':
|
||||
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
||||
|
||||
elif PLATFORM == 'armcc':
|
||||
elif PLATFORM == 'armclang':
|
||||
# toolchains
|
||||
CC = 'armcc'
|
||||
CC = 'armclang'
|
||||
AS = 'armasm'
|
||||
AR = 'armar'
|
||||
LINK = 'armlink'
|
||||
|
||||
+178
-22
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@ QEMU/VExpress A9是QEMU模拟器针对ARM VExpress-A9 FPGA开发板进行软件
|
||||
|
||||
## 3. 执行
|
||||
|
||||
当要执行编译好的RT-Thread时,在这个bsp目录下已经提供了运行脚本文件:qemu.bat/qemu.sh
|
||||
当要执行编译好的RT-Thread时,在这个bsp目录下已经提供了运行脚本文件:qemu.bat和qemu.sh。可以在bsp目录下运行env,在env中敲入qemu.bat即可直接运行。
|
||||
|
||||
这个执行脚本默认把串口输出到stdio(即控制台)上,所以直接执行脚本后就可以输出结果了。
|
||||
|
||||
@@ -99,7 +99,7 @@ start qemu-system-arm -M vexpress-a9 -kernel rtthread.elf -serial stdio -sd sd.b
|
||||
|
||||
维护人:[bernard][4]
|
||||
|
||||
[1]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html
|
||||
[2]: https://www.rt-thread.org/page/download.html
|
||||
[3]: https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
|
||||
[4]: https://github.com/BernardXiong
|
||||
[1]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html
|
||||
[2]: https://www.rt-thread.org/page/download.html
|
||||
[3]: https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
|
||||
[4]: https://github.com/BernardXiong
|
||||
@@ -21,6 +21,9 @@
|
||||
#define RT_USING_TIMER_SOFT
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 1024
|
||||
|
||||
/* kservice optimization */
|
||||
|
||||
#define RT_DEBUG
|
||||
#define RT_DEBUG_COLOR
|
||||
|
||||
@@ -49,7 +52,7 @@
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 256
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||
#define RT_VER_NUM 0x40002
|
||||
#define RT_VER_NUM 0x40004
|
||||
#define ARCH_ARM
|
||||
#define ARCH_ARM_CORTEX_A
|
||||
#define ARCH_ARM_CORTEX_A9
|
||||
@@ -84,9 +87,9 @@
|
||||
|
||||
#define RT_USING_DFS
|
||||
#define DFS_USING_WORKDIR
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 8
|
||||
#define DFS_FD_MAX 16
|
||||
#define DFS_FD_MAX 32
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
|
||||
/* elm-chan's FatFs, Generic FAT Filesystem Module */
|
||||
@@ -95,6 +98,8 @@
|
||||
#define RT_DFS_ELM_WORD_ACCESS
|
||||
#define RT_DFS_ELM_USE_LFN_3
|
||||
#define RT_DFS_ELM_USE_LFN 3
|
||||
#define RT_DFS_ELM_LFN_UNICODE_0
|
||||
#define RT_DFS_ELM_LFN_UNICODE 0
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
|
||||
@@ -132,14 +137,9 @@
|
||||
#define RT_USING_SFUD
|
||||
#define RT_SFUD_USING_SFDP
|
||||
#define RT_SFUD_USING_FLASH_INFO_TABLE
|
||||
#define RT_SFUD_SPI_MAX_HZ 50000000
|
||||
#define RT_USING_WDT
|
||||
|
||||
/* Using Hardware Crypto drivers */
|
||||
|
||||
|
||||
/* Using WiFi */
|
||||
|
||||
|
||||
/* Using USB */
|
||||
|
||||
|
||||
@@ -151,13 +151,16 @@
|
||||
#define RT_USING_POSIX
|
||||
#define RT_USING_POSIX_MMAP
|
||||
#define RT_USING_POSIX_TERMIOS
|
||||
#define RT_USING_POSIX_GETLINE
|
||||
#define RT_USING_POSIX_AIO
|
||||
#define RT_LIBC_FIXED_TIMEZONE 8
|
||||
|
||||
/* Network */
|
||||
|
||||
/* Socket abstraction layer */
|
||||
|
||||
#define RT_USING_SAL
|
||||
#define SAL_INTERNET_CHECK
|
||||
|
||||
/* protocol stack implement */
|
||||
|
||||
@@ -177,7 +180,8 @@
|
||||
/* light weight TCP/IP stack */
|
||||
|
||||
#define RT_USING_LWIP
|
||||
#define RT_USING_LWIP202
|
||||
#define RT_USING_LWIP212
|
||||
#define RT_LWIP_MEM_ALIGNMENT 4
|
||||
#define RT_LWIP_ICMP
|
||||
#define RT_LWIP_DNS
|
||||
#define RT_LWIP_DHCP
|
||||
@@ -213,12 +217,10 @@
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
#define LWIP_SO_RCVBUF 1
|
||||
#define LWIP_SO_LINGER 0
|
||||
#define LWIP_NETIF_LOOPBACK 0
|
||||
#define RT_LWIP_USING_PING
|
||||
|
||||
/* Modbus master and slave stack */
|
||||
|
||||
|
||||
/* AT commands */
|
||||
|
||||
|
||||
@@ -226,6 +228,7 @@
|
||||
|
||||
|
||||
/* Utilities */
|
||||
|
||||
#define RT_USING_LWP
|
||||
|
||||
/* RT-Thread online packages */
|
||||
@@ -259,6 +262,9 @@
|
||||
/* system packages */
|
||||
|
||||
|
||||
/* Micrium: Micrium software products porting for RT-Thread */
|
||||
|
||||
|
||||
/* peripheral libraries and drivers */
|
||||
|
||||
|
||||
@@ -267,6 +273,9 @@
|
||||
|
||||
/* samples: kernel and components samples */
|
||||
|
||||
|
||||
/* games: games run on RT-Thread console */
|
||||
|
||||
#define SOC_VEXPRESS_A9
|
||||
#define RT_USING_UART0
|
||||
#define RT_USING_UART1
|
||||
|
||||
@@ -17,6 +17,7 @@ menu "Onboard Peripheral Drivers"
|
||||
|
||||
config BSP_USING_COM2
|
||||
bool "Enable COM2 (uart2 pin conflict with Ethernet and PWM)"
|
||||
depends on (!BSP_USING_ETH && !BSP_USING_PWM)
|
||||
select BSP_USING_UART
|
||||
select BSP_USING_UART2
|
||||
default n
|
||||
@@ -45,15 +46,24 @@ menu "Onboard Peripheral Drivers"
|
||||
bool "Enable I2C EEPROM (i2c1)"
|
||||
select BSP_USING_I2C1
|
||||
default n
|
||||
|
||||
config PHY_USING_LAN8720A
|
||||
bool
|
||||
|
||||
config BSP_USING_ETH
|
||||
bool "Enable Ethernet"
|
||||
default n
|
||||
select RT_USING_LWIP
|
||||
select PHY_USING_LAN8720A
|
||||
select RT_LWIP_USING_HW_CHECKSUM
|
||||
|
||||
config BSP_USING_ETH_SAL
|
||||
bool "Enable Ethernet with SAL"
|
||||
depends on BSP_USING_ETH
|
||||
default y
|
||||
select RT_USING_SAL
|
||||
select SAL_USING_POSIX
|
||||
|
||||
config PHY_USING_LAN8720A
|
||||
bool
|
||||
depends on BSP_USING_ETH
|
||||
default y
|
||||
|
||||
config BSP_USING_MPU6050
|
||||
bool "Enable MPU6050 (i2c1)"
|
||||
@@ -67,12 +77,12 @@ menu "Onboard Peripheral Drivers"
|
||||
select RT_USING_DFS
|
||||
select RT_USING_DFS_ELMFAT
|
||||
default n
|
||||
if BSP_USING_SDCARD
|
||||
|
||||
config SDIO_MAX_FREQ
|
||||
int "sdio max freq"
|
||||
range 0 24000000
|
||||
depends on BSP_USING_SDCARD
|
||||
default 1000000
|
||||
endif
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
+17
-9
@@ -6,6 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-12-13 balanceTWK add sdcard port file
|
||||
* 2021-05-10 Meco Man fix a bug that cannot use fatfs in the main thread at starting up
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
@@ -20,7 +21,7 @@
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
void sd_mount(void *parameter)
|
||||
static void sd_mount(void *parameter)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
@@ -40,23 +41,30 @@ void sd_mount(void *parameter)
|
||||
}
|
||||
}
|
||||
|
||||
int stm32_sdcard_mount(void)
|
||||
static int onboard_sdcard_mount(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
|
||||
tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
|
||||
1024, RT_THREAD_PRIORITY_MAX - 2, 20);
|
||||
if (tid != RT_NULL)
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK)
|
||||
{
|
||||
rt_thread_startup(tid);
|
||||
LOG_I("sd card mount to '/'");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E("create sd_mount thread err!");
|
||||
tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
|
||||
1024, RT_THREAD_PRIORITY_MAX - 2, 20);
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(tid);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E("create sd_mount thread err!");
|
||||
}
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_APP_EXPORT(stm32_sdcard_mount);
|
||||
INIT_APP_EXPORT(onboard_sdcard_mount);
|
||||
|
||||
#endif /* BSP_USING_SDCARD */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <board.h>
|
||||
|
||||
#ifdef BSP_USING_SRAM
|
||||
#include <sram_port.h>
|
||||
#include "drv_sram.h"
|
||||
|
||||
#define DRV_DEBUG
|
||||
#define LOG_TAG "drv.sram"
|
||||
|
||||
@@ -19,16 +19,9 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/* errno for Keil MDK */
|
||||
#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
|
||||
#include <sys/errno.h>
|
||||
#include <sys/unistd.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,17 +46,16 @@
|
||||
#define X32_F "lx"
|
||||
|
||||
#ifdef RT_USING_LIBC
|
||||
#if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__IAR_SYSTEMS_ICC__)
|
||||
#include <sys/errno.h>
|
||||
#else
|
||||
#include <errno.h>
|
||||
/* some errno not defined in newlib */
|
||||
#ifndef ENSRNOTFOUND
|
||||
#define ENSRNOTFOUND 163 /* Domain name not found */
|
||||
#endif
|
||||
#ifndef ESHUTDOWN
|
||||
/* WARNING: ESHUTDOWN also not defined in newlib. We chose
|
||||
180 here because the number "108" which is used
|
||||
in arch.h has been assigned to another error code. */
|
||||
#define ESHUTDOWN 180
|
||||
#endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
|
||||
#endif
|
||||
#endif /* RT_USING_LIBC */
|
||||
|
||||
#if defined(RT_USING_LIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# RT-Thread 测试用例集合
|
||||
|
||||
## 简介
|
||||
|
||||
为了保证某一部分代码的质量,通常可以通过编写测试用例的方式,验证此代码的功能。为了保证 RT-Thread 相关仓库的代码质量,我们基于 utest 框架搭建了一套简易的自动化测试环境。有兴趣,有精力的小伙伴可以利用这套机制完善自己的代码检查。如果有意愿让社区上更多的小伙伴收益,也可以在提交代码的时候,把对应的测试用例也提交上来。
|
||||
|
||||
## 目录结构
|
||||
|
||||
| 目录 | 用途 |
|
||||
| --------- | ------------------------------------------------------------ |
|
||||
| configs | 配置文件集合(每一个目录代表一种功能集合,如:kernel,net等) |
|
||||
| testcases | 测试用例源代码 |
|
||||
|
||||
## 如何贡献
|
||||
|
||||
### 1. 编写测试用例
|
||||
|
||||
参考已有的测试用例在 [examples\utest\testcases](./testcases) 目录下添加自己的测试用例。测试用例的编写方法参考文档中心《utest 测试框架》章节。
|
||||
|
||||
### 2. 本地测试
|
||||
|
||||
1. 在 `bsp\qemu-vexpress-a9` 目录下打开 `menuconfig`,使能对应的测试用例,如下:
|
||||
|
||||
```
|
||||
RT-Thread Utestcases --->
|
||||
[*] RT-Thread Utestcases
|
||||
Utest Self Testcase --->
|
||||
[*] Pass test
|
||||
```
|
||||
|
||||
2. 保存并退出,输入 scons 编译当前 bsp。
|
||||
|
||||
3. 输入 .\qemu.bat 运行当前 bsp,在 msh 环境下执行 utest_run 命令,验证代码运行是否正常。
|
||||
|
||||
```
|
||||
msh />utest_run
|
||||
[I/utest] [==========] [ utest ] loop 1/1
|
||||
[I/utest] [==========] [ utest ] started
|
||||
[I/utest] [----------] [ testcase ] (testcases.utest.pass_tc) started
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:16) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:17) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:19) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:20) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:22) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:23) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:25) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:26) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:28) is passed
|
||||
[D/utest] [ OK ] [ unit ] (test_assert_pass:29) is passed
|
||||
[I/utest] [ PASSED ] [ result ] testcase (testcases.utest.pass_tc)
|
||||
[I/utest] [----------] [ testcase ] (testcases.utest.pass_tc) finished
|
||||
[I/utest] [==========] [ utest ] finished
|
||||
```
|
||||
|
||||
### 3. 提交
|
||||
|
||||
1. 如果是对已有测试集合的完善,需要把添加的测试用例的配置项添加到对应测试集合的配置文件里,如:[examples\utest\configs\utest_self\config.h](./configs/utest_self/config.h)。
|
||||
|
||||
```
|
||||
/* RT-Thread Utestcases */
|
||||
|
||||
#define RT_USING_UTESTCASES
|
||||
|
||||
/* Utest Self Testcase */
|
||||
|
||||
#define UTEST_SELF_PASS_TC
|
||||
|
||||
/* xxx Testcase */
|
||||
#define UTEST_XXX_TC
|
||||
```
|
||||
|
||||
2. 如果要添加新的测试集合,需要参考已有的测试集合,在 [examples\utest\configs](./configs) 目录下添加新的测试集合配置项。并更新 [.github\workflows\action_utest.yml](../../.github/workflows/action_utest.yml) 内的测试集合。
|
||||
|
||||
```
|
||||
- {UTEST: "kernel/ipc", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "vexpress-a9", CONFIG_FILE: "examples/utest/configs/utest_self/config.h"}
|
||||
- {UTEST: "components/utest", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "vexpress-a9", CONFIG_FILE: "examples/utest/configs/utest_self/config.h"}
|
||||
```
|
||||
|
||||
3. 向 RT-Thread 主仓库提交合并请求。
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
menu "RT-Thread Utestcases"
|
||||
|
||||
config RT_USING_UTESTCASES
|
||||
bool "RT-Thread Utestcases"
|
||||
default n
|
||||
select RT_USING_UTEST
|
||||
|
||||
if RT_USING_UTESTCASES
|
||||
|
||||
source "$RTT_DIR/examples/utest/testcases/utest/Kconfig"
|
||||
|
||||
endif
|
||||
|
||||
endmenu
|
||||
@@ -0,0 +1,15 @@
|
||||
# RT-Thread building script for bridge
|
||||
|
||||
import os
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
@@ -0,0 +1,7 @@
|
||||
menu "Utest Self Testcase"
|
||||
|
||||
config UTEST_SELF_PASS_TC
|
||||
bool "Pass test"
|
||||
default y
|
||||
|
||||
endmenu
|
||||
@@ -0,0 +1,13 @@
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Split('''
|
||||
pass_tc.c
|
||||
''')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('utestcases', src, depend = ['UTEST_SELF_PASS_TC'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2019-01-16 MurphyZhao the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "utest.h"
|
||||
|
||||
static void test_assert_pass(void)
|
||||
{
|
||||
uassert_true(1);
|
||||
uassert_false(0);
|
||||
|
||||
uassert_null(RT_NULL);
|
||||
uassert_not_null(!RT_NULL);
|
||||
|
||||
uassert_int_equal(1, 1);
|
||||
uassert_int_not_equal(1, 2);
|
||||
|
||||
uassert_str_equal("Hello RT-Thread!", "Hello RT-Thread!");
|
||||
uassert_str_not_equal("Hello RT-Thread!", "Hello");
|
||||
|
||||
uassert_in_range(2048, 1024, 4096);
|
||||
uassert_not_in_range(0, 1024, 4096);
|
||||
}
|
||||
|
||||
static rt_err_t utest_tc_init(void)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t utest_tc_cleanup(void)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static void testcase(void)
|
||||
{
|
||||
UTEST_UNIT_RUN(test_assert_pass);
|
||||
}
|
||||
UTEST_TC_EXPORT(testcase, "testcases.utest.pass_tc", utest_tc_init, utest_tc_cleanup, 10);
|
||||
@@ -10,6 +10,8 @@ CPPPATH = [cwd]
|
||||
|
||||
if rtconfig.PLATFORM == 'armcc':
|
||||
src += Glob('*_rvds.S')
|
||||
elif rtconfig.PLATFORM == 'armclang':
|
||||
src += Glob('*_rvds.S')
|
||||
|
||||
if rtconfig.PLATFORM == 'gcc':
|
||||
src += Glob('*_init.S')
|
||||
|
||||
@@ -447,6 +447,10 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
||||
variant_dir=kernel_vdir + '/components',
|
||||
duplicate=0,
|
||||
exports='remove_components'))
|
||||
# include testcases
|
||||
objs.extend(SConscript(Rtt_Root + '/examples/utest/testcases/SConscript',
|
||||
variant_dir=kernel_vdir + '/examples/utest/testcases',
|
||||
duplicate=0))
|
||||
|
||||
return objs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user