Run spec test for classic/fast-interp in NuttX CI (#2817)

This commit is contained in:
Huang Qi
2023-11-27 15:24:02 +08:00
committed by GitHub
parent 5377e18623
commit d7608690c0
5 changed files with 155 additions and 95 deletions

View File

@ -18,6 +18,8 @@ on:
env:
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
WASI_SDK_PATH: "/opt/wasi-sdk"
WAMR_COMMON_OPTION:
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_STACKSIZE=32768\\nCONFIG_INTERPRETERS_WAMR_LOG=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\nCONFIG_INTERPRETERS_WAMR_REF_TYPES=y\\nCONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST=y\\nCONFIG_INTERPRETERS_WAMR_SHARED_MEMORY=y\\nCONFIG_INTERPRETERS_WAMR_BULK_MEMORY=y\\nCONFIG_EOL_IS_LF=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE=y\\nCONFIG_RISCV_SEMIHOSTING_HOSTFS=y\\nCONFIG_FS_HOSTFS=y\\nCONFIG_LIBC_FLOATINGPOINT=y\\n"
jobs:
build_llvm_libraries:
@ -27,36 +29,78 @@ jobs:
arch: "ARM RISCV AArch64"
spec_test_on_qemu:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
needs: [build_llvm_libraries]
strategy:
matrix:
os: [ubuntu-22.04]
nuttx_board_config: [
# cortex-a9
"boards/arm/imx6/sabre-6quad/configs/nsh",
# riscv32imac
"boards/risc-v/qemu-rv/rv-virt/configs/nsh",
# riscv64imac
# "boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
target_config: [
# {
# config: "boards/arm64/qemu/qemu-armv8a/configs/nsh",
# target: "aarch64_vfp",
# use_fpu: true
# },
# {
# config: "boards/arm/imx6/sabre-6quad/configs/nsh",
# target: "thumbv7",
# use_fpu: false
# },
{
config: "boards/arm/imx6/sabre-6quad/configs/nsh",
target: "thumbv7_vfp",
use_fpu: true
},
{
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
target: "riscv32",
use_fpu: false
},
# {
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
# target: "riscv32_ilp32d",
# use_fpu: true
# },
# {
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
# target: "riscv64",
# use_fpu: false
# },
]
wamr_test_option: [
# "-t fast-interp",
"-t aot",
"-t aot -X"
{
mode: "-t aot",
option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
},
{
mode: "-t aot -X",
option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
},
{
mode: "-t classic-interp",
option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
},
{
mode: "-t fast-interp",
option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
},
]
llvm_cache_key: [ "${{ needs.build_llvm_libraries.outputs.cache_key }}" ]
steps:
- name: Install Utilities
run: |
sudo apt install -y kconfig-frontends-nox genromfs
- name: Install ARM Compilers
if: contains(matrix.nuttx_board_config, 'arm')
run: sudo apt install -y gcc-arm-none-eabi
if: startsWith(matrix.target_config.config, 'boards/arm')
run: |
sudo apt install -y gcc-arm-none-eabi
wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz
xz -d gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz
tar xf gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar
echo "$PWD/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin" >> $GITHUB_PATH
- name: Install RISC-V Compilers
if: contains(matrix.nuttx_board_config, 'risc-v')
if: startsWith(matrix.target_config.config, 'boards/risc-v')
run: |
curl -L https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v12.3.0-1/xpack-riscv-none-elf-gcc-12.3.0-1-linux-x64.tar.gz > riscv.tar.gz
tar xvf riscv.tar.gz
@ -87,6 +131,7 @@ jobs:
path: apps/interpreters/wamr/wamr
- name: Get LLVM libraries
if: contains(matrix.wamr_test_option.mode, 'aot')
id: retrieve_llvm_libs
uses: actions/cache@v3
with:
@ -96,61 +141,59 @@ jobs:
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.llvm_cache_key }}
key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
- name: Quit if cache miss
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
if: contains(matrix.wamr_test_option.mode, 'aot') && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Copy LLVM
if: contains(matrix.wamr_test_option.mode, 'aot')
run: cp -r core/deps/llvm apps/interpreters/wamr/wamr/core/deps/llvm
- name: Enable WAMR for NuttX
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_STACKSIZE=32768\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=y\nCONFIG_INTERPRETERS_WAMR_LOG=y\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\nCONFIG_INTERPRETERS_WAMR_REF_TYPES=y\nCONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST=y\nCONFIG_INTERPRETERS_WAMR_SHARED_MEMORY=y\nCONFIG_INTERPRETERS_WAMR_BULK_MEMORY=y\n'
find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_EOL_IS_LF=y\nCONFIG_ARM_SEMIHOSTING_HOSTFS=y\nCONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE=y\nCONFIG_RISCV_SEMIHOSTING_HOSTFS=y\nCONFIG_FS_HOSTFS=y\nCONFIG_LIBC_FLOATINGPOINT=y\n'
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.WAMR_COMMON_OPTION }}'
- name: Enable WAMR Interpreter for NuttX
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_test_option.option }}'
- name: Enable additional features for NuttX on RI5C-V
if: startsWith(matrix.nuttx_board_config, 'boards/risc-v')
- name: Disable FPU for NuttX
if: matrix.target_config.use_fpu== false
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_FPU is not set\n'
- name: Build wamrc
if: contains(matrix.wamr_test_option.mode, 'aot')
working-directory: apps/interpreters/wamr/wamr/wamr-compiler
run: |
cmake -Bbuild .
cmake --build build
- name: Build
id: build_firmware
run: |
cd nuttx
tools/configure.sh ${{ matrix.nuttx_board_config }}
tools/configure.sh ${{ matrix.target_config.config }}
make -j$(nproc)
echo "firmware=$PWD/nuttx" >> $GITHUB_ENV
echo "firmware=$PWD/nuttx" >> $GITHUB_OUTPUT
- name: Test on ARM
if: endsWith(matrix.nuttx_board_config, 'sabre-6quad/configs/nsh')
- name: Install QEMU for ARM
if: startsWith(matrix.target_config.config, 'boards/arm')
run: |
curl -L https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v7.1.0-1/xpack-qemu-arm-7.1.0-1-linux-x64.tar.gz > xpack-qemu-arm.tar.gz
tar xvf xpack-qemu-arm.tar.gz
export PATH=$PATH:$PWD/xpack-qemu-arm-7.1.0-1/bin
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option }} -m thumbv7_vfp -b -Q -P -F ${{ env.firmware }}
echo $PWD/xpack-qemu-arm-7.1.0-1/bin >> $GITHUB_PATH
- name: Test on RISCV32
if: endsWith(matrix.nuttx_board_config, 'rv-virt/configs/nsh')
- name: Install QEMU for RISC-V
if: startsWith(matrix.target_config.config, 'boards/risc-v')
run: |
curl -L https://github.com/xpack-dev-tools/qemu-riscv-xpack/releases/download/v7.1.0-1/xpack-qemu-riscv-7.1.0-1-linux-x64.tar.gz > xpack-qemu-riscv.tar.gz
tar xvf xpack-qemu-riscv.tar.gz
export PATH=$PATH:$PWD/xpack-qemu-riscv-7.1.0-1/bin
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option }} -m riscv32 -b -Q -P -F ${{ env.firmware }}
- name: Test on RISCV64
if: endsWith(matrix.nuttx_board_config, 'rv-virt/configs/nsh64')
echo PATH=$PATH:$PWD/xpack-qemu-riscv-7.1.0-1/bin >> $GITHUB_PATH
- name: Test
run: |
curl -L https://github.com/xpack-dev-tools/qemu-riscv-xpack/releases/download/v7.1.0-1/xpack-qemu-riscv-7.1.0-1-linux-x64.tar.gz > xpack-qemu-riscv.tar.gz
tar xvf xpack-qemu-riscv.tar.gz
export PATH=$PATH:$PWD/xpack-qemu-riscv-7.1.0-1/bin
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option }} -m riscv64 -b -Q -P -F ${{ env.firmware }}
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware.outputs.firmware }}