From bf7595325b2400a5955187195954e801bfff01b7 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Tue, 25 Jul 2023 22:19:12 +0530 Subject: [PATCH] TEST: Define and use llvm_py as backend --- .github/workflows/CI.yml | 4 ++-- integration_tests/CMakeLists.txt | 17 +++++++++++++++++ integration_tests/run_tests.py | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0b16387e9a..4b649ede94 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -396,8 +396,8 @@ jobs: shell: bash -e -l {0} run: | cd integration_tests - ./run_tests.py -b cpython c_py - ./run_tests.py -b cpython c_py -f + ./run_tests.py -b cpython c_py llvm_py + ./run_tests.py -b cpython c_py llvm_py -f sympy: name: Run SymPy tests diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 80bcef4196..c02e82e7dc 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -106,6 +106,23 @@ macro(RUN_UTIL RUN_FAIL RUN_NAME RUN_FILE_NAME RUN_LABELS RUN_EXTRAFILES RUN_EXT if (${fail}) set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE) endif() + elseif (KIND STREQUAL "llvm_py") + add_custom_command( + OUTPUT ${name}.o + COMMAND ${LPYTHON} -c ${extra_args} ${CMAKE_CURRENT_SOURCE_DIR}/${file_name}.py -o ${name}.o + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file_name}.py + VERBATIM) + add_executable(${name} ${name}.o ${extra_files}) + target_include_directories(${name} PRIVATE ${CMAKE_SOURCE_DIR} ${NUMPY_INCLUDE_DIR}) + set_target_properties(${name} PROPERTIES LINKER_LANGUAGE C) + target_link_libraries(${name} lpython_rtlib Python::Python) + add_test(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}) + if (labels) + set_tests_properties(${name} PROPERTIES LABELS "${labels}") + endif() + if (${fail}) + set_tests_properties(${name} PROPERTIES WILL_FAIL TRUE) + endif() elseif(KIND STREQUAL "llvm_sym") add_custom_command( OUTPUT ${name}.o diff --git a/integration_tests/run_tests.py b/integration_tests/run_tests.py index 804380e4b9..c84f73cb5f 100755 --- a/integration_tests/run_tests.py +++ b/integration_tests/run_tests.py @@ -6,7 +6,7 @@ # Initialization DEFAULT_THREADS_TO_USE = 8 # default no of threads is 8 -SUPPORTED_BACKENDS = ['llvm', 'c', 'wasm', 'cpython', 'x86', 'wasm_x86', 'wasm_x64', 'c_py', 'c_sym', 'cpython_sym', 'llvm_sym'] +SUPPORTED_BACKENDS = ['llvm', 'c', 'wasm', 'cpython', 'x86', 'wasm_x86', 'wasm_x64', 'c_py', 'c_sym', 'cpython_sym', 'llvm_sym', 'llvm_py'] BASE_DIR = os.path.dirname(os.path.realpath(__file__)) LPYTHON_PATH = f"{BASE_DIR}/../src/bin" @@ -62,7 +62,7 @@ def main(): DEFAULT_THREADS_TO_USE = args.no_of_threads or DEFAULT_THREADS_TO_USE fast_tests = "yes" if args.fast else "no" for backend in args.backends: - python_libs_req = "yes" if backend in ["c_py", "c_sym", "llvm_sym"] else "no" + python_libs_req = "yes" if backend in ["c_py", "c_sym", "llvm_sym", 'llvm_py'] else "no" test_backend(backend)