TEST: WASM: Support wasm integration_tests · lcompilers/lpython@0f226b0 · GitHub
Skip to content

Commit 0f226b0

Browse files
committed
TEST: WASM: Support wasm integration_tests
1 parent 3df4a1a commit 0f226b0

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions

integration_tests/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,29 @@ macro(RUN)
107107
if (${RUN_FAIL})
108108
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
109109
endif()
110+
elseif(KIND STREQUAL "wasm")
111+
# wasm test
112+
execute_process(COMMAND lpython --backend wasm ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py -o ${name})
113+
114+
find_program(WASM_EXEC_RUNTIME node)
115+
execute_process(COMMAND "${WASM_EXEC_RUNTIME}" --version
116+
OUTPUT_VARIABLE WASM_EXEC_VERSION
117+
OUTPUT_STRIP_TRAILING_WHITESPACE)
118+
string(COMPARE GREATER_EQUAL "${WASM_EXEC_VERSION}"
119+
"v16.0.0" IS_NODE_ABOVE_16)
120+
121+
if (NOT IS_NODE_ABOVE_16)
122+
message(STATUS "${WASM_EXEC_RUNTIME} version: ${WASM_EXEC_VERSION}")
123+
set(WASM_EXEC_FLAGS "--experimental-wasm-bigint")
124+
endif()
125+
126+
add_test(${name} ${WASM_EXEC_RUNTIME} ${WASM_EXEC_FLAGS} ${CMAKE_CURRENT_BINARY_DIR}/${name}.js)
127+
if (RUN_LABELS)
128+
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
129+
endif()
130+
if (${RUN_FAIL})
131+
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
132+
endif()
110133
endif()
111134
endif()
112135
endmacro(RUN)

integration_tests/run_tests.sh

Lines changed: 7 additions & 1 deletion

0 commit comments

Comments
 (0)