libubox/tests/cram/CMakeLists.txt
Petr Štetiar b0a5cd8a28 add cram based unit tests
For improved QA etc. For the start with initial test cases for avl,
base64, jshn and list components. Moved runqueue and blobmsg from
examples to tests.  Converted just a few first test cases from
json-script example into the new cram based unit test, more to come.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-24 13:26:58 +01:00

22 lines
738 B
CMake

FIND_PACKAGE(PythonInterp 3 REQUIRED)
FILE(GLOB test_cases "test_*.t")
SET(PYTHON_VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/.venv")
SET(PYTHON_VENV_PIP "${PYTHON_VENV_DIR}/bin/pip")
SET(PYTHON_VENV_CRAM "${PYTHON_VENV_DIR}/bin/cram")
ADD_CUSTOM_COMMAND(
OUTPUT ${PYTHON_VENV_CRAM}
COMMAND ${PYTHON_EXECUTABLE} -m venv ${PYTHON_VENV_DIR}
COMMAND ${PYTHON_VENV_PIP} install cram
)
ADD_CUSTOM_TARGET(prepare-cram-venv ALL DEPENDS ${PYTHON_VENV_CRAM})
ADD_TEST(
NAME cram
COMMAND ${PYTHON_VENV_CRAM} ${test_cases}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
SET_PROPERTY(TEST cram APPEND PROPERTY ENVIRONMENT "JSHN=$<TARGET_FILE:jshn>")
SET_PROPERTY(TEST cram APPEND PROPERTY ENVIRONMENT "TEST_BIN_DIR=$<TARGET_FILE_DIR:test-avl>")