spec_test_on_nuttx.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. schedule:
  12. - cron: '0 0 * * *'
  13. workflow_dispatch:
  14. env:
  15. LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
  16. WASI_SDK_PATH: "/opt/wasi-sdk"
  17. WAMR_COMMON_OPTION:
  18. "CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_STACKSIZE=32768\\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\\n"
  19. jobs:
  20. build_llvm_libraries:
  21. uses: ./.github/workflows/build_llvm_libraries.yml
  22. with:
  23. os: "ubuntu-22.04"
  24. arch: "ARM RISCV AArch64"
  25. container_image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux@sha256:d9261eacf6c6ebe656c571757751c803e8f04c3ae9b820320a5ea5dd57b7205a
  26. spec_test_on_qemu:
  27. runs-on: ubuntu-latest
  28. needs: [build_llvm_libraries]
  29. container:
  30. image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux@sha256:d9261eacf6c6ebe656c571757751c803e8f04c3ae9b820320a5ea5dd57b7205a
  31. strategy:
  32. matrix:
  33. target_config: [
  34. # {
  35. # config: "boards/arm64/qemu/qemu-armv8a/configs/nsh",
  36. # target: "aarch64_vfp",
  37. # fpu_type: "fp"
  38. # },
  39. # {
  40. # config: "boards/arm/imx6/sabre-6quad/configs/nsh",
  41. # target: "thumbv7",
  42. # fpu_type: "none"
  43. # },
  44. {
  45. config: "boards/arm/imx6/sabre-6quad/configs/nsh",
  46. target: "thumbv7_vfp",
  47. fpu_type: "dp"
  48. },
  49. {
  50. config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
  51. target: "riscv32",
  52. fpu_type: "none"
  53. },
  54. # {
  55. # config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
  56. # target: "riscv32_ilp32d",
  57. # fpu_type: "dp"
  58. # },
  59. {
  60. config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
  61. target: "riscv64",
  62. fpu_type: "none"
  63. },
  64. ]
  65. wamr_test_option: [
  66. {
  67. mode: "-t aot",
  68. option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
  69. },
  70. {
  71. mode: "-t aot -X",
  72. option: "CONFIG_INTERPRETERS_WAMR_AOT=y\\n"
  73. },
  74. {
  75. mode: "-t classic-interp",
  76. option: "CONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n"
  77. },
  78. {
  79. mode: "-t fast-interp",
  80. option: "CONFIG_INTERPRETERS_WAMR_FAST=y\\n"
  81. },
  82. ]
  83. exclude:
  84. # XIP is not fully supported yet on RISCV64, some relocations can not be resolved
  85. - target_config: { config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64" }
  86. wamr_test_option: { mode: "-t aot -X" }
  87. steps:
  88. - name: Checkout NuttX
  89. uses: actions/checkout@v4
  90. with:
  91. repository: apache/incubator-nuttx
  92. ref: releases/12.4
  93. path: nuttx
  94. - name: Checkout NuttX Apps
  95. uses: actions/checkout@v4
  96. with:
  97. repository: apache/incubator-nuttx-apps
  98. ref: releases/12.4
  99. path: apps
  100. - name: Checkout WAMR
  101. uses: actions/checkout@v4
  102. with:
  103. repository: ${{ github.repository }}
  104. path: apps/interpreters/wamr/wamr
  105. - name: Get LLVM libraries
  106. if: contains(matrix.wamr_test_option.mode, 'aot')
  107. id: retrieve_llvm_libs
  108. uses: actions/cache@v4
  109. with:
  110. path: |
  111. ./core/deps/llvm/build/bin
  112. ./core/deps/llvm/build/include
  113. ./core/deps/llvm/build/lib
  114. ./core/deps/llvm/build/libexec
  115. ./core/deps/llvm/build/share
  116. key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
  117. - name: Quit if cache miss
  118. if: contains(matrix.wamr_test_option.mode, 'aot') && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  119. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  120. - name: Copy LLVM
  121. if: contains(matrix.wamr_test_option.mode, 'aot')
  122. run: cp -r core/deps/llvm apps/interpreters/wamr/wamr/core/deps/llvm
  123. - name: Enable WAMR for NuttX
  124. run: |
  125. find nuttx/boards -name defconfig | xargs sed -i '$a\${{ env.WAMR_COMMON_OPTION }}'
  126. - name: Enable WAMR Interpreter for NuttX
  127. run: |
  128. find nuttx/boards -name defconfig | xargs sed -i '$a\${{ matrix.wamr_test_option.option }}'
  129. - name: Disable FPU for NuttX
  130. if: matrix.target_config.fpu_type == 'none'
  131. run: |
  132. find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_FPU is not set\n'
  133. - name: Disable DPFPU for NuttX
  134. if: matrix.target_config.fpu_type == 'fp'
  135. run: |
  136. find nuttx/boards -name defconfig | xargs sed -i '$a\# CONFIG_ARCH_DPFPU is not set\n'
  137. - name: Build wamrc
  138. if: contains(matrix.wamr_test_option.mode, 'aot')
  139. working-directory: apps/interpreters/wamr/wamr/wamr-compiler
  140. run: |
  141. cmake -Bbuild .
  142. cmake --build build
  143. - name: Build
  144. id: build_firmware
  145. run: |
  146. cd nuttx
  147. tools/configure.sh ${{ matrix.target_config.config }}
  148. make -j$(nproc)
  149. echo "firmware=$PWD/nuttx" >> $GITHUB_OUTPUT
  150. - name: Test
  151. run: |
  152. cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
  153. ./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware.outputs.firmware }}