ソースを参照

Add regression test CI (#4512)

The entire CI test run takes approximately 3 minutes.
The test run fails if there is at least one failed case (failed > 0).
Liu Jia 5 ヶ月 前
コミット
6c6447fadb

+ 41 - 0
.github/workflows/compilation_on_android_ubuntu.yml

@@ -371,6 +371,47 @@ jobs:
           ctest
         working-directory: tests/unit
 
+  build_regression_tests:
+    needs:
+      [build_llvm_libraries_on_ubuntu_2204]
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-22.04]
+        include:
+          - os: ubuntu-22.04
+            llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
+    
+    steps:
+      - name: checkout
+        uses: actions/checkout@v4
+
+      - name: Get LLVM libraries
+        id: retrieve_llvm_libs
+        uses: actions/cache@v4
+        with:
+          path: |
+            ./core/deps/llvm/build/bin
+            ./core/deps/llvm/build/include
+            ./core/deps/llvm/build/lib
+            ./core/deps/llvm/build/libexec
+            ./core/deps/llvm/build/share
+          key: ${{ matrix.llvm_cache_key }}
+
+      - name: Quit if cache miss
+        if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
+        run: echo "::error::can not get prebuilt llvm libraries" && exit 1
+      
+      - name: Build wamrc and iwasm
+        run: |
+          ./build_wamr.sh
+        working-directory: tests/regression/ba-issues
+      
+      - name: Run regression tests
+        run: |
+          python run.py
+        working-directory: tests/regression/ba-issues
+
   build_samples_wasm_c_api:
     needs:
       [

+ 6 - 0
tests/regression/ba-issues/run.py

@@ -11,6 +11,7 @@ import subprocess
 import glob
 import re
 import argparse
+import sys
 
 from typing import Dict, Optional, List
 
@@ -275,6 +276,11 @@ def process_and_run_test_cases(
     else:
         print(f"  Issues not found in folder: {format_issue_ids_should_test}")
 
+    if failed > 0:
+        # Exit with error code if there are failed test for CI
+        print("Some tests failed, see log file for details.")
+        sys.exit(1)
+
 
 def main():
     parser = argparse.ArgumentParser(description="Run BA issue tests.")