set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE) if(BUILD_TESTING) ## get a list of the sources in this directory file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.c) ## these are generated by some tests, we need to remember to clean them ## up set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES foo1.ft_handle foo2.ft_handle foo3.ft_handle foo4.ft_handle bar1.ft_handle bar2.ft_handle bar3.ft_handle bar4.ft_handle test-dump-ft.out) ## this macro will remove the test from the list of source files so it ## doesn't end up getting the default test rule applied to it macro(declare_custom_tests) foreach(source ${ARGN}) list(REMOVE_ITEM srcs ${source}) endforeach(source) endmacro(declare_custom_tests) declare_custom_tests(logcursor-fw.c logcursor-bw.c) add_test(ft/logcursor-fw echo "logcursor-fw must be run manually (needs logs to iterate over).") add_test(ft/logcursor-bw echo "logcursor-bw must be run manually (needs logs to iterate over).") get_filename_component(toku_svn_root "${TokuDB_SOURCE_DIR}/../.." REALPATH) foreach(src ${srcs}) if(NOT "${src}" MATCHES "dir[.].*[.]c") ## annoying get_filename_component(base ${src} NAME_WE) add_executable(${base} ${src}) target_link_libraries(${base} ft ${LIBTOKUPORTABILITY}) add_common_options_to_binary_targets(${base}) set_property(TARGET ${base} APPEND PROPERTY COMPILE_DEFINITIONS "__SRCFILE__=\"${src}\";TOKUSVNROOT=\"${toku_svn_root}\"") set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${src}.ft_handle") set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${src}.ft") endif() endforeach(src) ## declare some tests that should be run with specific options declare_custom_tests(test-assert.c) add_test(ft/test-assertA test-assert) add_test(ft/test-assertB test-assert notok) set_tests_properties(ft/test-assertA ft/test-assertB PROPERTIES WILL_FAIL TRUE) add_test(ft/test-assertC test-assert ok) declare_custom_tests(benchmark-test.c) add_test(ft/benchmark-test benchmark-test -q --fname dir.check_benchmark-test) add_test(ft/benchmark-test_256 benchmark-test --valsize 256 --verify 1 --fname dir.check_benchmark-test_256) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES dir.check_benchmark-test dir.check_benchmark-test_256) declare_custom_tests(ftloader-test-merge-files-dbufio.c) add_test(ft/ftloader-test-merge-files-dbufio ftloader-test-merge-files-dbufio -r 8000 -s dir.check_ftloader-test-merge-files-dbufio) declare_custom_tests(ftloader-test.c) add_test(ft/ftloader-test ftloader-test dir.check_ftloader-test) declare_custom_tests(ftloader-test-bad-generate.c) add_test(ft/ftloader-test-bad-generate ftloader-test-bad-generate dir.check_ftloader-test-bad-generate) declare_custom_tests(ftloader-test-extractor.c) add_test(ft/ftloader-test-extractor-1 ftloader-test-extractor -s -r 1000 --rowsets 1000 --asc dir.check_ftloader-test-extractor-1) add_test(ft/ftloader-test-extractor-2 ftloader-test-extractor -s -r 1000 --rowsets 1000 --dsc dir.check_ftloader-test-extractor-2) add_test(ft/ftloader-test-extractor-3 ftloader-test-extractor -s -r 1000 --rowsets 1000 --random dir.check_ftloader-test-extractor-3) add_test(ft/ftloader-test-extractor-1a ftloader-test-extractor -s -r 1000 --rowsets 1000 --asc dir.check_ftloader-test-extractor-1a) add_test(ft/ftloader-test-extractor-2a ftloader-test-extractor -s -r 1000 --rowsets 1000 --dsc dir.check_ftloader-test-extractor-2a) add_test(ft/ftloader-test-extractor-3a ftloader-test-extractor -s -r 1000 --rowsets 1000 --random dir.check_ftloader-test-extractor-3a) add_test(ft/ftloader-test-extractor-4a ftloader-test-extractor -s -r 1000 --rowsets 3 --asc dir.check_ftloader-test-extractor-4a) add_test(ft/ftloader-test-extractor-5a ftloader-test-extractor -s -r 1000 --rowsets 3 --asc --asc-poison dir.check_ftloader-test-extractor-5a) declare_custom_tests(ftloader-test-extractor-errors.c) add_test(ft/ftloader-test-extractor-errors-1 ftloader-test-extractor-errors -w -m -u -r 1 dir.check_ftloader-test-extractor-errors-1) add_test(ft/ftloader-test-extractor-errors-2 ftloader-test-extractor-errors -m -r 10000 dir.check_ftloader-test-extractor-errors-2) declare_custom_tests(ftloader-test-open.c) add_test(ft/ftloader-test-open ftloader-test-open dir.check_ftloader-test-open) declare_custom_tests(ftloader-test-writer.c) add_test(ft/ftloader-test-writer-1 ftloader-test-writer -r 1 -s dir.check_ftloader-test-writer-1) add_test(ft/ftloader-test-writer-1000 ftloader-test-writer -r 1000 -s dir.check_ftloader-test-writer-1000) add_test(ft/ftloader-test-writer-100000 ftloader-test-writer -r 100000 -s dir.check_ftloader-test-writer-100000) add_test(ft/ftloader-test-writer-1000000 ftloader-test-writer -r 1000000 -s dir.check_ftloader-test-writer-1000000) add_test(ft/ftloader-test-writer-1-x ftloader-test-writer -r 1 -s -x 42 dir.check_ftloader-test-writer-1-x) add_test(ft/ftloader-test-writer-1000-x ftloader-test-writer -r 1000 -s -x 42 dir.check_ftloader-test-writer-1000-x) add_test(ft/ftloader-test-writer-100000-x ftloader-test-writer -r 100000 -s -x 42 dir.check_ftloader-test-writer-100000-x) add_test(ft/ftloader-test-writer-1000000-x ftloader-test-writer -r 1000000 -s -x 42 dir.check_ftloader-test-writer-1000000-x) declare_custom_tests(ftloader-test-writer-errors.c) add_test(ft/ftloader-test-writer-errors-1 ftloader-test-writer-errors -w -m -u -r 100000 dir.check_ftloader-test-writer-errors-1) add_test(ft/ftloader-test-writer-errors-2 ftloader-test-writer-errors -s -w -m -u -r 10000 dir.check_ftloader-test-writer-errors-2) add_test(ft/ftloader-test-writer-errors-3 ftloader-test-writer-errors -s -r 20000 --malloc_limit 0 --realloc_errors dir.check_ftloader-test-writer-errors-3) add_test(ft/ftloader-test-writer-errors-4 ftloader-test-writer-errors -s -m --malloc_limit 0 -r 10000 dir.check_ftloader-test-writer-errors-4) declare_custom_tests(ft-serialize-benchmark.c) add_test(ft/ft-serialize-benchmark ft-serialize-benchmark 92 200000) declare_custom_tests(bnc-insert-benchmark.c) add_test(ft/bnc-insert-benchmark bnc-insert-benchmark 100 4096000 1000) foreach(src ${srcs}) if(NOT "${src}" MATCHES "dir[.].*[.]c") ## add a default test rule that runs with no options get_filename_component(base ${src} NAME_WE) add_test(ft/${base} ${base}) endif() endforeach(src) ## give some tests, that time out normally, 1 hour to complete set(long_tests ft/log-test7 ft/subblock-test-compression ft/recovery-bad-last-entry ft/ftloader-test-extractor-3a ft/upgrade_test_simple ) set_tests_properties(${long_tests} PROPERTIES TIMEOUT 3600) ## some take even longer, with valgrind set(extra_long_tests ft/is_empty ft/subblock-test-checksum ) set_tests_properties(${extra_long_tests} PROPERTIES TIMEOUT 7200) ## these take a really long time with valgrind set(phenomenally_long_tests ft/benchmark-test ft/benchmark-test_256 ) set_tests_properties(${phenomenally_long_tests} PROPERTIES TIMEOUT 14400) endif(BUILD_TESTING)