Skip to content

Commit 0263942

Browse files
authored
New Update utest_auto_run.yml
1 parent 1aef0db commit 0263942

File tree

1 file changed

+79
-47
lines changed

1 file changed

+79
-47
lines changed

.github/workflows/utest_auto_run.yml

Lines changed: 79 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Automation utest run script for the QEMU platform
2-
# Generate the corresponding config configuration for CI based on the configuration file under examples/utest/configs.
3-
2+
# Generate the corresponding config configuration for CI based on the configuration file under .github/utest.
43
name: utest_auto_run
5-
64
on:
75
push:
86
branches:
@@ -18,14 +16,8 @@ on:
1816
- documentation/**
1917
- '**/README.md'
2018
- '**/README_zh.md'
21-
22-
concurrency:
23-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24-
cancel-in-progress: true
25-
2619
permissions:
2720
contents: read
28-
2921
jobs:
3022
test:
3123
runs-on: ubuntu-22.04
@@ -47,33 +39,95 @@ jobs:
4739
- { UTEST: "AARCH64", RTT_BSP: "bsp/qemu-virt64-aarch64", QEMU_ARCH: "aarch64", QEMU_MACHINE: "virt", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
4840
- { UTEST: "AARCH64-rtsmart", RTT_BSP: "bsp/qemu-virt64-aarch64", QEMU_ARCH: "aarch64", QEMU_MACHINE: "virt", SD_FILE: "sd.bin", KERNEL: "rtsmart", "SMP_RUN":"" }
4941
# - { UTEST: "AARCH64-smp", RTT_BSP: "bsp/qemu-virt64-aarch64", QEMU_ARCH: "aarch64", QEMU_MACHINE: "virt", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"smp" }
42+
- &a9_platform
43+
UTEST: "A9"
44+
RTT_BSP: "bsp/qemu-vexpress-a9"
45+
QEMU_ARCH: "arm"
46+
QEMU_MACHINE: "vexpress-a9"
47+
SD_FILE: "sd.bin"
48+
KERNEL: "standard"
49+
SMP_RUN: ""
50+
51+
- UTEST: "A9-rtsmart"
52+
RTT_BSP: "bsp/qemu-vexpress-a9"
53+
QEMU_ARCH: "arm"
54+
QEMU_MACHINE: "vexpress-a9"
55+
SD_FILE: "sd.bin"
56+
KERNEL: "rtsmart"
57+
SMP_RUN: ""
58+
59+
- UTEST: "A9-smp"
60+
RTT_BSP: "bsp/qemu-vexpress-a9"
61+
QEMU_ARCH: "arm"
62+
QEMU_MACHINE: "vexpress-a9"
63+
SD_FILE: "sd.bin"
64+
KERNEL: "standard"
65+
SMP_RUN: "smp"
66+
67+
- UTEST: "RISCV"
68+
RTT_BSP: "bsp/qemu-virt64-riscv"
69+
QEMU_ARCH: "riscv64"
70+
QEMU_MACHINE: "virt"
71+
SD_FILE: "None"
72+
KERNEL: "standard"
73+
SMP_RUN: ""
74+
75+
- UTEST: "RISCV-rtsmart"
76+
RTT_BSP: "bsp/qemu-virt64-riscv"
77+
QEMU_ARCH: "riscv64"
78+
QEMU_MACHINE: "virt"
79+
SD_FILE: "None"
80+
KERNEL: "rtsmart"
81+
SMP_RUN: ""
82+
83+
- UTEST: "XUANTIE-rtsmart"
84+
RTT_BSP: "bsp/xuantie/virt64/c906"
85+
QEMU_ARCH: "riscv64"
86+
QEMU_MACHINE: "virt"
87+
SD_FILE: "sd.bin"
88+
KERNEL: "rtsmart"
89+
SMP_RUN: ""
90+
91+
- UTEST: "AARCH64"
92+
RTT_BSP: "bsp/qemu-virt64-aarch64"
93+
QEMU_ARCH: "aarch64"
94+
QEMU_MACHINE: "virt"
95+
SD_FILE: "sd.bin"
96+
KERNEL: "standard"
97+
SMP_RUN: ""
98+
99+
- UTEST: "AARCH64-rtsmart"
100+
RTT_BSP: "bsp/qemu-virt64-aarch64"
101+
QEMU_ARCH: "aarch64"
102+
QEMU_MACHINE: "virt"
103+
SD_FILE: "sd.bin"
104+
KERNEL: "rtsmart"
105+
SMP_RUN: ""
50106

51107
config_file:
52108
- "default.cfg"
53109

54110
include:
55111
# only run on qemu-vexpress-a9
56112
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
57-
config_file: "kernel/kernel_basic.cfg"
58-
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
59-
config_file: "kernel/ipc.cfg"
60-
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
61-
config_file: "kernel/mem.cfg"
113+
- platform: *a9_platform
114+
config_file: "kernel/object.cfg"
62115

63116
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
64-
config_file: "kernel/atomic_c11.cfg"
65-
- platform: { UTEST: "RISCV", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", SD_FILE: "None", KERNEL: "standard", "SMP_RUN":"" }
66-
config_file: "kernel/atomic_c11.cfg"
117+
- platform: *a9_platform
118+
config_file: "dfs/dfs.cfg"
67119

68120
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
121+
- platform: *a9_platform
69122
config_file: "cpp11/cpp11.cfg"
70123

71124
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
72-
config_file: "components/lwip.cfg"
73-
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
74-
config_file: "components/netdev.cfg"
125+
- platform: *a9_platform
126+
config_file: "lwip/lwip.cfg"
127+
75128
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
76-
config_file: "components/dfs.cfg"
129+
- platform: *a9_platform
130+
config_file: "netdev/netdev.cfg"
77131

78132
env:
79133
TEST_QEMU_ARCH: ${{ matrix.platform.QEMU_ARCH }}
@@ -83,19 +137,16 @@ jobs:
83137
TEST_SD_FILE: ${{ matrix.platform.SD_FILE }}
84138
steps:
85139
- uses: actions/checkout@main
86-
87140
- name: Install Tools
88141
shell: bash
89142
run: |
90143
sudo apt-get update
91144
sudo apt-get -yqq install scons qemu-system git
92145
pip3 install kconfiglib
93-
94146
- name: Install ToolChains
95147
shell: bash
96148
run: |
97149
TOOLCHAIN_INSTALLED=""
98-
99150
# Install Arm ToolChains
100151
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "arm" && "${{ matrix.platform.KERNEL }}" == "standard" ]]; then
101152
echo "Starting install Arm ToolChains"
@@ -106,7 +157,6 @@ jobs:
106157
echo "RTT_CC_PREFIX=arm-none-eabi-" >> $GITHUB_ENV
107158
echo "TOOLCHAIN_INSTALLED=arm" >> $GITHUB_ENV
108159
fi
109-
110160
# Install Arm Musl ToolChains
111161
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "arm" && "${{ matrix.platform.KERNEL }}" == "rtsmart" ]]; then
112162
echo "Starting install Arm Musl ToolChains"
@@ -117,7 +167,6 @@ jobs:
117167
echo "RTT_CC_PREFIX=arm-linux-musleabi-" >> $GITHUB_ENV
118168
echo "TOOLCHAIN_INSTALLED=arm-musl" >> $GITHUB_ENV
119169
fi
120-
121170
# Install RISC-V ToolChains
122171
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "riscv64" && "${{ matrix.platform.KERNEL }}" == "standard" ]]; then
123172
echo "Starting install RISC-V ToolChains"
@@ -127,7 +176,6 @@ jobs:
127176
echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
128177
echo "TOOLCHAIN_INSTALLED=riscv" >> $GITHUB_ENV
129178
fi
130-
131179
# Install RISC-V Musl ToolChains
132180
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "riscv64" && "${{ matrix.platform.KERNEL }}" == "rtsmart" ]]; then
133181
echo "Starting install RISC-V Musl ToolChains"
@@ -138,7 +186,6 @@ jobs:
138186
echo "RTT_CC_PREFIX=riscv64-unknown-linux-musl-" >> $GITHUB_ENV
139187
echo "TOOLCHAIN_INSTALLED=riscv-musl" >> $GITHUB_ENV
140188
fi
141-
142189
# Install RISC-V XUANTIE Musl ToolChains
143190
if [[ "${{ matrix.platform.UTEST }}" == "XUANTIE-rtsmart" && "${{ matrix.platform.QEMU_ARCH }}" == "riscv64" && "${{ matrix.platform.KERNEL }}" == "rtsmart" ]]; then
144191
echo "Starting install RISC-V XUANTIE Musl ToolChains"
@@ -149,7 +196,6 @@ jobs:
149196
echo "RTT_CC_PREFIX=riscv64-unknown-linux-musl-" >> $GITHUB_ENV
150197
echo "TOOLCHAIN_INSTALLED=riscv-musl" >> $GITHUB_ENV
151198
fi
152-
153199
# Install AARCH64 ToolChains
154200
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "aarch64" && "${{ matrix.platform.KERNEL }}" == "standard" ]]; then
155201
echo "Starting install AARCH64 ToolChains"
@@ -160,7 +206,6 @@ jobs:
160206
echo "RTT_CC_PREFIX=aarch64-none-elf-" >> $GITHUB_ENV
161207
echo "TOOLCHAIN_INSTALLED=aarch64" >> $GITHUB_ENV
162208
fi
163-
164209
# Install AARCH64 Musl ToolChains
165210
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "aarch64" && "${{ matrix.platform.KERNEL }}" == "rtsmart" ]]; then
166211
echo "Starting install AARCH64 Musl ToolChains"
@@ -171,7 +216,6 @@ jobs:
171216
echo "RTT_CC_PREFIX=aarch64-linux-musleabi-" >> $GITHUB_ENV
172217
echo "TOOLCHAIN_INSTALLED=aarch64-musl" >> $GITHUB_ENV
173218
fi
174-
175219
# Install CPP11 Preprocessing Toolchain
176220
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "arm" && "${{ matrix.config_file }}" == "cpp11/cpp11.cfg" && "${{ matrix.platform.KERNEL }}" == "standard" ]]; then
177221
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/thread
@@ -182,37 +226,31 @@ jobs:
182226
sudo cat /dev/null > /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/sys/_pthreadtypes.h
183227
sed -i 's/-fno-exceptions/ /g' $TEST_BSP_ROOT/rtconfig.py
184228
fi
185-
186229
if [ "$TOOLCHAIN_INSTALLED" == "None" ]; then
187230
echo "No valid toolchain installed, stopping the workflow."
188231
fi
189-
190232
- name: Build BSP
191233
if: ${{ env.TOOLCHAIN_INSTALLED != '' && success() }}
192234
run: |
193235
# Whether plan to run SMP?
194236
if [[ "${{ matrix.platform.SMP_RUN }}" == "smp" ]]; then
195-
cat examples/utest/configs/smp/smp.cfg >> $TEST_BSP_ROOT/.config
237+
cat .github/utest/smp/smp.cfg >> $TEST_BSP_ROOT/.config
196238
fi
197-
198239
# Is the kernel rtsmart?
199240
if [[ "${{ matrix.platform.KERNEL }}" == "rtsmart" ]]; then
200-
cat examples/utest/configs/rtsmart/rtsmart.cfg >> $TEST_BSP_ROOT/.config
241+
cat .github/utest/rtsmart/rtsmart.cfg >> $TEST_BSP_ROOT/.config
201242
fi
202-
203243
echo CONFIG_RT_USING_UTESTCASES=y >> $TEST_BSP_ROOT/.config
204-
cat examples/utest/configs/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
244+
cat .github/utest/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
205245
scons --pyconfig-silent -C $TEST_BSP_ROOT
206246
scons -j$(nproc) --strict -C $TEST_BSP_ROOT
207-
208247
- name: QEMU Run Test
209248
if: ${{ env.TOOLCHAIN_INSTALLED != '' && success() }}
210249
run: |
211250
if [ "$TEST_SD_FILE" != "None" ]; then
212251
dd if=/dev/zero of=$TEST_BSP_ROOT/sd.bin bs=1024 count=65536
213252
mkfs.fat $TEST_BSP_ROOT/sd.bin
214253
fi
215-
216254
if [[ "${{ matrix.platform.QEMU_ARCH }}" == "aarch64" ]]; then
217255
qemu-system-$TEST_QEMU_ARCH -M virt,gic-version=2 -cpu cortex-a53 -smp 4 -kernel $TEST_BSP_ROOT/rtthread.bin -nographic \
218256
-drive if=none,file=$TEST_BSP_ROOT/sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
@@ -225,22 +263,17 @@ jobs:
225263
dos2unix ./install/qemu_post_install_small.sh
226264
sudo chmod +x ./install/qemu_post_install_small.sh
227265
sudo ./install/qemu_post_install_small.sh
228-
229266
QEMU_BIN="./install/bin/qemu-system-$TEST_QEMU_ARCH"
230267
[ ! -f "$QEMU_BIN" ] && echo "ERROR: $QEMU_BIN not found." && exit 1
231-
232268
tmp_output=$(mktemp)
233269
ldd "$QEMU_BIN" > "$tmp_output" 2>&1
234270
missing_libs=$(grep "not found" "$tmp_output" | awk '{print $1}')
235-
236271
for lib in $missing_libs; do
237272
base_lib=$(echo "$lib" | sed -E 's/\.so.*/\.so/')
238-
239273
echo "🔍 修复基础库:$base_lib ..."
240274
sudo ln -s /usr/lib/x86_64-linux-gnu/$base_lib /usr/lib/x86_64-linux-gnu/$lib
241275
done
242276
echo "✅ 所有缺失库已处理。"
243-
244277
$QEMU_BIN -cpu c906fd -M $TEST_QEMU_MACHINE -kernel $TEST_BSP_ROOT/rtthread.bin -nographic \
245278
-drive if=none,file=$TEST_BSP_ROOT/sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
246279
> qemu_output_$TEST_QEMU_ARCH.log 2>&1 &
@@ -258,7 +291,6 @@ jobs:
258291
-kernel $TEST_BSP_ROOT/rtthread.bin \
259292
> qemu_output_$TEST_QEMU_ARCH.log 2>&1 &
260293
fi
261-
262294
QEMU_PID=$!
263295
disown $QEMU_PID
264296
@@ -295,4 +327,4 @@ jobs:
295327
echo "=========================================================================================="
296328
break
297329
fi
298-
done
330+
done

0 commit comments

Comments
 (0)