1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
add_executable(scitokens-gtest main.cpp)
if( NOT SCITOKENS_EXTERNAL_GTEST )
add_dependencies(scitokens-gtest gtest)
include_directories("${PROJECT_SOURCE_DIR}/vendor/gtest/googletest/include")
endif()
if(SCITOKENS_EXTERNAL_GTEST)
set(LIBGTEST "gtest")
else()
set(LIBGTEST "${CMAKE_BINARY_DIR}/external/gtest/src/gtest-build/lib/libgtest.a")
endif()
target_link_libraries(scitokens-gtest SciTokens "${LIBGTEST}" pthread)
add_test(
NAME
unit
COMMAND
${CMAKE_CURRENT_BINARY_DIR}/scitokens-gtest
)
# Environment variable configuration test executable
add_executable(scitokens-env-test test_env_config.cpp)
target_link_libraries(scitokens-env-test SciTokens)
# Environment variable configuration test
add_test(
NAME
env_config
COMMAND
${CMAKE_CURRENT_BINARY_DIR}/scitokens-env-test
)
set_tests_properties(env_config
PROPERTIES
ENVIRONMENT "SCITOKEN_CONFIG_KEYCACHE_UPDATE_INTERVAL_S=1234;SCITOKEN_CONFIG_KEYCACHE_EXPIRATION_INTERVAL_S=5678;SCITOKEN_CONFIG_KEYCACHE_CACHE_HOME=/tmp/test_scitoken_cache;SCITOKEN_CONFIG_TLS_CA_FILE=/tmp/test_ca.pem"
)
# Monitoring unit tests
add_executable(scitokens-monitoring-test monitoring_test.cpp)
if( NOT SCITOKENS_EXTERNAL_GTEST )
add_dependencies(scitokens-monitoring-test gtest)
endif()
target_link_libraries(scitokens-monitoring-test SciTokens "${LIBGTEST}" pthread)
add_test(
NAME
monitoring
COMMAND
${CMAKE_CURRENT_BINARY_DIR}/scitokens-monitoring-test
)
# Integration test executable
find_package( Atomic REQUIRED )
add_executable(scitokens-integration-test integration_test.cpp)
if( NOT SCITOKENS_EXTERNAL_GTEST )
add_dependencies(scitokens-integration-test gtest)
endif()
target_link_libraries(scitokens-integration-test SciTokens "${LIBGTEST}" pthread std::atomic)
# Integration test fixture - setup
add_test(
NAME
integration::setup
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/integration-test-setup.sh integration
)
set_tests_properties(integration::setup
PROPERTIES
FIXTURES_SETUP integration
ENVIRONMENT "BINARY_DIR=${CMAKE_BINARY_DIR};SOURCE_DIR=${PROJECT_SOURCE_DIR}"
)
# Integration test fixture - teardown
add_test(
NAME
integration::teardown
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/integration-test-teardown.sh integration
)
set_tests_properties(integration::teardown
PROPERTIES
FIXTURES_CLEANUP integration
ENVIRONMENT "BINARY_DIR=${CMAKE_BINARY_DIR}"
)
# Integration test
add_test(
NAME
integration::test
COMMAND
${CMAKE_CURRENT_BINARY_DIR}/scitokens-integration-test
)
set_tests_properties(integration::test
PROPERTIES
FIXTURES_REQUIRED integration
ENVIRONMENT "BINARY_DIR=${CMAKE_BINARY_DIR};CURL_CA_BUNDLE=${CMAKE_BINARY_DIR}/tests/integration/current/ca-cert.pem"
)
|