Forráskód Böngészése

Refactor CI rules: merge ubuntu/macos/android, enable spec test (#777)

Refactor CI rules:
- merge ubuntu/macos/android into one job file
- add job file to test spec cases
- add compilation for lazy jit, debug interpreter and debug aot
- add compilation for performance profile, dump call stack and mini-loader
- re-org llvm build script to build lldb

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
Wenyong Huang 4 éve
szülő
commit
03494f9487

+ 513 - 0
.github/workflows/compilation_on_android_ubuntu_macos.yml

@@ -0,0 +1,513 @@
+# Copyright (C) 2019 Intel Corporation.  All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+name: compilation on android, ubuntu-18.04, ubuntu-20.04, macos-latest
+
+on:
+  # will be triggered on PR events
+  pull_request:
+    paths-ignore:
+      - "assembly-script/**"
+      - "ci/**"
+      - "doc/**"
+      - "test-tools/**"
+  # allow to be triggered manually
+  workflow_dispatch:
+
+# Cancel any in-flight jobs for the same PR/branch so there's only one active
+# at a time
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+env:
+  AOT_BUILD_OPTIONS:            "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
+  CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
+  FAST_INTERP_BUILD_OPTIONS:    "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
+  JIT_BUILD_OPTIONS:            "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
+  LAZY_JIT_BUILD_OPTIONS:       "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
+  LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
+
+jobs:
+  # Cancel any in-flight jobs for the same PR/branch so there's only one active
+  # at a time
+  cancel_previous:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
+    steps:
+      - name: Cancel Workflow Action
+        uses: styfle/cancel-workflow-action@0.6.0
+        with:
+          access_token: ${{ github.token }}
+
+  # set different traffic lights based on the current repo and the running OS.
+  # according to light colors, the workflow will run different jobs
+  check_repo:
+    needs: cancel_previous
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
+    outputs:
+      traffic_light_on_ubuntu_1804: ${{ steps.do_check_on_ubuntu_1804.outputs.light }}
+      traffic_light_on_ubuntu_2004: ${{ steps.do_check_on_ubuntu_2004.outputs.light }}
+      traffic_light_on_macos_latest: ${{ steps.do_check_on_macos_latest.outputs.light }}
+    steps:
+      - name: do_check_on_ubuntu_1804
+        id: do_check_on_ubuntu_1804
+        if: ${{ matrix.os == 'ubuntu-18.04' }}
+        run: |
+          if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
+            echo "::set-output name=light::green"
+          else
+            echo "::set-output name=light::red"
+          fi
+
+      - name: do_check_on_ubuntu_2004
+        id: do_check_on_ubuntu_2004
+        if: ${{ matrix.os == 'ubuntu-20.04' }}
+        run: |
+          if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
+            echo "::set-output name=light::green"
+          else
+            echo "::set-output name=light::green"
+          fi
+
+      - name: do_check_on_macos_latest
+        id: do_check_on_macos_latest
+        if: ${{ matrix.os == 'macos-latest' }}
+        run: |
+          if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
+            echo "::set-output name=light::green"
+          else
+            echo "::set-output name=light::red"
+          fi
+
+  build_llvm_libraries:
+    needs: check_repo
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
+        include:
+          - os: ubuntu-18.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
+          - os: ubuntu-20.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
+          - os: macos-latest
+            light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
+    steps:
+      - name: light status
+        run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
+
+      - name: checkout
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/checkout@v2
+
+      - name: Cache LLVM libraries
+        id: cache_llvm
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/cache@v2
+        with:
+          path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
+          key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+          restore-keys: ${{ matrix.os }}-${{env.LLVM_CACHE_SUFFIX }}
+
+      - name: Build llvm and clang from source on ubuntu
+        id: build_llvm_ubuntu
+        if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os != 'macos-latest' }}
+        run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly --project clang lldb
+        working-directory: build-scripts
+
+      - name: Build llvm and clang from source on macos
+        id: build_llvm_macos
+        if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' }}
+        run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly
+        working-directory: build-scripts
+
+      - name: package LLVM
+        if: ${{ matrix.light == 'green' && (steps.build_llvm_ubuntu.conclusion == 'success' || steps.build_llvm_macos.conclusion == 'success')}}
+        run: mv LLVM-13.0.0-*.tar.gz LLVM-13.0.0.tar.gz
+        working-directory: core/deps/llvm/build/
+
+  build_wamrc:
+    needs: [build_llvm_libraries, check_repo]
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
+        include:
+          - os: ubuntu-18.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
+          - os: ubuntu-20.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
+          - os: macos-latest
+            light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
+    steps:
+      - name: light status
+        run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
+
+      - name: checkout
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/checkout@v2
+
+      - name: Get LLVM libraries
+        id: cache_llvm
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/cache@v2
+        with:
+          path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
+          key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+          restore-keys: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+
+      - name: Quit if cache miss
+        if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
+        run: echo "::error::can not get prebuilt llvm libraries" && exit 1
+
+      - name: Extract the LLVM package
+        if: ${{ matrix.light == 'green' }}
+        run: tar xf LLVM-13.0.0.tar.gz --strip-components=1
+        working-directory: ./core/deps/llvm/build
+
+      - name: Build wamrc
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release
+        working-directory: wamr-compiler
+
+  build_iwasm:
+    needs: [build_llvm_libraries, check_repo]
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        make_options_run_mode: [
+            # Running mode
+            $CLASSIC_INTERP_BUILD_OPTIONS,
+            $FAST_INTERP_BUILD_OPTIONS,
+            $JIT_BUILD_OPTIONS,
+            $LAZY_JIT_BUILD_OPTIONS,
+            $AOT_BUILD_OPTIONS,
+          ]
+        make_options_feature: [
+            # Features
+            "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
+            "-DWAMR_BUILD_DEBUG_AOT=1",
+            "-DWAMR_BUILD_DEBUG_INTERP=1",
+            "-DWAMR_BUILD_DUMP_CALL_STACK=1",
+            "-DWAMR_BUILD_LIB_PTHREAD=1",
+            "-DWAMR_BUILD_MINI_LOADER=1",
+            "-DWAMR_BUILD_MEMORY_PROFILING=1",
+            "-DWAMR_BUILD_MULTI_MODULE=1",
+            "-DWAMR_BUILD_PERF_PROFILING=1",
+            "-DWAMR_BUILD_REF_TYPES=1",
+            "-DWAMR_BUILD_SIMD=1",
+            "-DWAMR_BUILD_TAIL_CALL=1",
+            "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
+          ]
+        os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
+        platform: [android, linux, darwin]
+        exclude:
+          # uncompatiable os and platform
+          # ubuntu can not go with darwin
+          - os: ubuntu-18.04
+            platform: darwin
+          - os: ubuntu-20.04
+            platform: darwin
+          # macos can not go with android, linux
+          - os: macos-latest
+            platform: android
+          - os: macos-latest
+            platform: linux
+          # uncompatiable feature and platform
+          - os: macos-latest
+            make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
+          - os: macos-latest
+            make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
+          # uncompatiable mode and feature
+          # MULTI_MODULE only on INTERP mode
+          - make_options_run_mode: $JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
+          - make_options_run_mode: $AOT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
+          - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
+          # SIMD only on JIT/AOT mode
+          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_SIMD=1"
+          - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_SIMD=1"
+          # DEBUG_INTERP only on CLASSIC INTERP mode
+          - make_options_run_mode: $AOT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
+          - make_options_run_mode: $JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
+          - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
+          - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
+          # DEBUG_AOT only on JIT/AOT mode
+          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
+          - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
+          # TODO: DEBUG_AOT on JIT
+          - make_options_run_mode: $JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
+          - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
+          # MINI_LOADER only on INTERP mode
+          - make_options_run_mode: $AOT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
+          - make_options_run_mode: $JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
+          - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
+        include:
+          - os: ubuntu-18.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
+          - os: ubuntu-20.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
+          - os: macos-latest
+            light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
+    steps:
+      - name: light status
+        run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
+
+      - name: checkout
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/checkout@v2
+
+      - name: Get LLVM libraries
+        id: cache_llvm
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/cache@v2
+        with:
+          path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
+          key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+          restore-keys: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+
+      - name: Quit if cache miss
+        if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
+        run: echo "::error::can not get prebuilt llvm libraries" && exit 1
+
+      - name: Extract the LLVM package
+        if: ${{ matrix.light == 'green' }}
+        run: tar xf LLVM-13.0.0.tar.gz --strip-components=1
+        working-directory: ./core/deps/llvm/build
+
+      - name: Build iwasm
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          mkdir build && cd build
+          cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
+          cmake --build . --config Release
+        working-directory: product-mini/platforms/${{ matrix.platform }}
+
+  build_samples_wasm_c_api:
+    needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo]
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        make_options: [
+            # Running mode
+            $CLASSIC_INTERP_BUILD_OPTIONS,
+            $FAST_INTERP_BUILD_OPTIONS,
+            $JIT_BUILD_OPTIONS,
+            $LAZY_JIT_BUILD_OPTIONS,
+            $AOT_BUILD_OPTIONS,
+          ]
+        os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
+        include:
+          - os: ubuntu-18.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
+            wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
+            wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz
+          - os: ubuntu-20.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
+            wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
+            wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz
+          - os: macos-latest
+            light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
+            wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz
+            wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz
+        exclude:
+          # TODO: a .aot compatiable problem
+          - os: macos-latest
+            make_options: $JIT_BUILD_OPTIONS
+          - os: macos-latest
+            make_options: $AOT_BUILD_OPTIONS
+          - os: macos-latest
+            make_options: $LAZY_JIT_BUILD_OPTIONS
+    steps:
+      - name: light status
+        run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
+
+      - name: checkout
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/checkout@v2
+
+      - name: Get LLVM libraries
+        id: cache_llvm
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/cache@v2
+        with:
+          path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
+          key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+          restore-keys: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+
+      - name: Quit if cache miss
+        if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
+        run: echo "::error::can not get prebuilt llvm libraries" && exit 1
+
+      - name: Extract the LLVM package
+        if: ${{ matrix.light == 'green' }}
+        run: tar xf LLVM-13.0.0.tar.gz --strip-components=1
+        working-directory: ./core/deps/llvm/build
+
+      - name: download and install wabt
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd /opt
+          sudo wget ${{ matrix.wabt_release }}
+          sudo tar -xzf wabt-1.0.24-*.tar.gz
+          sudo mv wabt-1.0.24 wabt
+
+      - name: Build wamrc
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release
+        working-directory: wamr-compiler
+
+      - name: Build Sample [wasm-c-api]
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          mkdir build && cd build
+          cmake .. ${{ matrix.make_options }}
+          cmake --build . --config Release
+          ./callback
+          ./callback_chain
+          ./global
+          ./hello
+          ./hostref
+          ./memory
+          ./reflect
+          ./table
+          ./trap
+        working-directory: samples/wasm-c-api
+
+  build_samples_others:
+    needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo]
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        include:
+          - os: ubuntu-18.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
+            wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
+            wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz
+          - os: ubuntu-20.04
+            light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
+            wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
+            wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz
+          - os: macos-latest
+            light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
+            wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz
+            wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz
+    steps:
+      - name: light status
+        run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
+
+      - name: checkout
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/checkout@v2
+
+      - name: Get LLVM libraries
+        id: cache_llvm
+        if: ${{ matrix.light == 'green' }}
+        uses: actions/cache@v2
+        with:
+          path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
+          key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+          restore-keys: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+
+      - name: Quit if cache miss
+        if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
+        run: echo "::error::can not get prebuilt llvm libraries" && exit 1
+
+      - name: Extract the LLVM package
+        if: ${{ matrix.light == 'green' }}
+        run: tar xf LLVM-13.0.0.tar.gz --strip-components=1
+        working-directory: ./core/deps/llvm/build
+
+      - name: download and install wasi-sdk
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd /opt
+          sudo wget ${{ matrix.wasi_sdk_release }}
+          sudo tar -xzf wasi-sdk-12.0-*.tar.gz
+          sudo mv wasi-sdk-12.0 wasi-sdk
+
+      - name: download and install wabt
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd /opt
+          sudo wget ${{ matrix.wabt_release }}
+          sudo tar -xzf wabt-1.0.24-*.tar.gz
+          sudo mv wabt-1.0.24 wabt
+
+      - name: Build wamrc
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release
+        working-directory: wamr-compiler
+
+      - name: Build Sample [basic]
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd samples/basic
+          ./build.sh
+          ./run.sh
+
+      - name: Build Sample [multi-thread]
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd samples/multi-thread
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release
+          ./iwasm wasm-apps/test.wasm
+
+      - name: Build Sample [multi-module]
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd samples/multi-module
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release
+          ./multi_module
+
+      - name: Build Sample [spawn-thread]
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd samples/spawn-thread
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release
+          ./spawn_thread
+
+      - name: Build Sample [ref-types]
+        if: ${{ matrix.light == 'green' }}
+        run: |
+          cd samples/ref-types
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release
+          ./hello

