wamr-ide: Add vscode extension tests (#2292)
This PR adds tests for #2219 by changing the `compilation_on_android_ubuntu.yml` workflow. The first run will take about two hours, since LLDB is built from scratch. Later, the build is cached and the whole job should not take more than three minutes. Core of the PR is an integration test that boots up vscode and lets it debug a test WASM file.
This commit is contained in:
116
.github/workflows/compilation_on_android_ubuntu.yml
vendored
116
.github/workflows/compilation_on_android_ubuntu.yml
vendored
@ -21,6 +21,7 @@ on:
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
- "wamr-sdk/**"
|
||||
- "test-tools/wamr-ide/**"
|
||||
# will be triggered on push events
|
||||
push:
|
||||
branches:
|
||||
@ -38,6 +39,7 @@ on:
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
- "wamr-sdk/**"
|
||||
- "test-tools/wamr-ide/**"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
@ -545,3 +547,117 @@ jobs:
|
||||
if: env.TEST_ON_X86_32 == 'true'
|
||||
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
test-wamr-ide:
|
||||
needs:
|
||||
[
|
||||
build_iwasm
|
||||
]
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
PYTHON_VERSION: '3.10'
|
||||
PYTHON_UBUNTU_STANDALONE_BUILD: https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.10.11+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
rustup target add wasm32-wasi
|
||||
sudo apt update && sudo apt-get install -y lld ninja-build
|
||||
npm install
|
||||
working-directory: test-tools/wamr-ide/VSCode-Extension
|
||||
|
||||
- name: build iwasm with source debugging feature
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DWAMR_BUILD_DEBUG_INTERP=1
|
||||
make
|
||||
working-directory: product-mini/platforms/linux
|
||||
|
||||
- name: Cache LLDB
|
||||
id: cache-lldb
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-lldb-vscode
|
||||
with:
|
||||
path: test-tools/wamr-ide/VSCode-Extension/resource/debug/linux
|
||||
key: ${{ env.cache-name }}-${{ hashFiles('build-scripts/lldb-wasm.patch') }}-${{ env.PYTHON_UBUNTU_STANDALONE_BUILD }}
|
||||
|
||||
- if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
|
||||
name: get stand-alone python ubuntu
|
||||
run: |
|
||||
wget ${{ env.PYTHON_UBUNTU_STANDALONE_BUILD }} -O python.tar.gz
|
||||
tar -xvf python.tar.gz
|
||||
working-directory: core/deps
|
||||
|
||||
- if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
|
||||
name: download llvm
|
||||
run: |
|
||||
wget https://github.com/llvm/llvm-project/archive/1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
|
||||
unzip -q 1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
|
||||
mv llvm-project-1f27fe6128769f00197925c3b8f6abb9d0e5cd2e llvm-project
|
||||
working-directory: core/deps
|
||||
|
||||
- if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
|
||||
name: apply wamr patch
|
||||
run: |
|
||||
git init
|
||||
git config user.email "action@github.com"
|
||||
git config user.name "github action"
|
||||
git apply ../../../build-scripts/lldb-wasm.patch
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
|
||||
name: build lldb ubuntu
|
||||
run: |
|
||||
echo "start to build lldb..."
|
||||
mkdir -p wamr-lldb
|
||||
cmake -S ./llvm -B build \
|
||||
-G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \
|
||||
-DCMAKE_BUILD_TYPE:STRING="Release" \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
|
||||
-DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
|
||||
-DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
|
||||
-DLLVM_BUILD_DOCS:BOOL=OFF \
|
||||
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
|
||||
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \
|
||||
-DLLVM_BUILD_TESTS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_DOCS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
|
||||
-DLLVM_ENABLE_BINDINGS:BOOL=OFF \
|
||||
-DLLVM_ENABLE_LIBXML2:BOOL=ON \
|
||||
-DLLVM_ENABLE_LLD:BOOL=ON \
|
||||
-DLLDB_ENABLE_PYTHON:BOOL=ON \
|
||||
-DLLDB_EMBED_PYTHON_HOME=ON \
|
||||
-DLLDB_PYTHON_HOME=.. \
|
||||
-DLLDB_PYTHON_RELATIVE_PATH=lib/lldb-python \
|
||||
-DPython3_EXECUTABLE="$(pwd)/../python/bin/python${{ env.PYTHON_VERSION }}"
|
||||
cmake --build build --target lldb install --parallel $(nproc)
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
|
||||
name: copy lldb to extension folder
|
||||
run: |
|
||||
mkdir -p bin
|
||||
mkdir -p lib
|
||||
cp ../../../../../../core/deps/llvm-project/lldb/tools/lldb-vscode/package.json ./
|
||||
cp -r ../../../../../../core/deps/llvm-project/lldb/tools/lldb-vscode/syntaxes/ ./
|
||||
cp ../../../../../../core/deps/llvm-project/build/bin/lldb* bin
|
||||
cp ../../../../../../core/deps/llvm-project/build/lib/liblldb*.so lib
|
||||
cp ../../../../../../core/deps/llvm-project/build/lib/liblldb*.so.* lib
|
||||
cp -R ../../../../../../core/deps/llvm-project/build/lib/lldb-python lib
|
||||
cp -R ../../../../../../core/deps/python/lib/python* lib
|
||||
cp ../../../../../../core/deps/python/lib/libpython${{ env.PYTHON_VERSION }}.so.1.0 lib
|
||||
working-directory: test-tools/wamr-ide/VSCode-Extension/resource/debug/linux
|
||||
|
||||
- name: run tests
|
||||
timeout-minutes: 5
|
||||
run: xvfb-run npm run test
|
||||
working-directory: test-tools/wamr-ide/VSCode-Extension
|
||||
|
||||
Reference in New Issue
Block a user