Skip to content

Commit c3bd6b4

Browse files
authored
spec_test_on_nuttx.yml: Replace sed with kconfig-tweak (bytecodealliance#3672)
Fixes: bytecodealliance#3646
1 parent 6be4b53 commit c3bd6b4

File tree

1 file changed

+68
-53
lines changed

1 file changed

+68
-53
lines changed

.github/workflows/spec_test_on_nuttx.yml

Lines changed: 68 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ on:
2828
env:
2929
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
3030
WASI_SDK_PATH: "/opt/wasi-sdk"
31-
WAMR_COMMON_OPTION:
32-
"CONFIG_INTERPRETERS_WAMR=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\\nCONFIG_EOL_IS_LF=y\\nCONFIG_LIBC_FLOATINGPOINT=y\\nCONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE=1024\\n"
33-
HOSTFS_OPTION:
34-
"CONFIG_ARM_SEMIHOSTING_HOSTFS=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE=y\\nCONFIG_RISCV_SEMIHOSTING_HOSTFS=y\\nCONFIG_FS_HOSTFS=y\\n"
3531

3632
jobs:
3733
build_llvm_libraries:
@@ -98,26 +94,26 @@ jobs:
9894
wamr_test_option: [
9995
{
10096
mode: "-t aot",
101-
option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
97+
option: "CONFIG_INTERPRETERS_WAMR_AOT"
10298
},
10399
{
104100
mode: "-t aot -X",
105-
option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
101+
option: "CONFIG_INTERPRETERS_WAMR_AOT"
106102
},
107103
# {
108104
# mode: "-t classic-interp",
109-
# option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
105+
# option: "CONFIG_INTERPRETERS_WAMR_CLASSIC"
110106
# },
111107
# {
112108
# mode: "-t fast-interp",
113-
# option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
109+
# option: "CONFIG_INTERPRETERS_WAMR_FAST"
114110
# },
115111
]
116112

117113
wamr_feature_option:
118114
# Empty option for default
119115
- { option: "", mode: "" }
120-
- { option: "CONFIG_INTERPRETERS_WAMR_GC=y\\nCONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME=y\\n", mode: "-G" }
116+
- { option: "CONFIG_INTERPRETERS_WAMR_GC CONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME", mode: "-G" }
121117

122118
exclude:
123119
# XIP is not fully supported yet on RISCV64, some relocations can not be resolved
@@ -194,47 +190,92 @@ jobs:
194190
echo "\tbool \"Enable Tail Call\"" >> apps/interpreters/wamr/Kconfig
195191
echo "\tdefault y" >> apps/interpreters/wamr/Kconfig
196192
193+
- name: Build wamrc
194+
if: contains(matrix.wamr_test_option.mode, 'aot')
195+
working-directory: apps/interpreters/wamr/wamr/wamr-compiler
196+
run: |
197+
cmake -Bbuild .
198+
cmake --build build
199+
200+
# the nuttx version we use for xtensa requires esptool.py newer than
201+
# what we have in our version of the apache-nuttx-ci-linux image.
202+
- name: Install the latest esptool.py (xtensa)
203+
if: matrix.target_config.target == 'xtensa'
204+
run: |
205+
pip3 install esptool==4.7.0
206+
esptool.py version
207+
208+
- name: Configure NuttX
209+
run: |
210+
tools/configure.sh ${{ matrix.target_config.config }}
211+
working-directory: nuttx
212+
213+
# depending on configurations, the iwasm command line generated
214+
# by spec-test-script can be longer than the default NSH_LINELEN,
215+
# which is 64 or 80.
197216
- name: Enable WAMR for NuttX
198217
run: |
199-
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.WAMR_COMMON_OPTION }}'
218+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
219+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LOG
220+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN
221+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_REF_TYPES
222+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST
223+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_SHARED_MEMORY
224+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_BULK_MEMORY
225+
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE 1024
226+
kconfig-tweak --enable CONFIG_FS_HOSTFS
227+
kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS
228+
kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
229+
kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS
230+
kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
231+
kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS
232+
kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
233+
kconfig-tweak --enable CONFIG_EOL_IS_LF
234+
kconfig-tweak --enable CONFIG_LIBC_FLOATINGPOINT
235+
kconfig-tweak --set-val CONFIG_NSH_LINELEN 255
236+
working-directory: nuttx
200237