+ 99 - 0
.github/workflows/compilation_on_windows.yml

@@ -0,0 +1,99 @@
+# Copyright (C) 2019 Intel Corporation.  All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+name: compilation on windows-latest
+
+on:
+  # will be triggered on PR events
+  pull_request:
+    paths-ignore:
+      - "assembly-script/**"
+      - "ci/**"
+      - "doc/**"
+      - "test-tools/**"
+  # allow to be triggered manually
+  workflow_dispatch:
+
+# Cancel any in-flight jobs for the same PR/branch so there's only one active
+# at a time
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  # Cancel any in-flight jobs for the same PR/branch so there's only one active
+  # at a time
+  cancel_previous:
+    runs-on: windows-latest
+    steps:
+      - name: Cancel Workflow Action
+        uses: styfle/cancel-workflow-action@0.6.0
+        with:
+          access_token: ${{ github.token }}
+
+  build:
+    needs: cancel_previous
+    runs-on: windows-latest
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: clone uvwasi library
+        run: |
+          cd core/deps
+          git clone https://github.com/nodejs/uvwasi.git
+      - name: Build iwasm [default]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake ..
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build
+      - name: Build iwasm [aot only]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake .. -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build
+      - name: Build iwasm [interp only]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake .. -DWAMR_BUILD_AOT=0
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build
+      - name: Build iwasm [tail call]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake .. -DWAMR_BUILD_TAIL_CALL=1
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build
+      - name: Build iwasm [custom name section]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build
+      - name: Build iwasm [disable hardware boundary check]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build
+      - name: Build iwasm [reference types]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake .. -DWAMR_BUILD_REF_TYPES=1
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build
+      - name: Build iwasm [128-bit SIMD]
+        run: |
+          cd product-mini/platforms/windows
+          mkdir build && cd build
+          cmake .. -DWAMR_BUILD_SIMD=1
+          cmake --build . --config Release --parallel 4
+          cd .. && rm -force -r build

