mariadb/newbrt/tests/CMakeLists.txt
Leif Walsh 53f9054648 [t:4871] make newbrt tests use temp files in the build directory, not the source directory
git-svn-id: file:///svn/toku/tokudb@43513 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-17 00:00:30 -04:00

121 lines
6.6 KiB
CMake

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.brt foo2.brt foo3.brt foo4.brt
bar1.brt bar2.brt bar3.brt bar4.brt
test-dump-brt.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(logcursor-fw echo "logcursor-fw must be run manually (needs logs to iterate over).")
add_test(logcursor-bw echo "logcursor-bw must be run manually (needs logs to iterate over).")
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} newbrt ${LIBTOKUPORTABILITY})
set_property(TARGET ${base} APPEND PROPERTY
COMPILE_DEFINITIONS "__SRCFILE__=\"${src}\"")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${src}.brt")
endif()
endforeach(src)
## declare some tests that should be run with specific options
declare_custom_tests(test-assert.c)
add_test(test-assertA test-assert)
add_test(test-assertB test-assert notok)
set_tests_properties(test-assertA test-assertB PROPERTIES WILL_FAIL TRUE)
add_test(test-assertC test-assert ok)
declare_custom_tests(benchmark-test.c)
add_test(benchmark-test benchmark-test -q --fname dir.check_benchmark-test)
add_test(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(brtloader-test-merge-files-dbufio.c)
add_test(brtloader-test-merge-files-dbufio brtloader-test-merge-files-dbufio -r 8000 -s dir.check_brtloader-test-merge-files-dbufio)
declare_custom_tests(brtloader-test.c)
add_test(brtloader-test brtloader-test dir.check_brtloader-test)
declare_custom_tests(brtloader-test-bad-generate.c)
add_test(brtloader-test-bad-generate brtloader-test-bad-generate dir.check_brtloader-test-bad-generate)
declare_custom_tests(brtloader-test-extractor.c)
add_test(brtloader-test-extractor-1 brtloader-test-extractor -s -r 1000 --rowsets 1000 --asc dir.check_brtloader-test-extractor-1)
add_test(brtloader-test-extractor-2 brtloader-test-extractor -s -r 1000 --rowsets 1000 --dsc dir.check_brtloader-test-extractor-2)
add_test(brtloader-test-extractor-3 brtloader-test-extractor -s -r 1000 --rowsets 1000 --random dir.check_brtloader-test-extractor-3)
add_test(brtloader-test-extractor-1a brtloader-test-extractor -s -r 1000 --rowsets 1000 --asc dir.check_brtloader-test-extractor-1a)
add_test(brtloader-test-extractor-2a brtloader-test-extractor -s -r 1000 --rowsets 1000 --dsc dir.check_brtloader-test-extractor-2a)
add_test(brtloader-test-extractor-3a brtloader-test-extractor -s -r 1000 --rowsets 1000 --random dir.check_brtloader-test-extractor-3a)
add_test(brtloader-test-extractor-4a brtloader-test-extractor -s -r 1000 --rowsets 3 --asc dir.check_brtloader-test-extractor-4a)
add_test(brtloader-test-extractor-5a brtloader-test-extractor -s -r 1000 --rowsets 3 --asc --asc-poison dir.check_brtloader-test-extractor-5a)
declare_custom_tests(brtloader-test-extractor-errors.c)
add_test(brtloader-test-extractor-errors-1 brtloader-test-extractor-errors -w -m -u -r 1 dir.check_brtloader-test-extractor-errors-1)
add_test(brtloader-test-extractor-errors-2 brtloader-test-extractor-errors -m -r 10000 dir.check_brtloader-test-extractor-errors-2)
declare_custom_tests(brtloader-test-open.c)
add_test(brtloader-test-open brtloader-test-open dir.check_brtloader-test-open)
declare_custom_tests(brtloader-test-writer.c)
add_test(brtloader-test-writer-1 brtloader-test-writer -r 1 -s dir.check_brtloader-test-writer-1)
add_test(brtloader-test-writer-1000 brtloader-test-writer -r 1000 -s dir.check_brtloader-test-writer-1000)
add_test(brtloader-test-writer-100000 brtloader-test-writer -r 100000 -s dir.check_brtloader-test-writer-100000)
add_test(brtloader-test-writer-1000000 brtloader-test-writer -r 1000000 -s dir.check_brtloader-test-writer-1000000)
add_test(brtloader-test-writer-1-x brtloader-test-writer -r 1 -s -x 42 dir.check_brtloader-test-writer-1-x)
add_test(brtloader-test-writer-1000-x brtloader-test-writer -r 1000 -s -x 42 dir.check_brtloader-test-writer-1000-x)
add_test(brtloader-test-writer-100000-x brtloader-test-writer -r 100000 -s -x 42 dir.check_brtloader-test-writer-100000-x)
add_test(brtloader-test-writer-1000000-x brtloader-test-writer -r 1000000 -s -x 42 dir.check_brtloader-test-writer-1000000-x)
declare_custom_tests(brtloader-test-writer-errors.c)
add_test(brtloader-test-writer-errors-1 brtloader-test-writer-errors -w -m -u -r 100000 dir.check_brtloader-test-writer-errors-1)
add_test(brtloader-test-writer-errors-2 brtloader-test-writer-errors -s -w -m -u -r 10000 dir.check_brtloader-test-writer-errors-2)
add_test(brtloader-test-writer-errors-3 brtloader-test-writer-errors -s -r 20000 --malloc_limit 0 --realloc_errors dir.check_brtloader-test-writer-errors-3)
add_test(brtloader-test-writer-errors-4 brtloader-test-writer-errors -s -m --malloc_limit 0 -r 10000 dir.check_brtloader-test-writer-errors-4)
declare_custom_tests(brt-serialize-benchmark.c)
add_test(brt-serialize-benchmark brt-serialize-benchmark 92 200000)
declare_custom_tests(bnc-insert-benchmark.c)
add_test(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(${base} ${base})
endif()
endforeach(src)
## give some tests, that time out normally, 1 hour to complete
set(long_tests
log-test7
subblock-test-compression
is_empty
recovery-bad-last-entry
)
set_tests_properties(${long_tests} PROPERTIES TIMEOUT 3600)
## some take even longer, with valgrind
set(extra_long_tests
subblock-test-checksum
benchmark-test
benchmark-test_256
)
set_tests_properties(${extra_long_tests} PROPERTIES TIMEOUT 7200)
endif(BUILD_TESTING)