mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 06:13:56 +08:00
[add] auto test ci.
This commit is contained in:
@@ -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,14 @@
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = []
|
||||
|
||||
if GetDepend('UTEST_SELF_PASS_TC'):
|
||||
src += ['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);
|
||||
Reference in New Issue
Block a user