+ 0 - 229
.github/workflows/linux.yml

@@ -1,229 +0,0 @@
-# Copyright (C) 2019 Intel Corporation.  All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-name: Linux
-
-# Controls when the action will run. Triggers the workflow on push or pull request
-# events but only for the main branch
-on:
-  # triggers on every branch
-  push:
-    paths-ignore:
-    - 'doc/**'
-  # triggers on every PR
-  pull_request:
-    paths-ignore:
-    - 'doc/**'
-
-jobs:
-  build_llvm_libraries:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os: [ubuntu-18.04, ubuntu-20.04]
-    steps:
-    - name: checkout
-      uses: actions/checkout@v2
-    - name: Cache LLVM libraries
-      id: cache_llvm
-      uses: actions/cache@v2
-      env:
-        cache-name: llvm_libraries
-      with:
-        path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
-        key: ${{ matrix.os }}-build-${{env.cache-name}}
-        restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
-    - name: Build llvm and clang from source
-      id: build_llvm
-      if: steps.cache_llvm.outputs.cache-hit != 'true'
-      run: |
-        cd wamr-compiler
-        ./build_llvm.sh
-        cd ../core/deps/llvm/build/
-        make package
-
-  build_wamrc:
-    needs: build_llvm_libraries
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os: [ubuntu-18.04, ubuntu-20.04]
-    steps:
-    - name: checkout
-      uses: actions/checkout@v2
-    - name: Get LLVM libraries
-      id: cache_llvm
-      uses: actions/cache@v2
-      env:
-        cache-name: llvm_libraries
-      with:
-        path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
-        key: ${{ matrix.os }}-build-${{env.cache-name}}
-        restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
-    - name: Quit if cache miss
-      if: steps.cache_llvm.outputs.cache-hit != 'true'
-      run: exit 1
-    - name: Extract the LLVM package
-      run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1
-      working-directory: ./core/deps/llvm/build
-    - name: Build wamrc
-      run: |
-        mkdir build && cd build
-        cmake .. && make -j $(nproc)
-      working-directory: wamr-compiler
-    - name: Upload Wamrc
-      uses: actions/upload-artifact@v2
-      with:
-        name: wamrc_bin-${{ matrix.os }}
-        path: ./wamr-compiler/build/wamrc
-        retention-days: 1
-
-  build_iwasm:
-    needs: build_llvm_libraries
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        make_options: [
-          # Running mode
-          "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1",
-          "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0",
-          "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=0",
-          "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1",
-          # Features
-          "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
-          "-DWAMR_BUILD_LIB_PTHREAD=1",
-          "-DWAMR_BUILD_MEMORY_PROFILING=1",
-          "-DWAMR_BUILD_MULTI_MODULE=1",
-          "-DWAMR_BUILD_REF_TYPES=1",
-          "-DWAMR_BUILD_SIMD=1",
-          "-DWAMR_BUILD_TAIL_CALL=1",
-          "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
-        ]
-        os: [ubuntu-18.04, ubuntu-20.04]
-        platform: [linux, android]
-    steps:
-    - name: checkout
-      uses: actions/checkout@v2
-    - name: Get LLVM libraries
-      id: cache_llvm
-      uses: actions/cache@v2
-      env:
-        cache-name: llvm_libraries
-      with:
-        path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
-        key: ${{ matrix.os }}-build-${{env.cache-name}}
-        restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
-    - name: Quit if cache miss
-      if: steps.cache_llvm.outputs.cache-hit != 'true'
-      run: exit 1
-    - name: Extract the LLVM package
-      run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1
-      working-directory: ./core/deps/llvm/build
-    - name: Build iwasm
-      run: |
-        mkdir build && cd build
-        cmake .. ${{ matrix.make_options }} && make -j $(nproc)
-        cd .. && rm -rf build
-      working-directory:  product-mini/platforms/${{ matrix.platform }}
-
-  build_samples:
-    needs: [build_llvm_libraries, build_wamrc]
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os: [ubuntu-18.04, ubuntu-20.04]
-        make_options: [
-          # Running mode
-          "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1",
-          "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0",
-          "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=0",
-          "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1",
-        ]
-    steps:
-    - name: checkout
-      uses: actions/checkout@v2
-    - name: Get LLVM libraries
-      id: cache_llvm
-      uses: actions/cache@v2
-      env:
-        cache-name: llvm_libraries
-      with:
-        path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
-        key: ${{ matrix.os }}-build-${{env.cache-name}}
-        restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
-    - name: Quit if cache miss
-      if: steps.cache_llvm.outputs.cache-hit != 'true'
-      run: exit 1
-    - name: Extract the LLVM package
-      run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1
-      working-directory: ./core/deps/llvm/build
-    - name: Download Wamrc
-      uses: actions/download-artifact@v2
-      with:
-        name: wamrc_bin-${{ matrix.os }}
-        path: ./wamr-compiler/build
-    - name: Give execution rights
-      run: chmod a+x ./wamr-compiler/build/wamrc
-    - name: download and install wasi-sdk
-      run: |
-        cd /opt
-        wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
-        tar -xzf wasi-sdk-12.0-linux.tar.gz
-        mv wasi-sdk-12.0 wasi-sdk
-        rm wasi-sdk-12.0-linux.tar.gz
-    - name: download and install wabt
-      run: |
-        cd /opt
-        wget https://github.com/WebAssembly/wabt/releases/download/1.0.23/wabt-1.0.23-ubuntu.tar.gz
-        tar -xzf wabt-1.0.23-ubuntu.tar.gz
-        mv wabt-1.0.23 wabt
-        rm wabt-1.0.23-ubuntu.tar.gz
-    - name: Build Sample [wasm-c-api]
-      run: |
-        cd samples/wasm-c-api
-        mkdir build && cd build
-        cmake .. ${{ matrix.make_options }}
-        make -j $(nproc)
-        ./callback
-        ./callback_chain
-        ./global
-        ./hello
-        ./hostref
-        ./memory
-        ./reflect
-        ./table
-        ./trap
-        cd .. && rm -r build
-    - name: Build Sample [basic]
-      run: |
-        cd samples/basic
-        ./build.sh
-        ./run.sh
-    - name: Build Sample [multi-thread]
-      run: |
-        cd samples/multi-thread
-        mkdir build && cd build
-        cmake ..
-        make -j $(nproc)
-        ./iwasm wasm-apps/test.wasm
-    - name: Build Sample [multi-module]
-      run: |
-        cd samples/multi-module
-        mkdir build && cd build
-        cmake ..
-        make -j $(nproc)
-        ./multi_module
-    - name: Build Sample [spawn-thread]
-      run: |
-        cd samples/spawn-thread
-        mkdir build && cd build
-        cmake ..
-        make -j $(nproc)
-        ./spawn_thread
-    - name: Build Sample [ref-types]
-      run: |
-        cd samples/ref-types
-        mkdir build && cd build
-        cmake ..
-        make -j $(nproc)
-        ./hello

