[add] auto test ci.

This commit is contained in:
guozhanxin
2021-05-10 20:34:35 +08:00
parent 5102c32b26
commit 3906f3b948
10 changed files with 517 additions and 0 deletions
+14
View File
@@ -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
+15
View File
@@ -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')
+7
View File
@@ -0,0 +1,7 @@
menu "Utest Self Testcase"
config UTEST_SELF_PASS_TC
bool "Pass test"
default y
endmenu
+14
View File
@@ -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')
+46
View File
@@ -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);