Skip to content

Commit f431a94

Browse files
committed
tests(unit): Add llm-enhanced-test submodule integration
Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
1 parent 2ed856e commit f431a94

File tree

11 files changed

+99
-660
lines changed

11 files changed

+99
-660
lines changed

.github/workflows/compilation_on_android_ubuntu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ jobs:
323323
steps:
324324
- name: checkout
325325
uses: actions/checkout@v6.0.2
326+
with:
327+
submodules: recursive
326328

327329
- name: Get LLVM libraries
328330
id: retrieve_llvm_libs

.github/workflows/nightly_run.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,67 @@ jobs:
272272
cmake --build . --config Release --parallel 4
273273
working-directory: product-mini/platforms/${{ matrix.platform }}
274274

275+
build_unit_tests:
276+
needs: [build_llvm_libraries_on_ubuntu_2204, build_wamrc]
277+
runs-on: ${{ matrix.os }}
278+
strategy:
279+
fail-fast: false
280+
matrix:
281+
os: [ubuntu-22.04]
282+
build_target: ["X86_64", "X86_32"]
283+
include:
284+
- os: ubuntu-22.04
285+
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
286+
287+
steps:
288+
- name: checkout
289+
uses: actions/checkout@v6.0.2
290+
with:
291+
submodules: recursive
292+
293+
- name: Get LLVM libraries
294+
id: retrieve_llvm_libs
295+
uses: actions/cache@v5
296+
with:
297+
path: |
298+
./core/deps/llvm/build/bin
299+
./core/deps/llvm/build/include
300+
./core/deps/llvm/build/lib
301+
./core/deps/llvm/build/libexec
302+
./core/deps/llvm/build/share
303+
key: ${{ matrix.llvm_cache_key }}
304+
305+
- name: Quit if cache miss
306+
if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
307+
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
308+
309+
- name: install-wasi-sdk-wabt
310+
uses: ./.github/actions/install-wasi-sdk-wabt
311+
with:
312+
os: ${{ matrix.os }}
313+
314+
- name: Build wamrc
315+
run: |
316+
mkdir build && cd build
317+
cmake ..
318+
cmake --build . --config Release --parallel 4
319+
working-directory: wamr-compiler
320+
321+
- name: Install dependencies for X86_32
322+
if: matrix.build_target == 'X86_32'
323+
run: |
324+
sudo dpkg --add-architecture i386
325+
sudo apt-get update
326+
sudo apt-get install -y g++-multilib libzstd-dev:i386 zlib1g-dev:i386
327+
328+
- name: Build and run unit tests
329+
run: |
330+
mkdir build && cd build
331+
cmake .. -DWAMR_BUILD_TARGET=${{ matrix.build_target }} -DFULL_TEST=ON
332+
cmake --build . --parallel 4
333+
ctest --output-on-failure
334+
working-directory: tests/unit
335+
275336
build_iwasm_linux_gcc4_8:
276337
runs-on: ubuntu-latest
277338
container:

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "tests/unit/llm-enhanced-test"]
2+
path = tests/unit/llm-enhanced-test
3+
url = https://github.com/wasm-micro-runtime/llm-enhanced-test.git
4+
branch = main

tests/unit/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
cmake_minimum_required(VERSION 3.14)
55

66
project(unit-test)
7+
option(FULL_TEST "Build all unit tests including llm-enhanced-test" OFF)
78

89
# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
910
# our `cmake_minimum_required()` to 3.5. However, there are CMakeLists.txt
@@ -87,10 +88,16 @@ add_subdirectory(linux-perf)
8788
add_subdirectory(gc)
8889
add_subdirectory(tid-allocator)
8990
add_subdirectory(unsupported-features)
90-
add_subdirectory(smart-tests)
9191
add_subdirectory(exception-handling)
9292
add_subdirectory(running-modes)
9393

94+
if(FULL_TEST)
95+
message(STATUS "FULL_TEST=ON: include llm-enhanced-test")
96+
add_subdirectory(llm-enhanced-test)
97+
else()
98+
message(STATUS "FULL_TEST=OFF: exclude llm-enhanced-test")
99+
endif()
100+
94101
if(WAMR_BUILD_TARGET STREQUAL "X86_64")
95102
add_subdirectory(aot-stack-frame)
96103

tests/unit/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ When creating a `CMakeLists.txt` file for your test suite, follow these best pra
9292
9393
---
9494
95+
## Initializing Submodules
96+
97+
Test suite `llm-enhanced-test` is maintained in separate repository and included as git submodule. You need to initialize it before building.
98+
99+
```bash
100+
git submodule update --init --recursive
101+
```
102+
103+
Alternatively, if you haven't cloned the repository yet, use `--recursive` when cloning:
104+
105+
```bash
106+
git clone --recursive https://github.com/bytecodealliance/wasm-micro-runtime.git
107+
```
108+
109+
---
110+
95111
## Compiling and Running Test Cases
96112

97113
To compile and run the test cases, follow these steps:
@@ -102,6 +118,13 @@ To compile and run the test cases, follow these steps:
102118
cmake -S . -B build
103119
```
104120

121+
By default, all unit tests except `llm-enhanced-test` are built (`-DFULL_TEST=OFF`).
122+
To also include `llm-enhanced-test`, configure with:
123+
124+
```bash
125+
cmake -S . -B build -DFULL_TEST=ON
126+
```
127+
105128
2. **Build the Test Suite**:
106129

107130
```bash

tests/unit/llm-enhanced-test

Submodule llm-enhanced-test added at 36c74f6

tests/unit/smart-tests/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/unit/smart-tests/interpreter/CMakeLists.txt

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)