+ 0 - 128
.github/workflows/mac.yml

@@ -1,128 +0,0 @@
-# Copyright (C) 2019 Intel Corporation.  All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-name: Mac
-
-# Controls when the action will run. Triggers the workflow on push or pull request
-# events but only for the main branch
-on:
-  push:
-    branches: [ main ]
-  pull_request:
-    branches: [ main ]
-
-jobs:
-
-  build:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os: [macos-latest]
-    steps:
-    - uses: actions/checkout@v2
-
-    - name: Build iwasm [default]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake ..
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [classic interp]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_FAST_INTERP=0
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [multi module]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_MULTI_MODULE=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [lib-pthread]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_LIB_PTHREAD=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [aot only]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [interp only]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_AOT=0
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [memory profiling]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_MEMORY_PROFILING=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [tail call]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_TAIL_CALL=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [custom name section]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [disable hardware boundary check]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [ref types]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_REF_TYPES=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: Build iwasm [128-bit SIMD]
-      run: |
-        cd product-mini/platforms/darwin
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_SIMD=1
-        make -j $(nproc)
-        cd .. && rm -rf build
-    - name: download and install wabt
-      run: |
-        cd /opt
-        sudo wget https://github.com/WebAssembly/wabt/releases/download/1.0.19/wabt-1.0.19-macos.tar.gz
-        sudo tar -xzf wabt-1.0.19-macos.tar.gz
-        sudo mv wabt-1.0.19 wabt
-    - name: Build Sample [wasm-c-api]
-      run: |
-        cd samples/wasm-c-api
-        mkdir build && cd build
-        cmake ..
-        make
-        ./callback
-        ./callback_chain
-        ./global
-        ./hello
-        ./hostref
-        ./memory
-        ./reflect
-        ./table
-        ./trap

