1 FIND_PACKAGE(PythonInterp 3 REQUIRED) 2 FILE(GLOB test_cases "test_*.t") 3 4 IF(CMAKE_C_COMPILER_ID STREQUAL "Clang") 5 FILE(GLOB test_cases_san "test-san_*.t") 6 ENDIF() 7 8 SET(PYTHON_VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/.venv") 9 SET(PYTHON_VENV_PIP "${PYTHON_VENV_DIR}/bin/pip") 10 SET(PYTHON_VENV_CRAM "${PYTHON_VENV_DIR}/bin/cram") 11 12 ADD_CUSTOM_COMMAND( 13 OUTPUT ${PYTHON_VENV_CRAM} 14 COMMAND ${PYTHON_EXECUTABLE} -m venv ${PYTHON_VENV_DIR} 15 COMMAND ${PYTHON_VENV_PIP} install cram 16 ) 17 ADD_CUSTOM_TARGET(prepare-cram-venv ALL DEPENDS ${PYTHON_VENV_CRAM}) 18 19 ADD_CUSTOM_TARGET( 20 http-server-kill ALL 21 COMMAND pkill --full -9 "${PYTHON_VENV_DIR}/bin/python3 -m http.server 1922 --bind 127.0.0.1" > /dev/null 2>&1 || true 22 DEPENDS ${PYTHON_VENV_CRAM} 23 ) 24 25 ADD_CUSTOM_TARGET( 26 http-server ALL 27 COMMAND ${PYTHON_VENV_DIR}/bin/python3 -m http.server 1922 --bind 127.0.0.1 > /dev/null 2>&1 & ; 28 curl --silent --retry 3 --retry-delay 1 --retry-connrefused http://127.0.0.1:1922 > /dev/null 29 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/server 30 DEPENDS http-server-kill 31 ) 32 33 ADD_TEST( 34 NAME cram 35 COMMAND ${PYTHON_VENV_CRAM} ${test_cases} ${test_cases_san} 36 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 37 ) 38 39 SET_PROPERTY(TEST cram APPEND PROPERTY ENVIRONMENT "BUILD_BIN_DIR=$<TARGET_FILE_DIR:uclient-fetch>")
This page was automatically generated by LXR 0.3.1. • OpenWrt