2015-09-05 21:06:18 +02:00
|
|
|
if (NOT MSVC)
|
2015-11-16 18:35:16 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_DEFAULT} -std=c99 -Wall -Wextra -pedantic")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEFAULT} -std=c++11 -Wall -Wextra -pedantic")
|
2015-09-05 21:06:18 +02:00
|
|
|
endif ()
|
2015-07-28 19:03:46 +02:00
|
|
|
|
|
|
|
include_directories(../include)
|
|
|
|
|
|
|
|
set(SAMPLES
|
2015-09-07 01:42:15 +02:00
|
|
|
signal.c
|
|
|
|
report.c
|
|
|
|
suites.c
|
|
|
|
fixtures.c
|
|
|
|
asserts.c
|
|
|
|
more-suites.c
|
|
|
|
description.c
|
|
|
|
simple.c
|
|
|
|
theories.c
|
2015-09-11 16:56:40 +02:00
|
|
|
timeout.c
|
2015-09-11 00:21:31 +02:00
|
|
|
redirect.c
|
2015-09-17 17:44:47 +02:00
|
|
|
parameterized.c
|
2015-09-07 01:42:15 +02:00
|
|
|
|
2015-07-28 19:03:46 +02:00
|
|
|
)
|
|
|
|
|
2015-10-03 02:43:24 +02:00
|
|
|
if (CMAKE_CXX_COMPILER_WORKS)
|
|
|
|
set(SAMPLES ${SAMPLES}
|
|
|
|
signal.cc
|
|
|
|
report.cc
|
|
|
|
suites.cc
|
|
|
|
fixtures.cc
|
|
|
|
asserts.cc
|
|
|
|
more-suites.cc
|
|
|
|
description.cc
|
|
|
|
simple.cc
|
|
|
|
theories.cc
|
|
|
|
redirect.cc
|
|
|
|
parameterized.cc
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2015-07-29 11:58:51 +02:00
|
|
|
set(SCRIPTS
|
|
|
|
tap_test
|
2015-10-06 14:58:46 +02:00
|
|
|
xml_test
|
2015-11-11 13:41:47 +01:00
|
|
|
json_test
|
2015-07-29 11:58:51 +02:00
|
|
|
early_exit
|
|
|
|
verbose
|
|
|
|
list
|
|
|
|
fail_fast
|
|
|
|
help
|
|
|
|
)
|
|
|
|
|
2015-08-21 00:26:51 +02:00
|
|
|
if (HAVE_PCRE)
|
|
|
|
set(SCRIPTS ${SCRIPTS} pattern)
|
|
|
|
endif ()
|
|
|
|
|
2015-09-09 19:19:58 +02:00
|
|
|
add_custom_target(criterion_samples)
|
|
|
|
add_dependencies(criterion_tests criterion_samples)
|
|
|
|
|
2015-09-09 01:47:10 +02:00
|
|
|
macro(add_samples DIR_ SAMPLES_)
|
|
|
|
foreach(sample ${SAMPLES_})
|
2015-09-09 19:19:58 +02:00
|
|
|
add_executable(${sample}.bin EXCLUDE_FROM_ALL ${sample})
|
|
|
|
add_dependencies(criterion_samples ${sample}.bin)
|
2015-09-09 01:47:10 +02:00
|
|
|
target_link_libraries(${sample}.bin criterion)
|
|
|
|
add_test(${sample} ${sample}.bin)
|
|
|
|
set_property(TEST ${sample} PROPERTY
|
2015-09-06 03:29:41 +02:00
|
|
|
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
2015-09-16 00:54:36 +02:00
|
|
|
ENVIRONMENT "CRITERION_NO_EARLY_EXIT=1" # for coverage
|
2015-09-06 03:29:41 +02:00
|
|
|
)
|
2015-09-09 01:47:10 +02:00
|
|
|
|
|
|
|
if (NOT MSVC) # we disable the scripted tests when building with MSVC
|
2015-09-14 01:39:47 +02:00
|
|
|
add_test(${sample}_compare sh ${DIR_}/run_test.sh "${CMAKE_CURRENT_LIST_DIR}/outputs" . . ${sample}.bin)
|
2015-09-09 01:47:10 +02:00
|
|
|
set_property(TEST ${sample}_compare PROPERTY
|
|
|
|
ENVIRONMENT "LC_ALL=en_US.utf8"
|
|
|
|
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
|
|
|
ENVIRONMENT "CRITERION_SHORT_FILENAME=1"
|
2015-09-16 00:54:36 +02:00
|
|
|
ENVIRONMENT "CRITERION_NO_EARLY_EXIT=1" # for coverage
|
2015-09-22 23:21:51 +02:00
|
|
|
ENVIRONMENT "CRITERION_JOBS=1" # for output ordering
|
2015-10-06 15:44:09 +02:00
|
|
|
ENVIRONMENT "CRITERION_DISABLE_TIME_MEASUREMENTS=1" # do not compare timings
|
2015-09-09 01:47:10 +02:00
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
endforeach()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
add_samples("${CMAKE_CURRENT_LIST_DIR}/tests" "${SAMPLES}")
|
2015-07-29 11:58:51 +02:00
|
|
|
|
2015-09-06 02:45:58 +02:00
|
|
|
if (NOT MSVC) # we disable the scripted tests when building with MSVC
|
|
|
|
|
2015-07-29 11:58:51 +02:00
|
|
|
foreach(script ${SCRIPTS})
|
2015-11-11 13:45:52 +01:00
|
|
|
add_test(${script} sh "${CMAKE_CURRENT_LIST_DIR}/tests/${script}.sh")
|
2015-08-04 15:50:13 +02:00
|
|
|
set_property(TEST ${script} PROPERTY
|
|
|
|
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
2015-09-16 01:52:48 +02:00
|
|
|
ENVIRONMENT "CRITERION_NO_EARLY_EXIT=1" # for coverage
|
2015-08-04 15:50:13 +02:00
|
|
|
)
|
2015-08-20 07:20:29 +02:00
|
|
|
|
2015-11-11 13:45:52 +01:00
|
|
|
add_test(${script}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh "${CMAKE_CURRENT_LIST_DIR}" . "${CMAKE_CURRENT_LIST_DIR}" "tests/${script}.sh")
|
2015-08-20 07:20:29 +02:00
|
|
|
set_property(TEST ${script}_compare PROPERTY
|
2015-08-20 17:45:28 +02:00
|
|
|
ENVIRONMENT "LC_ALL=en_US.utf8"
|
2015-08-20 07:20:29 +02:00
|
|
|
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
2015-08-20 08:33:22 +02:00
|
|
|
ENVIRONMENT "CRITERION_SHORT_FILENAME=1"
|
2015-09-16 01:52:48 +02:00
|
|
|
ENVIRONMENT "CRITERION_NO_EARLY_EXIT=1" # for coverage
|
2015-09-22 23:21:51 +02:00
|
|
|
ENVIRONMENT "CRITERION_JOBS=1" # for output ordering
|
2015-08-20 07:20:29 +02:00
|
|
|
)
|
2015-07-28 19:03:46 +02:00
|
|
|
endforeach()
|
2015-09-06 02:45:58 +02:00
|
|
|
|
|
|
|
endif()
|
2015-09-09 01:47:10 +02:00
|
|
|
|
|
|
|
add_subdirectory(tests)
|