Jelajahi Sumber

Add smoke tests for iwasm and wamrc binaries to validate build output (#4455)

liang.he 7 bulan lalu
induk
melakukan
e40b05a5c6
2 mengubah file dengan 101 tambahan dan 53 penghapusan
  1. 77 53
      .github/workflows/build_iwasm_release.yml
  2. 24 0
      .github/workflows/build_wamrc.yml

+ 77 - 53
.github/workflows/build_iwasm_release.yml

@@ -32,60 +32,60 @@ on:
         required: false
 
 env:
-  DEFAULT_BUILD_OPTIONS: 
+  DEFAULT_BUILD_OPTIONS:
     "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
-     -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
-     -DWAMR_BUILD_DEBUG_INTERP=0 \
-     -DWAMR_BUILD_DEBUG_AOT=0 \
-     -DWAMR_BUILD_DUMP_CALL_STACK=0 \
-     -DWAMR_BUILD_LIBC_UVWASI=0 \
-     -DWAMR_BUILD_LIBC_EMCC=0 \
-     -DWAMR_BUILD_LIB_RATS=0 \
-     -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
-     -DWAMR_BUILD_MEMORY_PROFILING=0 \
-     -DWAMR_BUILD_MINI_LOADER=0 \
-     -DWAMR_BUILD_MULTI_MODULE=0 \
-     -DWAMR_BUILD_PERF_PROFILING=0 \
-     -DWAMR_BUILD_SPEC_TEST=0 \
-     -DWAMR_BUILD_BULK_MEMORY=1 \
-     -DWAMR_BUILD_LIB_PTHREAD=1 \
-     -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
-     -DWAMR_BUILD_LIB_WASI_THREADS=1 \
-     -DWAMR_BUILD_LIBC_BUILTIN=1 \
-     -DWAMR_BUILD_LIBC_WASI=1 \
-     -DWAMR_BUILD_REF_TYPES=1 \
-     -DWAMR_BUILD_SIMD=1 \
-     -DWAMR_BUILD_SHARED_MEMORY=1 \
-     -DWAMR_BUILD_TAIL_CALL=1 \
-     -DWAMR_BUILD_THREAD_MGR=1"
+    -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
+    -DWAMR_BUILD_DEBUG_INTERP=0 \
+    -DWAMR_BUILD_DEBUG_AOT=0 \
+    -DWAMR_BUILD_DUMP_CALL_STACK=0 \
+    -DWAMR_BUILD_LIBC_UVWASI=0 \
+    -DWAMR_BUILD_LIBC_EMCC=0 \
+    -DWAMR_BUILD_LIB_RATS=0 \
+    -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
+    -DWAMR_BUILD_MEMORY_PROFILING=0 \
+    -DWAMR_BUILD_MINI_LOADER=0 \
+    -DWAMR_BUILD_MULTI_MODULE=0 \
+    -DWAMR_BUILD_PERF_PROFILING=0 \
+    -DWAMR_BUILD_SPEC_TEST=0 \
+    -DWAMR_BUILD_BULK_MEMORY=1 \
+    -DWAMR_BUILD_LIB_PTHREAD=1 \
+    -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
+    -DWAMR_BUILD_LIB_WASI_THREADS=1 \
+    -DWAMR_BUILD_LIBC_BUILTIN=1 \
+    -DWAMR_BUILD_LIBC_WASI=1 \
+    -DWAMR_BUILD_REF_TYPES=1 \
+    -DWAMR_BUILD_SIMD=1 \
+    -DWAMR_BUILD_SHARED_MEMORY=1 \
+    -DWAMR_BUILD_TAIL_CALL=1 \
+    -DWAMR_BUILD_THREAD_MGR=1"
   GC_EH_BUILD_OPTIONS:
     "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 \
-     -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
-     -DWAMR_BUILD_DEBUG_INTERP=0 \
-     -DWAMR_BUILD_DEBUG_AOT=0 \
-     -DWAMR_BUILD_DUMP_CALL_STACK=0 \
-     -DWAMR_BUILD_LIBC_UVWASI=0 \
-     -DWAMR_BUILD_LIBC_EMCC=0 \
-     -DWAMR_BUILD_LIB_RATS=0 \
-     -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
-     -DWAMR_BUILD_MEMORY_PROFILING=0 \
-     -DWAMR_BUILD_MINI_LOADER=0 \
-     -DWAMR_BUILD_MULTI_MODULE=0 \
-     -DWAMR_BUILD_PERF_PROFILING=0 \
-     -DWAMR_BUILD_SPEC_TEST=0 \
-     -DWAMR_BUILD_BULK_MEMORY=1 \
-     -DWAMR_BUILD_LIB_PTHREAD=1 \
-     -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
-     -DWAMR_BUILD_LIB_WASI_THREADS=1 \
-     -DWAMR_BUILD_LIBC_BUILTIN=1 \
-     -DWAMR_BUILD_LIBC_WASI=1 \
-     -DWAMR_BUILD_REF_TYPES=1 \
-     -DWAMR_BUILD_SIMD=1 \
-     -DWAMR_BUILD_SHARED_MEMORY=1 \
-     -DWAMR_BUILD_TAIL_CALL=1 \
-     -DWAMR_BUILD_THREAD_MGR=1 \
-     -DWAMR_BUILD_EXCE_HANDLING=1 \
-     -DWAMR_BUILD_GC=1"
+    -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
+    -DWAMR_BUILD_DEBUG_INTERP=0 \
+    -DWAMR_BUILD_DEBUG_AOT=0 \
+    -DWAMR_BUILD_DUMP_CALL_STACK=0 \
+    -DWAMR_BUILD_LIBC_UVWASI=0 \
+    -DWAMR_BUILD_LIBC_EMCC=0 \
+    -DWAMR_BUILD_LIB_RATS=0 \
+    -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
+    -DWAMR_BUILD_MEMORY_PROFILING=0 \
+    -DWAMR_BUILD_MINI_LOADER=0 \
+    -DWAMR_BUILD_MULTI_MODULE=0 \
+    -DWAMR_BUILD_PERF_PROFILING=0 \
+    -DWAMR_BUILD_SPEC_TEST=0 \
+    -DWAMR_BUILD_BULK_MEMORY=1 \
+    -DWAMR_BUILD_LIB_PTHREAD=1 \
+    -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
+    -DWAMR_BUILD_LIB_WASI_THREADS=1 \
+    -DWAMR_BUILD_LIBC_BUILTIN=1 \
+    -DWAMR_BUILD_LIBC_WASI=1 \
+    -DWAMR_BUILD_REF_TYPES=1 \
+    -DWAMR_BUILD_SIMD=1 \
+    -DWAMR_BUILD_SHARED_MEMORY=1 \
+    -DWAMR_BUILD_TAIL_CALL=1 \
+    -DWAMR_BUILD_THREAD_MGR=1 \
+    -DWAMR_BUILD_EXCE_HANDLING=1 \
+    -DWAMR_BUILD_GC=1"
 
 permissions:
   contents: read
@@ -97,9 +97,9 @@ jobs:
       matrix:
         include:
           - build_options: $DEFAULT_BUILD_OPTIONS
-            suffix: ''
+            suffix: ""
           - build_options: $GC_EH_BUILD_OPTIONS
-            suffix: '-gc-eh'
+            suffix: "-gc-eh"
     permissions:
       contents: write # for uploading release artifacts
 
@@ -126,6 +126,30 @@ jobs:
           cmake --build build --config Release --parallel 4
         working-directory: ${{ inputs.cwd }}
 
+      - name: smoke test on non-Windows
+        if: ${{ !startsWith(inputs.runner, 'windows') }}
+        shell: bash
+        run: |
+          if [[ ! -f build/iwasm ]]; then
+            echo "iwasm binary is not found in the expected location."
+            exit 1
+          fi
+
+          build/iwasm --version
+        working-directory: ${{ inputs.cwd }}
+
+      - name: smoke test on Windows
+        if: ${{ startsWith(inputs.runner, 'windows') }}
+        shell: bash
+        run: |
+          if [[ ! -f build/Release/iwasm ]]; then
+            echo "iwasm binary is not found in the expected location."
+            exit 1
+          fi
+
+          build/Release/iwasm --version
+        working-directory: ${{ inputs.cwd }}
+
       - name: Compress the binary on Windows
         if: inputs.runner == 'windows-latest'
         run: |

+ 24 - 0
.github/workflows/build_wamrc.yml

@@ -62,6 +62,30 @@ jobs:
           cmake --build build --config Release --parallel 4
         working-directory: wamr-compiler
 
+      - name: smoke test on non-windows
+        if: ${{ !startsWith(inputs.runner, 'windows') }}
+        shell: bash
+        run: |
+          if [[ ! -f build/wamrc ]]; then
+            echo "wamrc binary is not found in the expected location."
+            exit 1
+          fi
+
+          build/wamrc --version
+        working-directory: wamr-compiler
+
+      - name: smoke test on Windows
+        if: ${{ startsWith(inputs.runner, 'windows') }}
+        shell: bash
+        run: |
+          if [[ ! -f build/Release/wamrc ]]; then
+            echo "wamrc binary is not found in the expected location."
+            exit 1
+          fi
+
+          build/Release/wamrc --version
+        working-directory: wamr-compiler
+
       - name: Compress the binary on Windows
         if: inputs.runner == 'windows-latest' && inputs.release
         run: |