@@ -25,7 +25,7 @@ permissions:
2525jobs :
2626 test :
2727 runs-on : ubuntu-22.04
28- name : ${{ matrix.platform.UTEST }}-${{ matrix.platform.KERNEL }} - ${{ matrix.config_file }}
28+ name : ${{ matrix.platform.UTEST }} - ${{ matrix.config_file }}
2929 if : github.repository_owner == 'RT-Thread'
3030 strategy :
3131 fail-fast : false
3737 config_file :
3838 - " default.cfg"
3939
40- # kernel
41- - " kernel/atomic_c11.cfg"
42- - " kernel/atomic.cfg"
43- - " kernel/device.cfg"
44- - " kernel/ipc.cfg"
45- - " kernel/irq.cfg"
46- - " kernel/mem.cfg"
47- - " kernel/thread.cfg"
48- - " kernel/timer.cfg"
49-
5040 # cpp11
5141 - " cpp11/cpp11.cfg"
5242
5949 TEST_BSP_ROOT : ${{ matrix.platform.RTT_BSP }}
6050 TEST_CONFIG_FILE : ${{ matrix.config_file }}
6151 TEST_SD_FILE : ${{ matrix.platform.SD_FILE }}
62- RUN_FLAG : ${{ RUN_FLAG }}
63- KERNEL_FLAG : ${{ matrix.platform.KERNEL }}
6452 steps :
6553 - uses : actions/checkout@v4
6654
7765 TOOLCHAIN_INSTALLED=""
7866
7967 # Install Arm ToolChains
80- if [ TEST_QEMU_ARCH == "arm" && KERNEL_FLAG == "standard" && TEST_CONFIG_FILE != "rtsmart/rtsmart.cfg" ]; then
68+ if [[ "${{ matrix.platform.QEMU_ARCH }}" == "arm" && "${{ matrix.config_file }}" != "rtsmart/rtsmart.cfg" ]]; then
69+ echo "Starting install Arm ToolChains"
8170 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
8271 sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
8372 /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
8776 fi
8877
8978 # Install Arm Musl ToolChains
90- if [ TEST_QEMU_ARCH == "arm" && KERNEL_FLAG == "rtsmart" && TEST_CONFIG_FILE == "rtsmart/rtsmart.cfg" ]; then
79+ if [[ "${{ matrix.platform.QEMU_ARCH }}" == "arm" && "${{ matrix.config_file }}" == "rtsmart/rtsmart.cfg" ]]; then
80+ echo "Starting install Arm Musl ToolChains"
9181 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
9282 sudo tar xjf arm-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2 -C /opt
9383 /opt/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin/arm-linux-musleabi-gcc --version
9787 fi
9888
9989 # Install RISC-V ToolChains
100- if [ "TEST_QEMU_ARCH == "riscv64" && KERNEL_FLAG == "standard" && TEST_CONFIG_FILE != "rtsmart/rtsmart.cfg" ]; then
90+ if [[ "${{ matrix.platform.QEMU_ARCH }}" == "riscv64" && "${{ matrix.config_file }}" != "rtsmart/rtsmart.cfg" ]]; then
91+ echo "Starting install RISC-V ToolChains"
10192 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
10293 sudo tar zxvf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt
10394 /opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
10697 fi
10798
10899 # Install RISC-V Musl ToolChains
109- if [ TEST_QEMU_ARCH == "riscv64" && KERNEL_FLAG == "rtsmart" && TEST_CONFIG_FILE == "rtsmart/rtsmart.cfg" ]; then
100+ if [[ "${{ matrix.platform.QEMU_ARCH }}" == "riscv64" && "${{ matrix.config_file }}" == "rtsmart/rtsmart.cfg" ]]; then
101+ echo "Starting install RISC-V Musl ToolChains"
110102 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
111103 sudo tar xjf riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2 -C /opt
112104 /opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc --version
@@ -116,7 +108,8 @@ jobs:
116108 fi
117109
118110 # Install AARCH64 Musl ToolChains
119- if [ TEST_QEMU_ARCH == "aarch64" && KERNEL_FLAG == "rtsmart" && TEST_CONFIG_FILE == "rtsmart/rtsmart.cfg" ]; then
111+ if [[ "${{ matrix.platform.QEMU_ARCH }}" == "aarch64" && "${{ matrix.config_file }}" == "rtsmart/rtsmart.cfg" ]]; then
112+ echo "Starting install AARCH64 Musl ToolChains"
120113 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
121114 sudo tar xjf aarch64-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2 -C /opt
122115 /opt/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/aarch64-linux-musleabi-gcc --version
@@ -126,7 +119,7 @@ jobs:
126119 fi
127120
128121 # Install CPP11 Preprocessing Toolchain
129- if [ TEST_QEMU_ARCH == "arm" && TEST_CONFIG_FILE == "cpp11/cpp11.cfg" ]; then
122+ if [[ "${{ matrix.platform.QEMU_ARCH }}" == "arm" && "${{ matrix.config_file }}" == "cpp11/cpp11.cfg" ] ]; then
130123 sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/thread
131124 sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/mutex
132125 sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/condition_variable
@@ -136,38 +129,68 @@ jobs:
136129 sed -i 's/-fno-exceptions/ /g' $TEST_BSP_ROOT/rtconfig.py
137130 fi
138131
139- if [[ -z "$TOOLCHAIN_INSTALLED" ] ]; then
132+ if [ "$TOOLCHAIN_INSTALLED" == "None" ]; then
140133 echo "No valid toolchain installed, stopping the workflow."
141134 fi
142135
143136 - name : Build BSP
144- if : ${{ RUN_FLAG == 'yes' && env.TOOLCHAIN_INSTALLED != '' && success() }}
137+ if : ${{ matrix.platform.RUN == 'yes' && env.TOOLCHAIN_INSTALLED != '' && success() }}
145138 run : |
146139 echo CONFIG_RT_USING_UTESTCASES=y >> $TEST_BSP_ROOT/.config
147140 cat .github/utest/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
148141 scons --pyconfig-silent -C $TEST_BSP_ROOT
149142 scons -j$(nproc) --strict -C $TEST_BSP_ROOT
150143
151144 - name : QEMU Run Test
152- if : ${{ RUN_FLAG == 'yes' && env.TOOLCHAIN_INSTALLED != '' && success() }}
145+ if : ${{ matrix.platform.RUN == 'yes' && env.TOOLCHAIN_INSTALLED != '' && success() }}
153146 run : |
154- if [ "$TEST_SD_FILE" != "None" ]; then
155- dd if=/dev/zero of=$TEST_BSP_ROOT/sd.bin bs=1024 count=65536
156- 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 &
157- else
158- 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 &
159- fi
147+ # if [ "$TEST_SD_FILE" != "None" ]; then
148+ # dd if=/dev/zero of=$TEST_BSP_ROOT/sd.bin bs=1024 count=65536
149+ # mkfs.fat $TEST_BSP_ROOT/sd.bin
150+ # 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 &
151+ # else
152+ # 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 &
153+ # fi
154+
155+ if [[ "${{ matrix.platform.QEMU_ARCH }}" == "aarch64" ]]; then
156+ dd if=/dev/zero of=$TEST_BSP_ROOT/sd.bin bs=1M count=64 status=progress || { echo "Failed to create SD image"; exit 1; }
157+ mkfs.vfat -F 32 $TEST_BSP_ROOT/sd.bin || { echo "Failed to format SD image"; exit 1; }
158+
159+ qemu-system-$TEST_QEMU_ARCH \
160+ -nographic \
161+ -M $TEST_QEMU_MACHINE \
162+ -kernel $TEST_BSP_ROOT/rtthread.bin \
163+ -device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0 \
164+ -drive if=none,file=$TEST_BSP_ROOT/sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
165+ -netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \
166+ > qemu_output_$TEST_QEMU_ARCH.log 2>&1 &
167+ elif [[ "${{ matrix.platform.QEMU_ARCH }}" == "arm" ]]; then
168+ dd if=/dev/zero of=$TEST_BSP_ROOT/sd.bin bs=1024 count=65536 || { echo "Failed to create SD image"; exit 1; }
169+ mkfs.fat $TEST_BSP_ROOT/sd.bin || { echo "Failed to format SD image"; exit 1; }
170+ qemu-system-$TEST_QEMU_ARCH \
171+ -nographic \
172+ -M $TEST_QEMU_MACHINE \
173+ -kernel $TEST_BSP_ROOT/rtthread.bin \
174+ -nographic -sd $TEST_BSP_ROOT/sd.bin \
175+ > qemu_output_$TEST_QEMU_ARCH.log 2>&1 &
176+ else
177+ qemu-system-$TEST_QEMU_ARCH \
178+ -nographic \
179+ -M $TEST_QEMU_MACHINE \
180+ -kernel $TEST_BSP_ROOT/rtthread.bin \
181+ > qemu_output_$TEST_QEMU_ARCH.log 2>&1 &
182+ fi
160183
161184 QEMU_PID=$!
162185 disown $QEMU_PID
163186
164187 - name : Monitor qemu log
165- if : ${{ RUN_FLAG == 'yes' && env.TOOLCHAIN_INSTALLED != '' && success() }}
188+ if : ${{ matrix.platform.RUN == 'yes' && env.TOOLCHAIN_INSTALLED != '' && success() }}
166189 run : |
167190 FAILURE_DETECTED=false
168191 ERROR_LOGS=""
169192
170- tail -n 0 -f qemu_output_${ TEST_QEMU_ARCH} .log | while read line; do
193+ tail -n 0 -f qemu_output_$TEST_QEMU_ARCH.log | while read line; do
171194 echo $line
172195 if [[ "$line" == *"[ FAILED ] [ result ]"* ]]; then
173196 ERROR_LOGS="$ERROR_LOGS$line"$'\n'
0 commit comments