rt-thread/.github/workflows/action_utest.yml

68 lines
3.1 KiB
YAML
Raw Normal View History

2021-05-10 20:34:33 +08:00
name: AutoTestCI
2021-05-10 20:38:58 +08:00
# Controls when the action will run. Triggers the workflow on push or pull request
on: [push, pull_request]
2021-05-10 20:34:33 +08:00
jobs:
test:
runs-on: ubuntu-latest
name: ${{ matrix.legs.UTEST }}
strategy:
fail-fast: false
matrix:
legs:
2021-06-17 21:50:46 +08:00
- {UTEST: "kernel/mem", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "kernel/config.h", SD_FILE: "sd.bin"}
- {UTEST: "components/utest", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "utest_self/config.h", SD_FILE: "sd.bin"}
- {UTEST: "kernel/mem/riscv64", RTT_BSP: "bsp/qemu-riscv-virt64", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", CONFIG_FILE: "kernel/config_riscv64.h", SD_FILE: "None"}
2021-05-10 20:34:33 +08:00
env:
2021-06-17 21:50:46 +08:00
TEST_QEMU_ARCH: ${{ matrix.legs.QEMU_ARCH }}
TEST_QEMU_MACHINE: ${{ matrix.legs.QEMU_MACHINE }}
2021-05-10 20:34:33 +08:00
TEST_BSP_ROOT: ${{ matrix.legs.RTT_BSP }}
TEST_CONFIG_FILE: ${{ matrix.legs.CONFIG_FILE }}
2021-06-17 21:50:46 +08:00
TEST_SD_FILE: ${{ matrix.legs.SD_FILE }}
2021-05-10 20:34:33 +08:00
steps:
- uses: actions/checkout@v1
2021-06-17 21:50:46 +08:00
- name: Install Tools
shell: bash
run: |
sudo apt-get update
sudo apt-get -yqq install scons qemu-system git
- name: Install Arm ToolChains
if: ${{ matrix.legs.QEMU_ARCH == 'arm' && success() }}
shell: bash
2021-05-10 20:34:33 +08:00
run: |
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/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
2021-06-17 21:50:46 +08:00
echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV
- name: Install RISC-V ToolChains
if: ${{ matrix.legs.QEMU_ARCH == 'riscv64' && success() }}
run: |
wget -q https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/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: Build BSP
run: |
cp examples/utest/configs/$TEST_CONFIG_FILE $TEST_BSP_ROOT/rtconfig.h
2021-05-10 20:34:33 +08:00
scons -j$(nproc) -C $TEST_BSP_ROOT
2021-06-17 21:50:46 +08:00
- name: Start Test
if: ${{ success() }}
2021-05-10 20:34:33 +08:00
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
2021-06-17 21:50:46 +08:00
if [ $TEST_SD_FILE != "None" ]; then
python3 qemu_runner.py --system $TEST_QEMU_ARCH --machine $TEST_QEMU_MACHINE --elf ../$TEST_BSP_ROOT/rtthread.elf --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.elf
fi
2021-05-10 20:34:33 +08:00
cat rtt_console.log
2021-06-17 21:50:46 +08:00
popd