+ 97 - 0
.github/workflows/spec_test.yml

@@ -0,0 +1,97 @@
+# Copyright (C) 2019 Intel Corporation.  All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+name: Spec tests on non-windows
+
+on:
+  # will be triggered on PR events
+  pull_request:
+    paths:
+      - "core/iwasm/**"
+  # allow to be triggered manually
+  workflow_dispatch:
+
+# Cancel any in-flight jobs for the same PR/branch so there's only one active
+# at a time
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+env:
+  LLVM_CACHE_SUFFIX: "build-llvm_libraries"
+
+jobs:
+  cancel_previous:
+    runs-on: ubuntu-20.04
+    steps:
+      - name: Cancel Workflow Action
+        uses: styfle/cancel-workflow-action@0.6.0
+        with:
+          access_token: ${{ github.token }}
+
+  build_llvm_libraries:
+    needs: cancel_previous
+    runs-on: ubuntu-20.04
+    steps:
+      - name: checkout
+        uses: actions/checkout@v2
+
+      - name: Cache LLVM libraries
+        id: cache_llvm
+        uses: actions/cache@v2
+        with:
+          path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
+          key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
+          restore-keys: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+
+      - name: Build llvm and clang from source
+        id: build_llvm
+        if: ${{ steps.cache_llvm.outputs.cache-hit != 'true' }}
+        run: /usr/bin/env python3 ./build_llvm.py  --arch X86 WebAssembly
+        working-directory: build-scripts
+
+      - name: package LLVM
+        if: ${{ steps.build_llvm.conclusion == 'success' }}
+        run: mv LLVM-13.0.0-*.tar.gz LLVM-13.0.0.tar.gz
+        working-directory: core/deps/llvm/build/
+
+  spec_test_on_ubuntu_2004:
+    needs: build_llvm_libraries
+    runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        test_option: [
+            # DEFAULT
+            "-s spec",
+            # SIMD
+            "-s spec -S",
+            # THREAD
+            "-s spec -p",
+            # MULTI_MODULES
+            "-s spec -M",
+          ]
+    steps:
+      - name: checkout
+        uses: actions/checkout@v2
+
+      - name: Get LLVM libraries
+        id: cache_llvm
+        uses: actions/cache@v2
+        with:
+          path: ./core/deps/llvm/build/LLVM-13.0.0.tar.gz
+          key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
+          restore-keys: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
+
+      - name: Quit if cache miss
+        if: steps.cache_llvm.outputs.cache-hit != 'true'
+        run: echo "::error::can not get prebuilt llvm libraries" && exit 1
+
+      - name: Extract the LLVM package
+        run: tar xf LLVM-13.0.0.tar.gz --strip-components=1
+        working-directory: ./core/deps/llvm/build
+
+      - name: install Ninja
+        run: sudo apt install -y ninja-build
+
+      - name: run spec tests
+        run: ./test_wamr.sh ${{ matrix.test_option }}
+        working-directory: ./tests/wamr-test-suites

