mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 09:02:20 +08:00
improve[ci]: integrate utest run ci (#10748)
This commit is contained in:
151
.github/workflows/action_utest.yml
vendored
151
.github/workflows/action_utest.yml
vendored
@@ -1,151 +0,0 @@
|
||||
name: AutoTestCI
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
# Runs at 16:00 UTC (BeiJing 00:00) on the 1st of every month
|
||||
schedule:
|
||||
- cron: '0 16 1 * *'
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- documentation/**
|
||||
- '**/README.md'
|
||||
- '**/README_zh.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- documentation/**
|
||||
- '**/README.md'
|
||||
- '**/README_zh.md'
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-22.04
|
||||
name: ${{ matrix.legs.UTEST }}
|
||||
if: github.repository_owner == 'RT-Thread'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
legs:
|
||||
- {UTEST: "kernel/mem", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/mem.conf", SD_FILE: "sd.bin", RUN: "yes"}
|
||||
- {UTEST: "kernel/ipc", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/ipc.conf", SD_FILE: "sd.bin", RUN: "yes"}
|
||||
- {UTEST: "kernel/irq", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/irq.conf", SD_FILE: "sd.bin", RUN: "yes"}
|
||||
- {UTEST: "kernel/timer", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/timer.conf", SD_FILE: "sd.bin", RUN: "yes"}
|
||||
- {UTEST: "kernel/thread", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/thread.conf", SD_FILE: "sd.bin", RUN: "yes"}
|
||||
- {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"}
|
||||
- {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"}
|
||||
- {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"}
|
||||
- {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"}
|
||||
- {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"}
|
||||
- {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"}
|
||||
- {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"}
|
||||
- {UTEST: "kernel/atomic_c11/riscv64", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", CONFIG_FILE: "kernel/atomic_c11.conf", SD_FILE: "None", RUN: "yes"}
|
||||
- {UTEST: "rtsmart/arm", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "rtsmart/base.conf", SD_FILE: "sd.bin", RUN: "no"}
|
||||
- {UTEST: "rtsmart/aarch64", RTT_BSP: "bsp/qemu-virt64-aarch64", QEMU_ARCH: "aarch64", QEMU_MACHINE: "virt", CONFIG_FILE: "rtsmart/base.conf", SD_FILE: "sd.bin", RUN: "no"}
|
||||
- {UTEST: "rtsmart/riscv64", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", CONFIG_FILE: "rtsmart/base.conf", SD_FILE: "None", RUN: "yes"}
|
||||
env:
|
||||
TEST_QEMU_ARCH: ${{ matrix.legs.QEMU_ARCH }}
|
||||
TEST_QEMU_MACHINE: ${{ matrix.legs.QEMU_MACHINE }}
|
||||
TEST_BSP_ROOT: ${{ matrix.legs.RTT_BSP }}
|
||||
TEST_CONFIG_FILE: ${{ matrix.legs.CONFIG_FILE }}
|
||||
TEST_SD_FILE: ${{ matrix.legs.SD_FILE }}
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
|
||||
- name: Install Tools
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -yqq install scons qemu-system git
|
||||
pip3 install kconfiglib
|
||||
|
||||
- name: Install Arm ToolChains
|
||||
if: ${{ matrix.legs.QEMU_ARCH == 'arm' && matrix.legs.UTEST != 'rtsmart/arm' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
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
|
||||
sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
|
||||
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
|
||||
echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Arm Musl ToolChains
|
||||
if: ${{ matrix.legs.QEMU_ARCH == 'arm' && matrix.legs.UTEST == 'rtsmart/arm' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
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
|
||||
sudo tar xjf arm-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2 -C /opt
|
||||
/opt/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin/arm-linux-musleabi-gcc --version
|
||||
echo "RTT_EXEC_PATH=/opt/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
|
||||
echo "RTT_CC_PREFIX=arm-linux-musleabi-" >> $GITHUB_ENV
|
||||
|
||||
- name: Install RISC-V ToolChains
|
||||
if: ${{ matrix.legs.QEMU_ARCH == 'riscv64' && matrix.legs.UTEST != 'rtsmart/riscv64' && success() }}
|
||||
run: |
|
||||
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
|
||||
sudo tar zxvf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt
|
||||
/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
|
||||
echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
|
||||
|
||||
- name: Install RISC-V Musl ToolChains
|
||||
if: ${{ matrix.legs.QEMU_ARCH == 'riscv64' && matrix.legs.UTEST == 'rtsmart/riscv64' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
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
|
||||
sudo tar xjf riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2 -C /opt
|
||||
/opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc --version
|
||||
echo "RTT_EXEC_PATH=/opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
|
||||
echo "RTT_CC_PREFIX=riscv64-unknown-linux-musl-" >> $GITHUB_ENV
|
||||
|
||||
- name: Install AARCH64 Musl ToolChains
|
||||
if: ${{ matrix.legs.QEMU_ARCH == 'aarch64' && matrix.legs.UTEST == 'rtsmart/aarch64' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
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
|
||||
sudo tar xjf aarch64-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2 -C /opt
|
||||
/opt/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/aarch64-linux-musleabi-gcc --version
|
||||
echo "RTT_EXEC_PATH=/opt/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
|
||||
echo "RTT_CC_PREFIX=aarch64-linux-musleabi-" >> $GITHUB_ENV
|
||||
|
||||
- name: CPP11 Preprocessing Toolchain
|
||||
if: ${{ matrix.legs.QEMU_ARCH == 'arm' && matrix.legs.UTEST == 'components/cpp11' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Delete the following files
|
||||
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/thread
|
||||
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/mutex
|
||||
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/condition_variable
|
||||
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/c++/10.2.1/future
|
||||
sudo rm -f /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/pthread.h
|
||||
# Clear the contents of the following files
|
||||
sudo cat /dev/null > /opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/include/sys/_pthreadtypes.h
|
||||
# Clear -fno-exceptions in rtconfig.py
|
||||
sed -i 's/-fno-exceptions/ /g' $TEST_BSP_ROOT/rtconfig.py
|
||||
|
||||
- name: Build BSP
|
||||
run: |
|
||||
echo CONFIG_RT_USING_UTESTCASES=y >> $TEST_BSP_ROOT/.config
|
||||
cat examples/utest/configs/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
|
||||
scons --pyconfig-silent -C $TEST_BSP_ROOT
|
||||
scons -j$(nproc) --strict -C $TEST_BSP_ROOT
|
||||
|
||||
- name: Start run Test
|
||||
if: ${{matrix.legs.RUN == 'yes' && success() }}
|
||||
run: |
|
||||
git clone https://github.com/armink/UtestRunner.git
|
||||
pushd $TEST_BSP_ROOT
|
||||
dd if=/dev/zero of=sd.bin bs=1024 count=65536
|
||||
popd
|
||||
pushd UtestRunner
|
||||
if [ $TEST_SD_FILE != "None" ]; then
|
||||
python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.bin --sd ../$TEST_BSP_ROOT/$TEST_SD_FILE
|
||||
else
|
||||
python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.bin
|
||||
fi
|
||||
cat rtt_console.log
|
||||
popd
|
||||
25
.github/workflows/utest_auto_run.yml
vendored
25
.github/workflows/utest_auto_run.yml
vendored
@@ -1,5 +1,5 @@
|
||||
# Automation utest run script for the QEMU platform
|
||||
# Generate the corresponding config configuration for CI based on the configuration file under .github/utest.
|
||||
# Generate the corresponding config configuration for CI based on the configuration file under examples/utest/configs.
|
||||
|
||||
name: utest_auto_run
|
||||
|
||||
@@ -50,19 +50,26 @@ jobs:
|
||||
include:
|
||||
# only run on qemu-vexpress-a9
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "kernel/object.cfg"
|
||||
config_file: "kernel/kernel_basic.cfg"
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "kernel/ipc.cfg"
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "kernel/mem.cfg"
|
||||
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "dfs/dfs.cfg"
|
||||
config_file: "kernel/atomic_c11.cfg"
|
||||
- platform: { UTEST: "RISCV", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", SD_FILE: "None", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "kernel/atomic_c11.cfg"
|
||||
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "cpp11/cpp11.cfg"
|
||||
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "lwip/lwip.cfg"
|
||||
|
||||
config_file: "components/lwip.cfg"
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "netdev/netdev.cfg"
|
||||
config_file: "components/netdev.cfg"
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "components/dfs.cfg"
|
||||
|
||||
env:
|
||||
TEST_QEMU_ARCH: ${{ matrix.platform.QEMU_ARCH }}
|
||||
@@ -181,16 +188,16 @@ jobs:
|
||||
run: |
|
||||
# Whether plan to run SMP?
|
||||
if [[ "${{ matrix.platform.SMP_RUN }}" == "smp" ]]; then
|
||||
cat .github/utest/smp/smp.cfg >> $TEST_BSP_ROOT/.config
|
||||
cat examples/utest/configs/smp/smp.cfg >> $TEST_BSP_ROOT/.config
|
||||
fi
|
||||
|
||||
# Is the kernel rtsmart?
|
||||
if [[ "${{ matrix.platform.KERNEL }}" == "rtsmart" ]]; then
|
||||
cat .github/utest/rtsmart/rtsmart.cfg >> $TEST_BSP_ROOT/.config
|
||||
cat examples/utest/configs/rtsmart/rtsmart.cfg >> $TEST_BSP_ROOT/.config
|
||||
fi
|
||||
|
||||
echo CONFIG_RT_USING_UTESTCASES=y >> $TEST_BSP_ROOT/.config
|
||||
cat .github/utest/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
|
||||
cat examples/utest/configs/$TEST_CONFIG_FILE >> $TEST_BSP_ROOT/.config
|
||||
scons --pyconfig-silent -C $TEST_BSP_ROOT
|
||||
scons -j$(nproc) --strict -C $TEST_BSP_ROOT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user