Просмотр исходного кода

Enable running WASI tests on Windows (#2489)

Tests are not passing yet therefore we don't enable them in CI.
Marcin Kolny 2 лет назад
Родитель
Сommit
834e0314aa
1 измененных файлов с 19 добавлено и 6 удалено
  1. 19 6
      tests/wamr-test-suites/wasi-test-script/run_wasi_tests.sh

+ 19 - 6
tests/wamr-test-suites/wasi-test-script/run_wasi_tests.sh

@@ -9,9 +9,22 @@ readonly MODE=$1
 readonly TARGET=$2
 
 readonly WORK_DIR=$PWD
-readonly PLATFORM=$(uname -s | tr A-Z a-z)
+
+if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
+    readonly PLATFORM=windows
+    readonly PYTHON_EXE=python
+    # see https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1
+    readonly VENV_BIN_DIR=Scripts
+    readonly IWASM_EXE=$(cygpath -m "${WORK_DIR}/../../../../product-mini/platforms/${PLATFORM}/build/RelWithDebInfo/iwasm.exe")
+else
+    readonly PLATFORM=$(uname -s | tr A-Z a-z)
+    readonly VENV_BIN_DIR=bin
+    readonly PYTHON_EXE=python3
+    readonly IWASM_EXE="${WORK_DIR}/../../../../product-mini/platforms/${PLATFORM}/build/iwasm"
+fi
+
 readonly WAMR_DIR="${WORK_DIR}/../../../.."
-readonly IWASM_CMD="${WORK_DIR}/../../../../product-mini/platforms/${PLATFORM}/build/iwasm \
+readonly IWASM_CMD="${IWASM_EXE} \
     --allow-resolve=google-public-dns-a.google.com \
     --addr-pool=::1/128,127.0.0.1/32"
 readonly IWASM_CMD_STRESS="${IWASM_CMD} --max-threads=8"
@@ -59,11 +72,11 @@ run_aot_tests () {
 }
 
 if [[ $MODE != "aot" ]];then
-    python3 -m venv wasi-env && source wasi-env/bin/activate
-    python3 -m pip install -r test-runner/requirements.txt
+    $PYTHON_EXE -m venv wasi-env && source wasi-env/${VENV_BIN_DIR}/activate
+    $PYTHON_EXE -m pip install -r test-runner/requirements.txt
 
     # Stress test requires max-threads=8 so it's run separately
-    if [[ -e "${THREAD_INTERNAL_TESTS}spawn_stress_test.wasm" ]]; then 
+    if [[ -e "${THREAD_INTERNAL_TESTS}spawn_stress_test.wasm" ]]; then
         ${IWASM_CMD_STRESS} ${THREAD_INTERNAL_TESTS}spawn_stress_test.wasm
         ret=${PIPESTATUS[0]}
         if [ "${ret}" -ne 0 ]; then
@@ -72,7 +85,7 @@ if [[ $MODE != "aot" ]];then
         fi
     fi
 
-    TEST_RUNTIME_EXE="${IWASM_CMD}" python3 test-runner/wasi_test_runner.py \
+    TEST_RUNTIME_EXE="${IWASM_CMD}" $PYTHON_EXE test-runner/wasi_test_runner.py \
             -r adapters/wasm-micro-runtime.py \
             -t \
                 ${C_TESTS} \