+ 0 - 84
.github/workflows/windows.yml

@@ -1,84 +0,0 @@
-# Copyright (C) 2019 Intel Corporation.  All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-name: Windows
-
-# Controls when the action will run. Triggers the workflow on push or pull request
-# events but only for the main branch
-on:
-  push:
-    branches: [ main ]
-  pull_request:
-    branches: [ main ]
-
-jobs:
-
-  build:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      matrix:
-        os: [windows-latest]
-    steps:
-    - uses: actions/checkout@v2
-
-    - name: clone uvwasi library
-      run: |
-        cd core/deps
-        git clone https://github.com/nodejs/uvwasi.git
-    - name: Build iwasm [default]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake ..
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-    - name: Build iwasm [aot only]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-    - name: Build iwasm [interp only]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_AOT=0
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-    - name: Build iwasm [tail call]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_TAIL_CALL=1
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-    - name: Build iwasm [custom name section]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-    - name: Build iwasm [disable hardware boundary check]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake .. -DWAMR_DISABLE_HW_BOUND_CHECK=1
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-    - name: Build iwasm [reference types]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_REF_TYPES=1
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-    - name: Build iwasm [128-bit SIMD]
-      run: |
-        cd product-mini/platforms/windows
-        mkdir build && cd build
-        cmake .. -DWAMR_BUILD_SIMD=1
-        cmake --build . --config Release --parallel 4
-        cd .. && rm -force -r build
-

+ 1 - 0
.gitignore

@@ -12,3 +12,4 @@ test-tools/host-tool/bin/
 product-mini/app-samples/hello-world/test.wasm
 product-mini/app-samples/hello-world/test.wasm
 
 
 build_out
 build_out
+tests/wamr-test-suites/workspace

+ 50 - 14
build-scripts/build_llvm.py

@@ -24,12 +24,12 @@ def clone_llvm(dst_dir, llvm_repo, llvm_branch):
         GIT_CLONE_CMD = f"git clone --depth 1 --branch {llvm_branch} {llvm_repo} llvm"
         GIT_CLONE_CMD = f"git clone --depth 1 --branch {llvm_branch} {llvm_repo} llvm"
         subprocess.check_output(shlex.split(GIT_CLONE_CMD), cwd=dst_dir)
         subprocess.check_output(shlex.split(GIT_CLONE_CMD), cwd=dst_dir)
     else:
     else:
-        print(f"There is an LLVM local repo in {llvm_dir}, keep using it")
+        print(f"There is an LLVM local repo in {llvm_dir}, clean and keep using it")
 
 
     return llvm_dir
     return llvm_dir
 
 
 
 
