Jelajahi Sumber

spec_test_on_nuttx.yml: Replace sed with kconfig-tweak (#3672)

Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/3646
YAMAMOTO Takashi 1 tahun lalu
induk
melakukan
c3bd6b495b
1 mengubah file dengan 68 tambahan dan 53 penghapusan
  1. 68 53
      .github/workflows/spec_test_on_nuttx.yml

+ 68 - 53
.github/workflows/spec_test_on_nuttx.yml

@@ -28,10 +28,6 @@ on:
 env:
 env:
   LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
   LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
   WASI_SDK_PATH: "/opt/wasi-sdk"
   WASI_SDK_PATH: "/opt/wasi-sdk"
-  WAMR_COMMON_OPTION:
-    "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"
-  HOSTFS_OPTION:
-    "CONFIG_ARM_SEMIHOSTING_HOSTFS=y\\nCONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE=y\\nCONFIG_RISCV_SEMIHOSTING_HOSTFS=y\\nCONFIG_FS_HOSTFS=y\\n"
 
 
 jobs:
 jobs:
   build_llvm_libraries:
   build_llvm_libraries:
@@ -98,26 +94,26 @@ jobs:
         wamr_test_option: [
         wamr_test_option: [
           {
           {
             mode: "-t aot",
             mode: "-t aot",
-            option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
+            option: "CONFIG_INTERPRETERS_WAMR_AOT"
           },
           },
           {
           {
             mode: "-t aot -X",
             mode: "-t aot -X",
-            option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
+            option: "CONFIG_INTERPRETERS_WAMR_AOT"
           },
           },
           # {
           # {
           #   mode: "-t classic-interp",
           #   mode: "-t classic-interp",
-          #   option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
+          #   option: "CONFIG_INTERPRETERS_WAMR_CLASSIC"
           # },
           # },
           # {
           # {
           #   mode: "-t fast-interp",
           #   mode: "-t fast-interp",
-          #   option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
+          #   option: "CONFIG_INTERPRETERS_WAMR_FAST"
           # },
           # },
         ]
         ]
 
 
         wamr_feature_option:
         wamr_feature_option:
           # Empty option for default
           # Empty option for default
           - { option: "", mode: "" }
           - { option: "", mode: "" }
-          - { option: "CONFIG_INTERPRETERS_WAMR_GC=y\\nCONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME=y\\n", mode: "-G" }
+          - { option: "CONFIG_INTERPRETERS_WAMR_GC CONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME", mode: "-G" }
 
 
         exclude:
         exclude:
           # XIP is not fully supported yet on RISCV64, some relocations can not be resolved
           # XIP is not fully supported yet on RISCV64, some relocations can not be resolved
@@ -194,47 +190,92 @@ jobs:
           echo "\tbool \"Enable Tail Call\"" >> apps/interpreters/wamr/Kconfig
           echo "\tbool \"Enable Tail Call\"" >> apps/interpreters/wamr/Kconfig
           echo "\tdefault y" >> apps/interpreters/wamr/Kconfig
           echo "\tdefault y" >> apps/interpreters/wamr/Kconfig
 
 
+      - 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
+
+      # the nuttx version we use for xtensa requires esptool.py newer than
+      # what we have in our version of the apache-nuttx-ci-linux image.
+      - name: Install the latest esptool.py (xtensa)
+        if: matrix.target_config.target == 'xtensa'
+        run: |
+          pip3 install esptool==4.7.0
+          esptool.py version
+
+      - name: Configure NuttX
+        run: |
+          tools/configure.sh ${{ matrix.target_config.config }}
+        working-directory: nuttx
+
+      # depending on configurations, the iwasm command line generated
+      # by spec-test-script can be longer than the default NSH_LINELEN,
+      # which is 64 or 80.
       - name: Enable WAMR for NuttX
       - name: Enable WAMR for NuttX
         run: |
         run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.WAMR_COMMON_OPTION }}'
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LOG
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_REF_TYPES
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_SHARED_MEMORY
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_BULK_MEMORY
+          kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE 1024
+          kconfig-tweak --enable CONFIG_FS_HOSTFS
+          kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS
+          kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
+          kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS
+          kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
+          kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS
+          kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
+          kconfig-tweak --enable CONFIG_EOL_IS_LF
+          kconfig-tweak --enable CONFIG_LIBC_FLOATINGPOINT
+          kconfig-tweak --set-val CONFIG_NSH_LINELEN 255
+        working-directory: nuttx
 
 
       - name: Set WAMR stack size for NuttX
       - name: Set WAMR stack size for NuttX
         if: matrix.target_config.target != 'xtensa'
         if: matrix.target_config.target != 'xtensa'
         run: |
         run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$aCONFIG_INTERPRETERS_WAMR_STACKSIZE=327680\n'
