spec_test_on_nuttx.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. schedule:
  6. - cron: '0 0 * * *'
  7. workflow_dispatch:
  8. env:
  9. LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
  10. WASI_SDK_PATH: "/opt/wasi-sdk"
  11. jobs:
  12. build_llvm_libraries:
  13. uses: ./.github/workflows/build_llvm_libraries.yml
  14. with:
  15. os: "ubuntu-22.04"
  16. arch: "ARM RISCV AArch64"
  17. spec_test_on_qemu:
  18. runs-on: ${{ matrix.os }}
  19. needs: [build_llvm_libraries]
  20. strategy:
  21. matrix:
  22. os: [ubuntu-22.04]
  23. nuttx_board_config: [
  24. # cortex-a9
  25. "boards/arm/imx6/sabre-6quad/configs/nsh",
  26. # riscv32imac
  27. "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
  28. # riscv64imac
  29. # "boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
  30. ]
  31. wamr_test_option: [
  32. # "-t fast-interp",
  33. "-t aot",
  34. "-t aot -X"
  35. ]
  36. llvm_cache_key: [ "${{ needs.build_llvm_libraries.outputs.cache_key }}" ]
  37. steps:
  38. - name: Install Utilities
  39. run: |
  40. sudo apt install -y kconfig-frontends-nox genromfs
  41. - name: Install ARM Compilers
  42. if: contains(matrix.nuttx_board_config, 'arm')
  43. run: sudo apt install -y gcc-arm-none-eabi
  44. - name: Install RISC-V Compilers
  45. if: contains(matrix.nuttx_board_config, 'risc-v')
  46. run: |
  47. curl -L https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz > riscv.tar.gz
  48. tar xvf riscv.tar.gz
  49. echo "$PWD/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_PATH
  50. - name: Install WASI-SDK
  51. run: |
  52. curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz > wasi-sdk.tar.gz
  53. tar xvf wasi-sdk.tar.gz
  54. sudo mv wasi-sdk-* /opt/wasi-sdk
  55. - name: Checkout NuttX
  56. uses: actions/checkout@v3
  57. with:
  58. repository: apache/incubator-nuttx
  59. path: nuttx
  60. - name: Checkout NuttX Apps
  61. uses: actions/checkout@v3
  62. with:
  63. repository: apache/incubator-nuttx-apps
  64. path: apps
  65. - name: Checkout WAMR
  66. uses: actions/checkout@v3
  67. with:
  68. repository: ${{ github.repository }}
  69. path: apps/interpreters/wamr/wamr
  70. - name: Get LLVM libraries
  71. id: retrieve_llvm_libs
  72. uses: actions/cache@v3
  73. with:
  74. path: |
  75. ./core/deps/llvm/build/bin
  76. ./core/deps/llvm/build/include
  77. ./core/deps/llvm/build/lib
  78. ./core/deps/llvm/build/libexec
  79. ./core/deps/llvm/build/share
  80. key: ${{ matrix.llvm_cache_key }}
  81. - name: Quit if cache miss
  82. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  83. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  84. - name: Copy LLVM
  85. run: cp -r core/deps/llvm apps/interpreters/wamr/wamr/core/deps/llvm
  86. - name: Enable WAMR for NuttX
  87. run: |
  88. find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_INTERPRETERS_WAMR=y\nCONFIG_INTERPRETERS_WAMR_AOT=y\nCONFIG_INTERPRETERS_WAMR_FAST=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\n'
  89. find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_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'
  90. - name: Build wamrc
  91. working-directory: apps/interpreters/wamr/wamr/wamr-compiler
  92. run: |
  93. cmake -Bbuild .
  94. cmake --build build
  95. - name: Build
  96. run: |
  97. cd nuttx
  98. tools/configure.sh ${{ matrix.nuttx_board_config }}
  99. make -j$(nproc)
  100. echo "firmware=$PWD/nuttx" >> $GITHUB_ENV
  101. - name: Test on ARM
  102. if: endsWith(matrix.nuttx_board_config, 'sabre-6quad/configs/nsh')
  103. run: |
  104. curl -L https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v7.1.0-1/xpack-qemu-arm-7.1.0-1-linux-x64.tar.gz > xpack-qemu-arm.tar.gz
  105. tar xvf xpack-qemu-arm.tar.gz
  106. export PATH=$PATH:$PWD/xpack-qemu-arm-7.1.0-1/bin
  107. cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
  108. ./test_wamr.sh -s spec ${{ matrix.wamr_test_option }} -m thumbv7_vfp -b -Q -P -F ${{ env.firmware }}
  109. - name: Test on RISCV32
  110. if: endsWith(matrix.nuttx_board_config, 'rv-virt/configs/nsh')
  111. run: |
  112. curl -L https://github.com/xpack-dev-tools/qemu-riscv-xpack/releases/download/v7.1.0-1/xpack-qemu-riscv-7.1.0-1-linux-x64.tar.gz > xpack-qemu-riscv.tar.gz
  113. tar xvf xpack-qemu-riscv.tar.gz
  114. export PATH=$PATH:$PWD/xpack-qemu-riscv-7.1.0-1/bin
  115. cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
  116. ./test_wamr.sh -s spec ${{ matrix.wamr_test_option }} -m RISCV32 -b -Q -P -F ${{ env.firmware }}
  117. - name: Test on RISCV64
  118. if: endsWith(matrix.nuttx_board_config, 'rv-virt/configs/nsh64')
  119. run: |
  120. curl -L https://github.com/xpack-dev-tools/qemu-riscv-xpack/releases/download/v7.1.0-1/xpack-qemu-riscv-7.1.0-1-linux-x64.tar.gz > xpack-qemu-riscv.tar.gz
  121. tar xvf xpack-qemu-riscv.tar.gz
  122. export PATH=$PATH:$PWD/xpack-qemu-riscv-7.1.0-1/bin
  123. cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
  124. ./test_wamr.sh -s spec ${{ matrix.wamr_test_option }} -m riscv64 -b -Q -P -F ${{ env.firmware }}