spec_test_on_nuttx.yml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: spec test on nuttx
  4. on:
  5. pull_request:
  6. types:
  7. - opened
  8. - synchronize
  9. paths:
  10. - ".github/workflows/spec_test_on_nuttx.yml"
  11. - "core/**"
  12. - "!core/deps/**"
  13. - "product-mini/**"
  14. - "!samples/workload/**"
  15. - "tests/wamr-test-suites/**"
  16. - "wamr-compiler/**"
  17. - "wamr-sdk/**"
  18. schedule:
  19. - cron: '0 0 * * *'
  20. workflow_dispatch:
  21. # Note on INTERPRETERS_WAMR_STACK_GUARD_SIZE:
  22. # https://github.com/apache/nuttx-apps/pull/2241 is not included in
  23. # releases/12.4 branch as of writing this.
  24. env:
  25. LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
  26. WASI_SDK_PATH: "/opt/wasi-sdk"
  27. WAMR_COMMON_OPTION:
  28. "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"
  29. jobs:
  30. build_llvm_libraries:
  31. uses: ./.github/workflows/build_llvm_libraries.yml
  32. with:
  33. os: "ubuntu-22.04"
  34. arch: "ARM RISCV AArch64"
  35. container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
  36. spec_test_on_qemu:
  37. runs-on: ubuntu-latest
  38. needs: [build_llvm_libraries]
  39. container:
  40. image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
  41. strategy:
  42. matrix:
  43. target_config: [
  44. # {
  45. # config: "boards/arm64/qemu/qemu-armv8a/configs/nsh",
  46. # target: "aarch64_vfp",
  47. # fpu_type: "fp"
  48. # },
  49. # {
  50. # config: "boards/arm/imx6/sabre-6quad/configs/nsh",
  51. # target: "thumbv7",
  52. # fpu_type: "none"
  53. # },
  54. {
  55. config: "boards/arm/imx6/sabre-6quad/configs/nsh",
  56. target: "thumbv7_vfp",
  57. fpu_type: "dp"
  58. },
  59. {
  60. config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
  61. target: "riscv32",
  62. fpu_type: "none"
  63. },
  64. # {
  65. # config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
  66. # target: "riscv32_ilp32d",
  67. # fpu_type: "dp"
  68. # },
  69. {
  70. config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
  71. target: "riscv64",
  72. fpu_type: "none"
  73. },
  74. ]
  75. wamr_test_option: [
  76. {
  77. mode: "-t aot",
  78. option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
  79. },
  80. # {
  81. # mode: "-t aot -X",
  82. # option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
  83. # },
  84. # {
  85. # mode: "-t classic-interp",
  86. # option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
  87. # },
  88. # {
  89. # mode: "-t fast-interp",
  90. # option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
  91. # },
  92. ]
  93. wamr_feature_option:
  94. # Empty option for default
  95. - { option: "", mode: "" }
  96. - { option: "CONFIG_INTERPRETERS_WAMR_GC=y\\nCONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME=y\\n", mode: "-G" }
  97. exclude:
  98. # XIP is not fully supported yet on RISCV64, some relocations can not be resolved
  99. - target_config: { config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64" }
  100. wamr_test_option: { mode: "-t aot -X" }
  101. steps:
  102. - name: Checkout NuttX
  103. uses: actions/checkout@v4
  104. with:
  105. repository: apache/incubator-nuttx
  106. ref: releases/12.4
  107. path: nuttx
  108. - name: Checkout NuttX Apps
  109. uses: actions/checkout@v4
  110. with:
  111. repository: apache/incubator-nuttx-apps
  112. ref: releases/12.4
  113. path: apps
  114. - name: Checkout WAMR
  115. uses: actions/checkout@v4
  116. with:
  117. repository: ${{ github.repository }}
  118. path: apps/interpreters/wamr/wamr
  119. - name: Get LLVM libraries
  120. if: contains(matrix.wamr_test_option.mode, 'aot')
  121. id: retrieve_llvm_libs
  122. uses: actions/cache@v4
  123. with:
  124. path: |
  125. ./core/deps/llvm/build/bin
  126. ./core/deps/llvm/build/include
  127. ./core/deps/llvm/build/lib
  128. ./core/deps/llvm/build/libexec
  129. ./core/deps/llvm/build/share
  130. key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
  131. - name: Quit if cache miss
  132. if: contains(matrix.wamr_test_option.mode, 'aot') && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  133. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  134. - name: Copy LLVM
  135. if: contains(matrix.wamr_test_option.mode, 'aot')
  136. run: cp -r core/deps/llvm apps/interpreters/wamr/wamr/core/deps/llvm
  137. # Inject the config option to NuttX
  138. # TODO: Merge this into NuttX once GC is generally available
  139. - name: Modify Kconfig
  140. run: |
  141. echo "\n" >> apps/interpreters/wamr/Kconfig
  142. echo "config INTERPRETERS_WAMR_GC" >> apps/interpreters/wamr/Kconfig
  143. echo "\tbool \"Enable GC\"" >> apps/interpreters/wamr/Kconfig
  144. echo "\tdefault n" >> apps/interpreters/wamr/Kconfig
  145. echo "\n" >> apps/interpreters/wamr/Kconfig
  146. echo "config INTERPRETERS_WAMR_AOT_STACK_FRAME" >> apps/interpreters/wamr/Kconfig
  147. echo "\tbool \"Enable AOT stack frame\"" >> apps/interpreters/wamr/Kconfig
  148. echo "\tdefault n" >> apps/interpreters/wamr/Kconfig
  149. echo "\n" >> apps/interpreters/wamr/Kconfig
  150. echo "config INTERPRETERS_WAMR_TAIL_CALL" >> apps/interpreters/wamr/Kconfig
  151. echo "\tbool \"Enable Tail Call\"" >> apps/interpreters/wamr/Kconfig
  152. echo "\tdefault y" >> apps/interpreters/wamr/Kconfig
  153. - name: Enable WAMR for NuttX
  154. run: |
  155. find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.WAMR_COMMON_OPTION }}'
  156. - name: Enable WAMR Interpreter for NuttX
  157. run: |
  158. find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_test_option.option }}'
  159. - name: Enable WAMR Feature for NuttX
  160. if: matrix.wamr_feature_option.option != ''
  161. run: |
  162. find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_feature_option.option }}'
  163. - name: Disable FPU for NuttX
  164. if: matrix.target_config.fpu_type == 'none'
  165. run: |
  166. find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_FPU is not set\n'
  167. - name: Disable DPFPU for NuttX
  168. if: matrix.target_config.fpu_type == 'fp'
  169. run: |
  170. find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_DPFPU is not set\n'
  171. - name: Build wamrc
  172. if: contains(matrix.wamr_test_option.mode, 'aot')
  173. working-directory: apps/interpreters/wamr/wamr/wamr-compiler
  174. run: |
  175. cmake -Bbuild .
  176. cmake --build build
  177. - name: Build
  178. id: build_firmware
  179. run: |
  180. cd nuttx
  181. tools/configure.sh ${{ matrix.target_config.config }}
  182. make -j$(nproc)
  183. echo "firmware=$PWD/nuttx" >> $GITHUB_OUTPUT
  184. - name: Test
  185. run: |
  186. cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
  187. ./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}}