-def build_llvm(llvm_dir, platform, backends):
+def build_llvm(llvm_dir, platform, backends, projects):
     LLVM_COMPILE_OPTIONS = [
     LLVM_COMPILE_OPTIONS = [
         '-DCMAKE_BUILD_TYPE:STRING="Release"',
         '-DCMAKE_BUILD_TYPE:STRING="Release"',
         "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
         "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
@@ -42,7 +42,6 @@ def build_llvm(llvm_dir, platform, backends):
         "-DLLVM_CCACHE_BUILD:BOOL=OFF",
         "-DLLVM_CCACHE_BUILD:BOOL=OFF",
         "-DLLVM_ENABLE_BINDINGS:BOOL=OFF",
         "-DLLVM_ENABLE_BINDINGS:BOOL=OFF",
         "-DLLVM_ENABLE_IDE:BOOL=OFF",
         "-DLLVM_ENABLE_IDE:BOOL=OFF",
-        "-DLLVM_ENABLE_LIBXML2:BOOL=OFF",
         "-DLLVM_ENABLE_TERMINFO:BOOL=OFF",
         "-DLLVM_ENABLE_TERMINFO:BOOL=OFF",
         "-DLLVM_ENABLE_ZLIB:BOOL=OFF",
         "-DLLVM_ENABLE_ZLIB:BOOL=OFF",
         "-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF",
         "-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF",
@@ -50,11 +49,11 @@ def build_llvm(llvm_dir, platform, backends):
         "-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF",
         "-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF",
         "-DLLVM_INCLUDE_UTILS:BOOL=OFF",
         "-DLLVM_INCLUDE_UTILS:BOOL=OFF",
         "-DLLVM_INCLUDE_TESTS:BOOL=OFF",
         "-DLLVM_INCLUDE_TESTS:BOOL=OFF",
-        "-DLLVM_INCLUDE_TOOLS:BOOL=OFF",
+        "-DLLVM_BUILD_TESTS:BOOL=OFF",
         "-DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON",
         "-DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON",
     ]
     ]
 
 
-    LLVM_EXTRA_COMPILER_OPTIONS = {
+    LLVM_EXTRA_COMPILE_OPTIONS = {
         "arc": [
         "arc": [
             '-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD:STRING="ARC"',
             '-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD:STRING="ARC"',
             "-DLLVM_ENABLE_LIBICUUC:BOOL=OFF",
             "-DLLVM_ENABLE_LIBICUUC:BOOL=OFF",
@@ -70,11 +69,25 @@ def build_llvm(llvm_dir, platform, backends):
     }
     }
 
 
     LLVM_TARGETS_TO_BUILD = [
     LLVM_TARGETS_TO_BUILD = [
-        "-DLLVM_TARGETS_TO_BUILD:STRING=" + ";".join(backends)
+        '-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(backends) + '"'
         if backends
         if backends
         else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
         else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
     ]
     ]
 
 
+    LLVM_PROJECTS_TO_BUILD = [
+        '-DLLVM_ENABLE_PROJECTS:STRING="' + ";".join(projects) + '"' if projects else ""
+    ]
+
+    # lldb project requires libxml2
+    LLVM_LIBXML2_OPTION = [
+        "-DLLVM_ENABLE_LIBXML2:BOOL=" + ("ON" if "lldb" in projects else "OFF")
+    ]
+
+    # enabling LLVM_INCLUDE_TOOLS will increase ~300M to the final package
+    LLVM_INCLUDE_TOOLS_OPTION = [
+        "-DLLVM_INCLUDE_TOOLS:BOOL=ON" if projects else "-DLLVM_INCLUDE_TOOLS:BOOL=OFF"
+    ]
+
     if not llvm_dir.exists():
     if not llvm_dir.exists():
         raise Exception(f"{llvm_dir} doesn't exist")
         raise Exception(f"{llvm_dir} doesn't exist")
 
 
@@ -90,19 +103,24 @@ def build_llvm(llvm_dir, platform, backends):
 
 
     compile_options = " ".join(
     compile_options = " ".join(
         LLVM_COMPILE_OPTIONS
         LLVM_COMPILE_OPTIONS
-        + LLVM_EXTRA_COMPILER_OPTIONS.get(
-            platform, LLVM_EXTRA_COMPILER_OPTIONS["default"]
+        + LLVM_LIBXML2_OPTION
+        + LLVM_EXTRA_COMPILE_OPTIONS.get(
+            platform, LLVM_EXTRA_COMPILE_OPTIONS["default"]
         )
         )
         + LLVM_TARGETS_TO_BUILD
         + LLVM_TARGETS_TO_BUILD
+        + LLVM_PROJECTS_TO_BUILD
+        + LLVM_INCLUDE_TOOLS_OPTION
     )
     )
 
 
-    CONFIG_CMD = f"cmake {compile_options} ../llvm "
+    CONFIG_CMD = f"cmake {compile_options} ../llvm " + (
+        "-A x64" if "windows" == platform else ""
+    )
+    print(f"{CONFIG_CMD}")
     subprocess.check_call(shlex.split(CONFIG_CMD), cwd=build_dir)
     subprocess.check_call(shlex.split(CONFIG_CMD), cwd=build_dir)
 
 
-    BUILD_CMD = f"cmake --build . --parallel {os.cpu_count()}" + (
+    BUILD_CMD = f"cmake --build . --target package --parallel {os.cpu_count()}" + (
         " --config Release" if "windows" == platform else ""
         " --config Release" if "windows" == platform else ""
     )
     )
-
     subprocess.check_call(shlex.split(BUILD_CMD), cwd=build_dir)
     subprocess.check_call(shlex.split(BUILD_CMD), cwd=build_dir)
 
 
     return build_dir
     return build_dir
@@ -120,10 +138,28 @@ def main():
         "--arch",
         "--arch",
         nargs="+",
         nargs="+",
         type=str,
         type=str,
-        choices=["AArch64", "ARC", "ARM", "Mips", "RISCV", "X86", "Xtensa"],
+        choices=[
+            "AArch64",
+            "ARC",
+            "ARM",
+            "Mips",
+            "RISCV",
+            "WebAssembly",
+            "X86",
+            "Xtensa",
+        ],
         help="identify LLVM supported backends, separate by space, like '--arch ARM Mips X86'",
         help="identify LLVM supported backends, separate by space, like '--arch ARM Mips X86'",
     )
     )
