diff --git a/.github/workflows/compilation_on_windows.yml b/.github/workflows/compilation_on_windows.yml index 416d76099..3805dac30 100644 --- a/.github/workflows/compilation_on_windows.yml +++ b/.github/workflows/compilation_on_windows.yml @@ -39,6 +39,12 @@ on: # allow to be triggered manually workflow_dispatch: +env: + # For Spec Test + DEFAULT_TEST_OPTIONS: "-s spec -b" + MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M" + THREADS_TEST_OPTIONS: "-s spec -b -p" + # Cancel any in-flight jobs for the same PR/branch so there's only one active # at a time concurrency: @@ -77,3 +83,30 @@ jobs: mkdir build && cd build cmake .. ${{ matrix.build_options }} cmake --build . --config Release --parallel 4 + + test: + runs-on: windows-latest + needs: [build] + strategy: + fail-fast: false + matrix: + running_mode: + [ + "classic-interp", + "fast-interp", + ] + test_option: + [ + $DEFAULT_TEST_OPTIONS, + $MULTI_MODULES_TEST_OPTIONS, + $THREADS_TEST_OPTIONS, + ] + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: run tests + shell: bash + timeout-minutes: 20 + run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} + working-directory: ./tests/wamr-test-suites diff --git a/core/iwasm/common/wasm_application.c b/core/iwasm/common/wasm_application.c index 2ed217e7a..a046f2da2 100644 --- a/core/iwasm/common/wasm_application.c +++ b/core/iwasm/common/wasm_application.c @@ -370,6 +370,18 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name, { float32 f32 = strtof(argv[i], &endptr); if (isnan(f32)) { +#ifdef _MSC_VER + /* + * Spec tests require the binary representation of NaN to be + * 0x7fc00000 for float and 0x7ff8000000000000 for float; + * however, in MSVC compiler, strtof doesn't return this + * exact value, causing some of the spec test failures. We + * use the value returned by nan/nanf as it is the one + * expected by spec tests. + * + */ + f32 = nanf(""); +#endif if (argv[i][0] == '-') { union ieee754_float u; u.f = f32; @@ -404,6 +416,9 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name, } u; u.val = strtod(argv[i], &endptr); if (isnan(u.val)) { +#ifdef _MSC_VER + u.val = nan(""); +#endif if (argv[i][0] == '-') { union ieee754_double ud; ud.d = u.val; @@ -567,7 +582,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name, { #if UINTPTR_MAX == UINT32_MAX if (argv1[k] != 0 && argv1[k] != (uint32)-1) - os_printf("%p:ref.extern", (void *)argv1[k]); + os_printf("0x%" PRIxPTR ":ref.extern", (void *)argv1[k]); else os_printf("extern:ref.null"); k++; @@ -580,7 +595,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name, u.parts[1] = argv1[k + 1]; k += 2; if (u.val && u.val != (uintptr_t)-1LL) - os_printf("%p:ref.extern", (void *)u.val); + os_printf("0x%" PRIxPTR ":ref.extern", (void *)u.val); else os_printf("extern:ref.null"); #endif