forked from bytecodealliance/wasm-micro-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (187 loc) · 7.72 KB
/
spec_test_on_nuttx.yml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: spec test on nuttx
on:
pull_request:
types:
- opened
- synchronize
paths:
- ".github/workflows/spec_test_on_nuttx.yml"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
# Note on INTERPRETERS_WAMR_STACK_GUARD_SIZE:
# https://github.com/apache/nuttx-apps/pull/2241 is not included in
# releases/12.4 branch as of writing this.
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=327680\\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\\nCONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE=1024\\n"
jobs:
build_llvm_libraries:
uses: ./.github/workflows/build_llvm_libraries.yml
with:
os: "ubuntu-22.04"
arch: "ARM RISCV AArch64"
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
spec_test_on_qemu:
runs-on: ubuntu-latest
needs: [build_llvm_libraries]
container:
image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
strategy:
matrix:
target_config: [
# {
# config: "boards/arm64/qemu/qemu-armv8a/configs/nsh",
# target: "aarch64_vfp",
# fpu_type: "fp"
# },
# {
# config: "boards/arm/imx6/sabre-6quad/configs/nsh",
# target: "thumbv7",
# fpu_type: "none"
# },
{
config: "boards/arm/imx6/sabre-6quad/configs/nsh",
target: "thumbv7_vfp",
fpu_type: "dp"
},
{
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
target: "riscv32",
fpu_type: "none"
},
# {
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
# target: "riscv32_ilp32d",
# fpu_type: "dp"
# },
{
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
target: "riscv64",
fpu_type: "none"
},
]
wamr_test_option: [
{
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"
# },
]
wamr_feature_option:
# Empty option for default
- { option: "", mode: "" }
- { option: "CONFIG_INTERPRETERS_WAMR_GC=y\\nCONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME=y\\n", mode: "-G" }
exclude:
# XIP is not fully supported yet on RISCV64, some relocations can not be resolved
- target_config: { config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64" }
wamr_test_option: { mode: "-t aot -X" }
steps:
- name: Checkout NuttX
uses: actions/checkout@v4
with:
repository: apache/nuttx
ref: releases/12.4
path: nuttx
- name: Checkout NuttX Apps
uses: actions/checkout@v4
with:
repository: apache/nuttx-apps
ref: releases/12.4
path: apps
- name: Checkout WAMR
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: apps/interpreters/wamr/wamr
- name: Get LLVM libraries
if: contains(matrix.wamr_test_option.mode, 'aot')
id: retrieve_llvm_libs
uses: actions/cache@v4
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: ${{ needs.build_llvm_libraries.outputs.cache_key }}
- name: Quit if cache miss
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
# Inject the config option to NuttX
# TODO: Merge this into NuttX once GC is generally available
- name: Modify Kconfig
run: |
echo "\n" >> apps/interpreters/wamr/Kconfig
echo "config INTERPRETERS_WAMR_GC" >> apps/interpreters/wamr/Kconfig
echo "\tbool \"Enable GC\"" >> apps/interpreters/wamr/Kconfig
echo "\tdefault n" >> apps/interpreters/wamr/Kconfig
echo "\n" >> apps/interpreters/wamr/Kconfig
echo "config INTERPRETERS_WAMR_AOT_STACK_FRAME" >> apps/interpreters/wamr/Kconfig
echo "\tbool \"Enable AOT stack frame\"" >> apps/interpreters/wamr/Kconfig
echo "\tdefault n" >> apps/interpreters/wamr/Kconfig
echo "\n" >> apps/interpreters/wamr/Kconfig
echo "config INTERPRETERS_WAMR_TAIL_CALL" >> apps/interpreters/wamr/Kconfig
echo "\tbool \"Enable Tail Call\"" >> apps/interpreters/wamr/Kconfig
echo "\tdefault y" >> apps/interpreters/wamr/Kconfig
- name: Enable WAMR for NuttX
run: |
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 WAMR Feature for NuttX
if: matrix.wamr_feature_option.option != ''
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_feature_option.option }}'
- name: Disable FPU for NuttX
if: matrix.target_config.fpu_type == 'none'
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_FPU is not set\n'
- name: Disable DPFPU for NuttX
if: matrix.target_config.fpu_type == 'fp'
run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_DPFPU 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.target_config.config }}
make -j$(nproc)
echo "firmware=$PWD/nuttx" >> $GITHUB_OUTPUT
- name: Test
run: |
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}