Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ integration_tests/b1/*
integration_tests/b2/*
integration_tests/b3/*
integration_tests/b4/*
integration_tests/b5/*
integration_tests/b6/*
integration_tests/_lpython-tmp-test-*
inst/bin/*
*.tlog
Expand Down
3 changes: 3 additions & 0 deletions ci/test.xsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ if $WIN != "1":
python run_tests.py
cd integration_tests
python run_tests_new.py -j16 -b llvm cpython c wasm

if $(uname).strip() == "Linux":
python run_tests_new.py -j16 -b x86 wasm_x86
43 changes: 39 additions & 4 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ macro(RUN)
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
endif()
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
elseif(KIND STREQUAL "c")
add_custom_command(
Expand All @@ -86,7 +86,7 @@ macro(RUN)
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
endif()
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
elseif(KIND STREQUAL "cpython")
# CPython test
Expand All @@ -105,7 +105,41 @@ macro(RUN)
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
endif()
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
elseif(KIND STREQUAL "x86")
# x86 test
add_custom_command(
OUTPUT ${name}.x86
COMMAND lpython --backend x86 ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py -o ${name}.x86
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py
VERBATIM
)
add_custom_target(${name} ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${name}.x86)
add_test(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.x86)
if (RUN_LABELS)
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
endif()
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
elseif(KIND STREQUAL "wasm_x86")
# wasm_to_x86 test
add_custom_command(
OUTPUT ${name}.x86
COMMAND lpython --backend wasm_x86 ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py -o ${name}.x86
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py
VERBATIM
)
add_custom_target(${name} ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${name}.x86)
add_test(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.x86)
if (RUN_LABELS)
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
endif()
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
elseif(KIND STREQUAL "wasm")
# wasm test
Expand All @@ -128,7 +162,7 @@ macro(RUN)
set_tests_properties(${name} PROPERTIES LABELS "${RUN_LABELS}")
endif()
if (${RUN_FAIL})
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE)
endif()
endif()
endif()
Expand All @@ -152,6 +186,7 @@ RUN(NAME exit_02c FAIL LABELS cpython llvm c)

# Test all four backends
RUN(NAME print_01 LABELS cpython llvm c wasm) # wasm not yet supports sep and end keywords
RUN(NAME print_03 LABELS x86 wasm_x86) # simple test case specifically for x86 and wasm_x86

# CPython and LLVM
RUN(NAME const_01 LABELS cpython llvm c)
Expand Down
10 changes: 10 additions & 0 deletions integration_tests/print_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def Main0():
x: i32
x = (2+3)*5
print(x)
print("Hi")
print("Hello")
print((5-2) * 7)
print("Bye")

Main0()
18 changes: 17 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 b4
rm -rf b1 b2 b3 b4 b5 b6

# Append "-j4" or "-j" to run in parallel
jn=$1
Expand Down Expand Up @@ -38,3 +38,19 @@ node -v
cmake -DKIND=wasm ..
make $jn
ctest $jn --output-on-failure
cd ..

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
mkdir b5
cd b5
cmake -DKIND=x86 ..
make $jn
ctest $jn --output-on-failure
cd ..

mkdir b6
cd b6
cmake -DKIND=wasm_x86 ..
make $jn
ctest $jn --output-on-failure
fi
2 changes: 1 addition & 1 deletion integration_tests/run_tests_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Initialization
DEFAULT_THREADS_TO_USE = 8 # default no of threads is 8
SUPPORTED_BACKENDS = ['llvm', 'c', 'wasm', 'cpython']
SUPPORTED_BACKENDS = ['llvm', 'c', 'wasm', 'cpython', 'x86', 'wasm_x86']
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
LPYTHON_PATH = f"{BASE_DIR}/../src/bin"

Expand Down