summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/.github/workflows/spec_test_on_nuttx.yml
blob: 7b8403777fa1d1daea6ef2d4ebddf994d22683fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright (C) 2019 Intel Corporation.  All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: spec test on nuttx

on:
  schedule:
    - cron:  '0 0 * * *'

  workflow_dispatch:

env:
  LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
  WASI_SDK_PATH: "/opt/wasi-sdk"

jobs:
  build_llvm_libraries:
    uses: ./.github/workflows/build_llvm_libraries.yml
    with:
      os: "ubuntu-22.04"
      arch: "ARM RISCV AArch64"

  spec_test_on_qemu:
    runs-on: ${{ matrix.os }}
    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",
        ]
        wamr_test_option: [
          # "-t fast-interp",
          "-t aot",
          "-t aot -X"
        ]
        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

      - name: Install RISC-V Compilers
        if: contains(matrix.nuttx_board_config, 'risc-v')
        run: |
          curl -L 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 > riscv.tar.gz
          tar xvf riscv.tar.gz
          echo "$PWD/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_PATH

      - name: Install WASI-SDK
        run: |
          curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz > wasi-sdk.tar.gz
          tar xvf wasi-sdk.tar.gz
          sudo mv wasi-sdk-* /opt/wasi-sdk

      - name: Checkout NuttX
        uses: actions/checkout@v3
        with:
          repository: apache/incubator-nuttx
          path: nuttx

      - name: Checkout NuttX Apps
        uses: actions/checkout@v3
        with:
          repository: apache/incubator-nuttx-apps
          path: apps

      - name: Checkout WAMR
        uses: actions/checkout@v3
        with:
          repository: ${{ github.repository }}
          path: apps/interpreters/wamr/wamr

      - name: Get LLVM libraries
        id: retrieve_llvm_libs
        uses: actions/cache@v3
        with:
          path: |
            ./core/deps/llvm/build/bin
            ./core/deps/llvm/build/include
            ./core/deps/llvm/build/lib
            ./core/deps/llvm/build/libexec
            ./core/deps/llvm/build/share
          key: ${{ matrix.llvm_cache_key }}

      - name: Quit if cache miss
        if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
        run: echo "::error::can not get prebuilt llvm libraries" && exit 1

      - name: Copy LLVM
        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'

      - name: Build wamrc
        working-directory: apps/interpreters/wamr/wamr/wamr-compiler
        run: |
          cmake -Bbuild .
          cmake --build build

      - name: Build
        run: |
          cd nuttx
          tools/configure.sh ${{ matrix.nuttx_board_config }}
          make -j$(nproc)
          echo "firmware=$PWD/nuttx" >> $GITHUB_ENV

      - name: Test on ARM
        if: endsWith(matrix.nuttx_board_config, 'sabre-6quad/configs/nsh')
        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 }}

      - name: Test on RISCV32
        if: endsWith(matrix.nuttx_board_config, 'rv-virt/configs/nsh')
        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')
        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 }}