cJSON

mirror of Dave's cJSON
git clone git://git.thc420.xyz/cJSON
Log | Files | Refs | README | LICENSE

commit c597601cf151a757dcf800548f18034d4ddfe2cb
parent e3d579889634faf7b12468c10621a8d8bb0046d0
Author: Max Bruckner <max@maxbruckner.de>
Date:   Wed, 15 Mar 2017 00:23:48 +0100

tests: run cJSON_test{,_utils} along with the other tests

Diffstat:
MCMakeLists.txt | 15+++++++++++++++
Mtests/CMakeLists.txt | 7+------
2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -167,9 +167,24 @@ if(ENABLE_CJSON_TEST) add_executable("${TEST_CJSON}" test.c) target_link_libraries("${TEST_CJSON}" "${CJSON_LIB}") + add_test(NAME ${TEST_CJSON} COMMAND "${CMAKE_CURRENT_BINARY_DIR}/${TEST_CJSON}") + # Disable -fsanitize=float-divide-by-zero for cJSON_test + list(FIND custom_compiler_flags "-fsanitize=float-divide-by-zero" float_divide_by_zero_found) + if (float_divide_by_zero_found) + target_compile_options(${TEST_CJSON} PRIVATE "-fno-sanitize=float-divide-by-zero") + endif() + if(ENABLE_CJSON_UTILS) set(TEST_CJSON_UTILS cJSON_test_utils) add_executable("${TEST_CJSON_UTILS}" test_utils.c) target_link_libraries("${TEST_CJSON_UTILS}" "${CJSON_UTILS_LIB}") + + add_test(NAME ${TEST_CJSON_UTILS} COMMAND "${CMAKE_CURRENT_BINARY_DIR}/${TEST_CJSON_UTILS}") endif() + + #"check" target that automatically builds everything and runs the tests + add_custom_target(check + COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure + DEPENDS ${unity_tests} ${TEST_CJSON} ${TEST_CJSON_UTILS}) + endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt @@ -46,17 +46,12 @@ if(ENABLE_CJSON_TEST) endif() endif() - #"check" target that automatically builds everything and runs the tests - add_custom_target(check - COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure - DEPENDS ${unity_tests}) - foreach(unity_test ${unity_tests}) add_executable("${unity_test}" "${unity_test}.c") target_link_libraries("${unity_test}" "${CJSON_LIB}" unity test-common) if(MEMORYCHECK_COMMAND) add_test(NAME "${unity_test}" - COMMAND "${MEMORYCHECK_COMMAND}" ${MEMORYCHECK_COMMAND_OPTIONS} "./${unity_test}") + COMMAND "${MEMORYCHECK_COMMAND}" ${MEMORYCHECK_COMMAND_OPTIONS} "${CMAKE_CURRENT_BINARY_DIR}/${unity_test}") else() add_test(NAME "${unity_test}" COMMAND "./${unity_test}")