Skip to content

Commit

Permalink
TEST: WASM: Support wasm integration_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaikh-Ubaid committed Sep 14, 2022
1 parent 3df4a1a commit 0f226b0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ integration_tests/py_*
integration_tests/b1/*
integration_tests/b2/*
integration_tests/b3/*
integration_tests/b4/*

### https://raw.github.com/github/gitignore/218a941be92679ce67d0484547e3e142b2f5f6f0/Global/macOS.gitignore

Expand Down
23 changes: 23 additions & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,29 @@ macro(RUN)
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
elseif(KIND STREQUAL "wasm")
# wasm test
execute_process(COMMAND lpython --backend wasm ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py -o ${name})

find_program(WASM_EXEC_RUNTIME node)
execute_process(COMMAND "${WASM_EXEC_RUNTIME}" --version
OUTPUT_VARIABLE WASM_EXEC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(COMPARE GREATER_EQUAL "${WASM_EXEC_VERSION}"
"v16.0.0" IS_NODE_ABOVE_16)

if (NOT IS_NODE_ABOVE_16)
message(STATUS "${WASM_EXEC_RUNTIME} version: ${WASM_EXEC_VERSION}")
set(WASM_EXEC_FLAGS "--experimental-wasm-bigint")
endif()

add_test(${name} ${WASM_EXEC_RUNTIME} ${WASM_EXEC_FLAGS} ${CMAKE_CURRENT_BINARY_DIR}/${name}.js)
if (RUN_LABELS)
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
endif()
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
endif()
endif()
endmacro(RUN)
Expand Down
8 changes: 7 additions & 1 deletion integration_tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ex

rm -rf b1 b2 b3
rm -rf b1 b2 b3 b4

# Append "-j4" or "-j" to run in parallel
jn=$1
Expand Down Expand Up @@ -30,3 +30,9 @@ cd b3
cmake -DKIND=c ..
make $jn
ctest $jn --output-on-failure

mkdir b4
cd b4
cmake -DKIND=wasm ..
make $jn
ctest $jn --output-on-failure

0 comments on commit 0f226b0

Please sign in to comment.