+          kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 327680
+        working-directory: nuttx
 
 
       # because qemu doesn't have a proper emulation of esp32s3 psram,
       # because qemu doesn't have a proper emulation of esp32s3 psram,
       # we are limited to the internal ram, which is about 400KB.
       # we are limited to the internal ram, which is about 400KB.
       - name: Set WAMR stack size for NuttX (xtensa)
       - name: Set WAMR stack size for NuttX (xtensa)
         if: matrix.target_config.target == 'xtensa'
         if: matrix.target_config.target == 'xtensa'
         run: |
         run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$aCONFIG_INTERPRETERS_WAMR_STACKSIZE=25600\n'
-
-      # Note: the nuttx config we happened to use for xtensa already has
-      # hostfs enabled.
-      - name: Enable hostfs for NuttX
-        if: matrix.target_config.target != 'xtensa'
-        run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.HOSTFS_OPTION }}'
+          kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 25600
+        working-directory: nuttx
       
       
-      - name: Enable WAMR Interpreter for NuttX
+      - name: Enable WAMR interpreter/aot runtime for NuttX
+        if: matrix.wamr_test_option.option != ''
         run: |
         run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_test_option.option }}'
+          for x in ${{ matrix.wamr_test_option.option }}; do
+            kconfig-tweak --enable $x
+          done
+        working-directory: nuttx
 
 
-      - name: Enable WAMR Feature for NuttX
+      - name: Enable WAMR Features for NuttX
         if: matrix.wamr_feature_option.option != ''
         if: matrix.wamr_feature_option.option != ''
         run: |
         run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_feature_option.option }}'
+          for x in ${{ matrix.wamr_feature_option.option }}; do
+            kconfig-tweak --enable $x
+          done
+        working-directory: nuttx
 
 
       - name: Disable FPU for NuttX
       - name: Disable FPU for NuttX
         if: matrix.target_config.fpu_type == 'none'
         if: matrix.target_config.fpu_type == 'none'
         run: |
         run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_FPU is not set\n'
+          kconfig-tweak --disable CONFIG_ARCH_FPU
+        working-directory: nuttx
 
 
       - name: Disable DPFPU for NuttX
       - name: Disable DPFPU for NuttX
         if: matrix.target_config.fpu_type == 'fp'
         if: matrix.target_config.fpu_type == 'fp'
         run: |
         run: |
-          find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_DPFPU is not set\n'
+          kconfig-tweak --disable CONFIG_ARCH_DPFPU
+        working-directory: nuttx
 
 
       # Note: while a real hardware would need
       # Note: while a real hardware would need
       # INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR=y,
       # INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR=y,
@@ -245,34 +286,8 @@ jobs:
       - name: Tweak NuttX config (xtensa)
       - name: Tweak NuttX config (xtensa)
         if: matrix.target_config.target == 'xtensa'
         if: matrix.target_config.target == 'xtensa'
         run: |
         run: |
-          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'
-
-      - 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
-
-      # the nuttx version we use for xtensa requires esptool.py newer than
-      # what we have in our version of the apache-nuttx-ci-linux image.
-      - name: Install the latest esptool.py (xtensa)
-        if: matrix.target_config.target == 'xtensa'
-        run: |
-          pip3 install esptool==4.7.0
-          esptool.py version
-
-      - name: Configure NuttX
-        run: |
-          tools/configure.sh ${{ matrix.target_config.config }}
-        working-directory: nuttx
-
-      # depending on configurations, the iwasm command line generated
-      # by spec-test-script can be longer than the default NSH_LINELEN,
-      # which is 64 or 80.
-      - name: Tweak NuttX config
-        run: |
-          kconfig-tweak --set-val CONFIG_NSH_LINELEN 255
+          kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_AOT_WORD_ALIGN_READ
+          kconfig-tweak --disable CONFIG_INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR
         working-directory: nuttx
         working-directory: nuttx
 
 
       - name: Build NuttX
       - name: Build NuttX