+    parser.add_argument(
+        "--project",
+        nargs="+",
+        type=str,
+        default="",
+        choices=["clang", "lldb"],
+        help="identify extra LLVM projects, separate by space, like '--project clang lldb'",
+    )
     options = parser.parse_args()
     options = parser.parse_args()
+    print(f"options={options}")
 
 
     # if the "platform" is not identified in the command line option,
     # if the "platform" is not identified in the command line option,
     # detect it
     # detect it
@@ -142,7 +178,7 @@ def main():
     llvm_repo_and_branch = {
     llvm_repo_and_branch = {
         "arc": {
         "arc": {
             "repo": "https://github.com/llvm/llvm-project.git",
             "repo": "https://github.com/llvm/llvm-project.git",
-            "branch": "release/13.x"
+            "branch": "release/13.x",
         },
         },
         "xtensa": {
         "xtensa": {
             "repo": "https://github.com/espressif/llvm-project.git",
             "repo": "https://github.com/espressif/llvm-project.git",
@@ -168,7 +204,7 @@ def main():
 
 
     print()
     print()
     print(f"==================== BUILD LLVM ====================")
     print(f"==================== BUILD LLVM ====================")
-    build_llvm(llvm_dir, platform, options.arch)
+    build_llvm(llvm_dir, platform, options.arch, options.project)
 
 
     print()
     print()
 
 

+ 2 - 0
product-mini/platforms/darwin/CMakeLists.txt

@@ -32,6 +32,8 @@ if (NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
   set(CMAKE_BUILD_TYPE Release)
 endif ()
 endif ()
 
 
+set(CMAKE_CXX_STANDARD 14)
+
 if (NOT DEFINED WAMR_BUILD_INTERP)
 if (NOT DEFINED WAMR_BUILD_INTERP)
   # Enable Interpreter by default
   # Enable Interpreter by default
   set (WAMR_BUILD_INTERP 1)
   set (WAMR_BUILD_INTERP 1)

+ 1 - 0
samples/wasm-c-api/CMakeLists.txt

@@ -14,6 +14,7 @@ if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
   set(CMAKE_BUILD_TYPE Release)
 endif()
 endif()
 
 
+set(CMAKE_CXX_STANDARD 14)
 ################  runtime settings  ################
 ################  runtime settings  ################
 
 
 string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
 string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)

+ 4 - 2
tests/wamr-test-suites/test_wamr.sh

@@ -614,13 +614,15 @@ function trigger()
 
 
 # if collect code coverage, ignore -s, test all test cases.
 # if collect code coverage, ignore -s, test all test cases.
 if [[ $TEST_CASE_ARR && $COLLECT_CODE_COVERAGE != 1 ]];then
 if [[ $TEST_CASE_ARR && $COLLECT_CODE_COVERAGE != 1 ]];then
-    trigger
+    trigger || (echo "TEST FAILED"; exit 1)
 else
 else
     # test all suite, ignore polybench because of long time cost
     # test all suite, ignore polybench because of long time cost
     TEST_CASE_ARR=("sightglass" "spec" "wasi" "malformed" "standalone")
     TEST_CASE_ARR=("sightglass" "spec" "wasi" "malformed" "standalone")
-    trigger
+    trigger || (echo "TEST FAILED"; exit 1)
     # Add more suites here
     # Add more suites here
 fi
 fi
 
 
 echo -e "\033[32mTest finish. Reports are under ${REPORT_DIR} \033[0m"
 echo -e "\033[32mTest finish. Reports are under ${REPORT_DIR} \033[0m"
 DEBUG set +xEevuo pipefail
 DEBUG set +xEevuo pipefail
+echo "TEST SUCCESSFUL"
+exit 0

+ 1 - 1
wamr-compiler/build_llvm.py

@@ -11,4 +11,4 @@ import sys
 script = (
 script = (
     pathlib.Path(__file__).parent.joinpath("../build-scripts/build_llvm.py").resolve()
     pathlib.Path(__file__).parent.joinpath("../build-scripts/build_llvm.py").resolve()
 )
 )
-subprocess.check_call([sys.executable, script])
+subprocess.check_call([sys.executable, script.name])