mirror of https://github.com/CrowCpp/Crow.git
on all platforms added CROW_FEATURES ssl, compression and needed libs to prerequisites
general tests are now enabled on MSVC, mustachetests disabled due to some strange bug in python script (will be done later)
This commit is contained in:
parent
6aed71e3c4
commit
17034adae5
|
@ -22,9 +22,11 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: [ ubuntu-latest, ubuntu-20.04,
|
||||
macos-latest, macos-11,
|
||||
windows-latest
|
||||
os: [ ubuntu-latest,
|
||||
windows-latest,
|
||||
ubuntu-20.04,
|
||||
macos-latest,
|
||||
macos-11
|
||||
]
|
||||
# ubuntu-18.04 does not work due to compile error on asio
|
||||
# windows-2019 not included to spare free minutes
|
||||
|
@ -36,11 +38,12 @@ jobs:
|
|||
sudo apt-get update && \
|
||||
sudo apt-get install -yq \
|
||||
libasio-dev \
|
||||
libssl-dev zlib1g-dev \
|
||||
cmake
|
||||
elif [ "$RUNNER_OS" == "Windows" ]; then
|
||||
VCPKG_DEFAULT_TRIPLET=x64-windows vcpkg install
|
||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||
brew install asio
|
||||
brew install asio openssl zlib
|
||||
else
|
||||
echo "$RUNNER_OS not supported"
|
||||
exit 1
|
||||
|
@ -51,12 +54,25 @@ jobs:
|
|||
run: |
|
||||
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||
cmake \
|
||||
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
-DCROW_FEATURES="ssl;compression" \
|
||||
-DCROW_AMALGAMATE=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
-DCROW_FEATURES="ssl;compression" \
|
||||
-DCROW_AMALGAMATE=ON \
|
||||
-DCROW_BUILD_TESTS=ON \
|
||||
-B build
|
||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||
LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
|
||||
CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" \
|
||||
cmake \
|
||||
-DCROW_FEATURES="ssl;compression" \
|
||||
-DCROW_AMALGAMATE=ON \
|
||||
-DCROW_BUILD_TESTS=ON \
|
||||
-B build
|
||||
else
|
||||
cmake \
|
||||
-DCROW_FEATURES="ssl;compression" \
|
||||
-DCROW_AMALGAMATE=ON \
|
||||
-DCROW_BUILD_TESTS=ON \
|
||||
-B build
|
||||
else
|
||||
cmake -B build
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
|
|
|
@ -31,6 +31,12 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
endif()
|
||||
endif()
|
||||
if (MSVC)
|
||||
add_compile_options(/bigobj)
|
||||
endif ()
|
||||
|
||||
include(FindPython3)
|
||||
find_package(Python3)
|
||||
|
||||
#####################################
|
||||
# Define Options
|
||||
|
@ -94,20 +100,28 @@ if(CROW_BUILD_EXAMPLES)
|
|||
endif()
|
||||
|
||||
# Tests
|
||||
if(NOT MSVC AND CROW_BUILD_TESTS)
|
||||
if(NOT "compression" IN_LIST CROW_FEATURES)
|
||||
message(STATUS "Compression tests are omitted. (Configure with CROW_FEATURES containing 'compression' to enable them)")
|
||||
endif()
|
||||
if(NOT "ssl" IN_LIST CROW_FEATURES)
|
||||
message(STATUS "SSL tests are omitted. (Configure with CROW_FEATURES containing 'ssl' to enable them)")
|
||||
else()
|
||||
add_test(NAME ssl_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/ssl/ssltest)
|
||||
endif()
|
||||
if(CROW_BUILD_TESTS)
|
||||
|
||||
add_subdirectory(tests)
|
||||
enable_testing()
|
||||
add_test(NAME crow_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest)
|
||||
add_test(NAME template_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/template/test.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests/template)
|
||||
add_subdirectory(tests)
|
||||
enable_testing()
|
||||
add_test(
|
||||
NAME crow_test
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest
|
||||
)
|
||||
|
||||
if(NOT "compression" IN_LIST CROW_FEATURES)
|
||||
message(STATUS "Compression tests are omitted. (Configure with CROW_FEATURES containing 'compression' to enable them)")
|
||||
endif()
|
||||
if(NOT "ssl" IN_LIST CROW_FEATURES)
|
||||
message(STATUS "SSL tests are omitted. (Configure with CROW_FEATURES containing 'ssl' to enable them)")
|
||||
else()
|
||||
if(NOT MSVC)
|
||||
add_test(
|
||||
NAME ssl_test
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/ssl/ssltest
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#####################################
|
||||
|
|
|
@ -3,6 +3,8 @@ project(crow_test)
|
|||
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/compiler_options.cmake)
|
||||
|
||||
enable_testing()
|
||||
|
||||
set(TEST_SRCS
|
||||
unittest.cpp
|
||||
)
|
||||
|
@ -23,7 +25,9 @@ endif()
|
|||
add_subdirectory(template)
|
||||
add_subdirectory(multi_file)
|
||||
add_subdirectory(external_definition)
|
||||
if ("ssl" IN_LIST CROW_FEATURES)
|
||||
add_subdirectory(ssl)
|
||||
if(NOT MSVC)
|
||||
if ("ssl" IN_LIST CROW_FEATURES)
|
||||
add_subdirectory(ssl)
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(img)
|
||||
|
|
|
@ -18,12 +18,21 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|||
target_link_libraries(mustachetest gcov)
|
||||
endif()
|
||||
|
||||
file(COPY DIRECTORY . DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILES_MATCHING PATTERN "*.json")
|
||||
if(NOT MSVC)
|
||||
# there is a bug in the python script, it does not find the path
|
||||
file(COPY DIRECTORY . DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILES_MATCHING PATTERN "*.json")
|
||||
|
||||
add_custom_command(OUTPUT test.py
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy ${PROJECT_SOURCE_DIR}/test.py ${CMAKE_CURRENT_BINARY_DIR}/test.py
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/test.py
|
||||
)
|
||||
add_custom_command(OUTPUT test.py
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy ${PROJECT_SOURCE_DIR}/test.py ${CMAKE_CURRENT_BINARY_DIR}/test.py
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/test.py
|
||||
)
|
||||
|
||||
add_custom_target(template_test_copy ALL DEPENDS test.py)
|
||||
add_custom_target(template_test_copy ALL DEPENDS test.py)
|
||||
|
||||
add_test(
|
||||
NAME template_test
|
||||
COMMAND python3 ${CMAKE_CURRENT_BINARY_DIR}/test.py
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -18,7 +18,10 @@ for testfile in glob.glob("*.json"):
|
|||
else:
|
||||
open('partials', 'w').write("{}")
|
||||
|
||||
ret = subprocess.check_output("./mustachetest").decode('utf8')
|
||||
if os.name == 'nt':
|
||||
ret = subprocess.check_output("mustachetest.exe").decode('utf8')
|
||||
else:
|
||||
ret = subprocess.check_output('./mustachetest').decode('utf8')
|
||||
print(testfile, test["name"])
|
||||
|
||||
if ret != test["expected"]:
|
||||
|
|
Loading…
Reference in New Issue