Skip to content

Commit 75b8340

Browse files
committed
feat: ci script associated with auto_utest.
1 parent ab1f438 commit 75b8340

File tree

4 files changed

+160
-2
lines changed

4 files changed

+160
-2
lines changed

.github/utest/default.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_RT_USING_CI_ACTION=y
+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: action_auto_utest
2+
3+
# Automation utest run script for the QEMU platform
4+
# Generate the corresponding config configuration for CI based on the configuration file under .github/utest.
5+
on:
6+
schedule:
7+
- cron: '0 16 1 * *'
8+
push:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- documentation/**
13+
- '**/README.md'
14+
- '**/README_zh.md'
15+
pull_request:
16+
branches:
17+
- master
18+
paths-ignore:
19+
- documentation/**
20+
- '**/README.md'
21+
- '**/README_zh.md'
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
test:
28+
runs-on: ubuntu-22.04
29+
name: ${{ matrix.platform.UTEST }} - ${{ matrix.config_file }}
30+
if: github.repository_owner == 'RT-Thread'
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
platform:
35+
- { UTEST: "qemu-vexpress-a9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", RUN: "yes" }
36+
# - { UTEST: "qemu-virt64-aarch64", RTT_BSP: "bsp/qemu-virt64-aarch64", QEMU_ARCH: "aarch64", QEMU_MACHINE: "virt", SD_FILE: "sd.bin", RUN: "no" }
37+
- { UTEST: "qemu-virt64-riscv", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", SD_FILE: "None", RUN: "yes" }
38+
config_file:
39+
- "default.cfg"
40+
# - "rtduino/rtduino.cfg"
41+
env:
42+
TEST_QEMU_ARCH: ${{ matrix.platform.QEMU_ARCH }}
43+
TEST_QEMU_MACHINE: ${{ matrix.platform.QEMU_MACHINE }}
44+
TEST_BSP_ROOT: ${{ matrix.platform.RTT_BSP }}
45+
TEST_CONFIG_FILE: ${{ matrix.config_file }}
46+
TEST_SD_FILE: ${{ matrix.platform.SD_FILE }}
47+
RUN_FLAG: ${{ matrix.platform.RUN }}
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Install Tools
52+
shell: bash
53+
run: |
54+
wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh
55+
chmod 777 install_ubuntu.sh
56+
./install_ubuntu.sh
57+
git config --global http.postBuffer 524288000
58+
git remote -v
59+
git fetch origin
60+
61+
- name: Install Arm ToolChains
62+
if: ${{ matrix.platform.QEMU_ARCH == 'arm' && matrix.platform.UTEST != 'rtsmart/arm' && success() }}
63+
shell: bash
64+
run: |
65+
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
66+
sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
67+
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
68+
echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
69+
70+
- name: Install Arm Musl ToolChains
71+
if: ${{ matrix.platform.QEMU_ARCH == 'arm' && matrix.platform.UTEST == 'rtsmart/arm' && success() }}
72+
shell: bash
73+
run: |
74+
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.7/arm-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2
75+
sudo tar xjf arm-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2 -C /opt
76+
/opt/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin/arm-linux-musleabi-gcc --version
77+
echo "RTT_EXEC_PATH=/opt/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
78+
echo "RTT_CC_PREFIX=arm-linux-musleabi-" >> $GITHUB_ENV
79+
80+
- name: Install RISC-V ToolChains
81+
if: ${{ matrix.platform.QEMU_ARCH == 'riscv64' && matrix.platform.UTEST != 'rtsmart/riscv64' && success() }}
82+
run: |
83+
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
84+
sudo tar zxvf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt
85+
/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
86+
echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
87+
88+
- name: Install RISC-V Musl ToolChains
89+
if: ${{ matrix.platform.QEMU_ARCH == 'riscv64' && matrix.platform.UTEST == 'rtsmart/riscv64' && success() }}
90+
shell: bash
91+
run: |
92+
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.7/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2
93+
sudo tar xjf riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2 -C /opt
94+
/opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc --version
95+
echo "RTT_EXEC_PATH=/opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
96+
echo "RTT_CC_PREFIX=riscv64-unknown-linux-musl-" >> $GITHUB_ENV
97+
98+
- name: Install AARCH64 Musl ToolChains
99+
if: ${{ matrix.platform.QEMU_ARCH == 'aarch64' && matrix.platform.UTEST == 'rtsmart/aarch64' && success() }}
100+
shell: bash
101+
run: |
102+
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.7/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2
103+
sudo tar xjf aarch64-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2 -C /opt
104+
/opt/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/aarch64-linux-musleabi-gcc --version
105+
echo "RTT_EXEC_PATH=/opt/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
106+
echo "RTT_CC_PREFIX=aarch64-linux-musleabi-" >> $GITHUB_ENV
107+
108+
- name: CPP11 Preprocessing Toolchain
109+
if: ${{ matrix.platform.QEMU_ARCH == 'arm' && matrix.platform.UTEST == 'components/cpp11' && success() }}
110+
shell: bash
111+
run: |
112+
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/{thread,mutex,condition_variable,future}
113+
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/pthread.h
114+
sudo sh -c 'echo "" > /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/sys/_pthreadtypes.h'
115+
sed -i 's/-fno-exceptions//g' $TEST_BSP_ROOT/rtconfig.py
116+
117+
- name: Build BSP
118+
run: |
119+
echo CONFIG_RT_USING_UTESTCASES=y >> $TEST_BSP_ROOT/.config
120+
cat .github/utest/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
121+
scons --pyconfig-silent -C $TEST_BSP_ROOT
122+
scons -j$(nproc) --strict -C $TEST_BSP_ROOT
123+
124+
- name: QEMU Run Test
125+
if: ${{ matrix.platform.RUN == 'yes' && success() }}
126+
run: |
127+
if [ "$TEST_SD_FILE" != "None" ]; then
128+
dd if=/dev/zero of=$TEST_BSP_ROOT/sd.bin bs=1024 count=65536
129+
qemu-system-$TEST_QEMU_ARCH -nographic -M $TEST_QEMU_MACHINE -kernel $TEST_BSP_ROOT/rtthread.bin -nographic -sd $TEST_BSP_ROOT/sd.bin > qemu_output_${TEST_QEMU_ARCH}.log 2>&1 &
130+
else
131+
qemu-system-$TEST_QEMU_ARCH -nographic -M $TEST_QEMU_MACHINE -kernel $TEST_BSP_ROOT/rtthread.bin -nographic > qemu_output_${TEST_QEMU_ARCH}.log 2>&1 &
132+
fi
133+
134+
QEMU_PID=$!
135+
disown $QEMU_PID
136+
137+
# - name: Monitor qemu log
138+
# run: |
139+
# FAILURE_DETECTED=false
140+
# ERROR_LOGS=""
141+
142+
# tail -n 0 -f qemu_output_${TEST_QEMU_ARCH}.log | while read line; do
143+
# echo $line
144+
# if [[ "$line" == *"[ FAILED ] [ result ]"* ]]; then
145+
# ERROR_LOGS="$ERROR_LOGS$line"$'\n'
146+
# FAILURE_DETECTED=true
147+
# fi
148+
149+
# if [[ "$line" == *"[==========] [ utest ] end"* ]]; then
150+
# echo "Utest run completed. Exiting log monitoring..."
151+
# if $FAILURE_DETECTED; then
152+
# echo "Error: Failures detected in logs. Below are the failure details..."
153+
# echo "$ERROR_LOGS"
154+
# exit 1
155+
# fi
156+
# break
157+
# fi
158+
# done

.github/workflows/action_utest.yml

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
- {UTEST: "kernel/device", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/device.conf", SD_FILE: "sd.bin", RUN: "yes"}
4242
- {UTEST: "kernel/atomic", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/atomic.conf", SD_FILE: "sd.bin", RUN: "yes"}
4343
- {UTEST: "kernel/atomic_c11", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/atomic_c11.conf", SD_FILE: "sd.bin", RUN: "yes"}
44-
- {UTEST: "components/utest", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "utest_self/self.conf", SD_FILE: "sd.bin", RUN: "yes"}
4544
- {UTEST: "components/cpp11", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "cpp11/cpp11.conf", SD_FILE: "sd.bin", RUN: "yes"}
4645
- {UTEST: "kernel/mem/riscv64", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", CONFIG_FILE: "kernel/mem.conf", SD_FILE: "None", RUN: "yes"}
4746
- {UTEST: "kernel/atomic/riscv64", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", CONFIG_FILE: "kernel/atomic.conf", SD_FILE: "None", RUN: "yes"}

components/utilities/utest/utest.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ static void utest_do_run(const char *utest_name)
278278
break;
279279
}
280280

281-
LOG_I("[==========] [ utest ] finished");
282281
LOG_I("[==========] [ utest ] %d tests from %d testcase ran.", tc_run_num, tc_num);
283282
LOG_I("[ PASSED ] [ result ] %d tests.", tc_run_num - tc_fail_num);
283+
LOG_I("[==========] [ utest ] end");
284284

285285
if(tc_fail_list && (tc_fail_num > 0))
286286
{

0 commit comments

Comments
 (0)