201238
- name: Set WAMR stack size for NuttX
202239
if: matrix.target_config.target != 'xtensa'
203240
run: |
204-
find nuttx/boards -name defconfig | xargs sed -i '$aCONFIG_INTERPRETERS_WAMR_STACKSIZE=327680\n'
241+
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 327680
242+
working-directory: nuttx
205243

206244
# because qemu doesn't have a proper emulation of esp32s3 psram,
207245
# we are limited to the internal ram, which is about 400KB.
208246
- name: Set WAMR stack size for NuttX (xtensa)
209247
if: matrix.target_config.target == 'xtensa'
210248
run: |
211-
find nuttx/boards -name defconfig | xargs sed -i '$aCONFIG_INTERPRETERS_WAMR_STACKSIZE=25600\n'
212-
213-
# Note: the nuttx config we happened to use for xtensa already has
214-
# hostfs enabled.
215-
- name: Enable hostfs for NuttX
216-
if: matrix.target_config.target != 'xtensa'
217-
run: |
218-
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.HOSTFS_OPTION }}'
249+
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 25600
250+
working-directory: nuttx
219251

220-
- name: Enable WAMR Interpreter for NuttX
252+
- name: Enable WAMR interpreter/aot runtime for NuttX
253+
if: matrix.wamr_test_option.option != ''
221254
run: |
222-
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_test_option.option }}'
255+
for x in ${{ matrix.wamr_test_option.option }}; do
256+
kconfig-tweak --enable $x
257+
done
258+
working-directory: nuttx
223259

224-
- name: Enable WAMR Feature for NuttX
260+
- name: Enable WAMR Features for NuttX
225261
if: matrix.wamr_feature_option.option != ''
226262
run: |
227-
find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_feature_option.option }}'
263+
for x in ${{ matrix.wamr_feature_option.option }}; do
264+
kconfig-tweak --enable $x
265+
done
266+
working-directory: nuttx
228267

229268
- name: Disable FPU for NuttX
230269
if: matrix.target_config.fpu_type == 'none'
231270
run: |
232-
find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_FPU is not set\n'
271+
kconfig-tweak --disable CONFIG_ARCH_FPU
272+
working-directory: nuttx
233273

234274
- name: Disable DPFPU for NuttX
235275
if: matrix.target_config.fpu_type == 'fp'
236276
run: |
237-
find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_DPFPU is not set\n'
277+
kconfig-tweak --disable CONFIG_ARCH_DPFPU
278+
working-directory: nuttx
238279

239280
# Note: while a real hardware would need
240281
# INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR=y,
@@ -245,34 +286,8 @@ jobs:
245286
- name: Tweak NuttX config (xtensa)
246287
if: matrix.target_config.target == 'xtensa'
247288
run: |
248-
find nuttx/boards -name defconfig | xargs sed -i '$aCONFIG_INTERPRETERS_WAMR_AOT_WORD_ALIGN_READ=y\n\# CONFIG_INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR is not set\n'
249-
250-
- name: Build wamrc
251-
if: contains(matrix.wamr_test_option.mode, 'aot')
252-
working-directory: apps/interpreters/wamr/wamr/wamr-compiler
253-
run: |
254-
cmake -Bbuild .
255-
cmake --build build
256-
257-
# the nuttx version we use for xtensa requires esptool.py newer than
258-
# what we have in our version of the apache-nuttx-ci-linux image.
259-
- name: Install the latest esptool.py (xtensa)
260-
if: matrix.target_config.target == 'xtensa'
261-
run: |
262-
pip3 install esptool==4.7.0
263-
esptool.py version
264-
265-
- name: Configure NuttX
266-
run: |
267-
tools/configure.sh ${{ matrix.target_config.config }}
268-
working-directory: nuttx
269-
270-
# depending on configurations, the iwasm command line generated
271-
# by spec-test-script can be longer than the default NSH_LINELEN,
272-
# which is 64 or 80.
273-
- name: Tweak NuttX config
274-
run: |
275-
kconfig-tweak --set-val CONFIG_NSH_LINELEN 255
289+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_AOT_WORD_ALIGN_READ
290+
kconfig-tweak --disable CONFIG_INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR
276291
working-directory: nuttx
277292

278293
- name: Build NuttX

0 commit comments

Comments
 (0)