From: Ali Maredia Date: Tue, 12 Jan 2016 22:00:16 +0000 (-0500) Subject: cmake: moved tests into test/osd dir X-Git-Tag: v10.2.0~27^2~55 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3186c00814ce47af13af88c8025221670f5b15f2;p=ceph.git cmake: moved tests into test/osd dir Replaced relative paths in shell scripts in test/osd directory with CEPH_VAR environment variables set in cmake, added a CMakeLists.txt in test/osd. Signed-off-by: Ali Maredia --- diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 851d9ce779b..f72a7c8d8e2 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -58,21 +58,6 @@ add_executable(ceph_bench_log ) target_link_libraries(ceph_bench_log global pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS}) -# ceph_test_rados -add_executable(ceph_test_rados - osd/TestRados.cc - osd/TestOpStat.cc - osd/Object.cc osd/RadosModel.cc - ) -target_link_libraries(ceph_test_rados - librados - global - ${BLKID_LIBRARIES} - ${CMAKE_DL_LIBS} - ${EXTRALIBS} - ${CMAKE_DL_LIBS} - ) - # ceph_test_mutate add_executable(ceph_test_mutate test_mutate.cc @@ -1491,64 +1476,7 @@ add_executable(unittest_lfnindex EXCLUDE_FROM_ALL add_ceph_unittest(unittest_lfnindex ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_lfnindex) target_link_libraries(unittest_lfnindex os global) -#osd directory -add_ceph_test(osd-bench.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-bench.sh) -add_ceph_test(osd-config.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-config.sh) -add_ceph_test(osd-copy-from.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-copy-from.sh) -add_ceph_test(osd-mark-down.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-mark-down.sh) -add_ceph_test(osd-reactivate.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-reactivate.sh) -add_ceph_test(osd-reuse-id.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-reuse-id.sh) -add_ceph_test(osd-scrub-repair.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-scrub-repair.sh) -add_ceph_test(osd-scrub-snaps.sh ${CMAKE_SOURCE_DIR}/src/test/osd/osd-scrub-snaps.sh) - -# unittest_osdmap -add_executable(unittest_osdmap EXCLUDE_FROM_ALL - osd/TestOSDMap.cc - ) -add_ceph_unittest(unittest_osdmap ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osdmap) -target_link_libraries(unittest_osdmap global ${BLKID_LIBRARIES}) - -# unittest_osd_types -add_executable(unittest_osd_types EXCLUDE_FROM_ALL - osd/types.cc - ) -add_ceph_unittest(unittest_osd_types ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osd_types) -target_link_libraries(unittest_osd_types global) - -# unittest_ecbackend -add_executable(unittest_ecbackend EXCLUDE_FROM_ALL - osd/TestECBackend.cc - ) -add_ceph_unittest(unittest_ecbackend ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_ecbackend) -target_link_libraries(unittest_ecbackend osd global) - -# unittest_osdscrub -add_executable(unittest_osdscrub EXCLUDE_FROM_ALL - osd/TestOSDScrub.cc - ) -add_ceph_unittest(unittest_osdscrub ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osdscrub) -target_link_libraries(unittest_osdscrub osd global dl os mon ${BLKID_LIBRARIES}) - -# unittest_pglog -add_executable(unittest_pglog EXCLUDE_FROM_ALL - osd/TestPGLog.cc - ) -add_ceph_unittest(unittest_pglog ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_pglog) -target_link_libraries(unittest_pglog osd global dl ${BLKID_LIBRARIES}) - -# unittest_hitset -add_executable(unittest_hitset EXCLUDE_FROM_ALL - osd/hitset.cc - ) -add_ceph_unittest(unittest_hitset ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_hitset) -target_link_libraries(unittest_hitset osd global ${BLKID_LIBRARIES}) - -# unittest_osd_osdcap -add_executable(unittest_osd_osdcap EXCLUDE_FROM_ALL - osd/osdcap.cc -) -add_ceph_unittest(unittest_osd_osdcap ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osd_osdcap) -target_link_libraries(unittest_osd_osdcap osd global ${BLKID_LIBRARIES}) +add_subdirectory(osd) #pybind add_ceph_test(test_ceph_daemon.py ${CMAKE_SOURCE_DIR}/src/test/pybind/test_ceph_daemon.py) diff --git a/src/test/osd/CMakeLists.txt b/src/test/osd/CMakeLists.txt new file mode 100644 index 00000000000..841bab166a0 --- /dev/null +++ b/src/test/osd/CMakeLists.txt @@ -0,0 +1,90 @@ +# test_rados +add_executable(ceph_test_rados + TestRados.cc + TestOpStat.cc + Object.cc + RadosModel.cc + ) +target_link_libraries(ceph_test_rados + librados + global + ${BLKID_LIBRARIES} + ${CMAKE_DL_LIBS} + ${EXTRALIBS} + ${CMAKE_DL_LIBS} + ) + +# scripts +add_ceph_test(osd-bench.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-bench.sh) +add_ceph_test(osd-config.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-config.sh) +add_ceph_test(osd-markdown.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-markdown.sh) +add_ceph_test(osd-reactivate.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-reactivate.sh) +add_ceph_test(osd-reuse-id.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-reuse-id.sh) +add_ceph_test(osd-scrub-repair.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-scrub-repair.sh) +add_ceph_test(osd-scrub-snaps.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-scrub-snaps.sh) + +#osd-copy-from.sh needs to be run out of ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} +add_test(NAME osd-copy-from.sh COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/osd-copy-from.sh WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +add_dependencies(check osd-copy-from.sh) + +set_property(TEST + osd-copy-from.sh + PROPERTY ENVIRONMENT + CEPH_ROOT=${CMAKE_SOURCE_DIR} + CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib + PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src + PYTHONPATH=${CMAKE_SOURCE_DIR}/src/pybind + ) + + +# unittest_osdmap +add_executable(unittest_osdmap EXCLUDE_FROM_ALL + TestOSDMap.cc + ) +add_ceph_unittest(unittest_osdmap ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osdmap) +target_link_libraries(unittest_osdmap global ${BLKID_LIBRARIES}) + +# unittest_osd_types +add_executable(unittest_osd_types EXCLUDE_FROM_ALL + types.cc + ) +add_ceph_unittest(unittest_osd_types ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osd_types) +target_link_libraries(unittest_osd_types global) + +# unittest_ecbackend +add_executable(unittest_ecbackend EXCLUDE_FROM_ALL + TestECBackend.cc + ) +add_ceph_unittest(unittest_ecbackend ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_ecbackend) +target_link_libraries(unittest_ecbackend osd global) + +# unittest_osdscrub +add_executable(unittest_osdscrub EXCLUDE_FROM_ALL + TestOSDScrub.cc + ) +add_ceph_unittest(unittest_osdscrub ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osdscrub) +target_link_libraries(unittest_osdscrub osd global dl os mon ${BLKID_LIBRARIES}) + +# unittest_pglog +add_executable(unittest_pglog EXCLUDE_FROM_ALL + TestPGLog.cc + ) +add_ceph_unittest(unittest_pglog ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_pglog) +target_link_libraries(unittest_pglog osd global dl ${BLKID_LIBRARIES}) + +# unittest_hitset +add_executable(unittest_hitset EXCLUDE_FROM_ALL + hitset.cc + ) +add_ceph_unittest(unittest_hitset ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_hitset) +target_link_libraries(unittest_hitset osd global ${BLKID_LIBRARIES}) + +# unittest_osd_osdcap +add_executable(unittest_osd_osdcap EXCLUDE_FROM_ALL + osdcap.cc +) +add_ceph_unittest(unittest_osd_osdcap ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_osd_osdcap) +target_link_libraries(unittest_osd_osdcap osd global ${BLKID_LIBRARIES}) + diff --git a/src/test/osd/osd-bench.sh b/src/test/osd/osd-bench.sh index 0fb5ab8599c..fd1f4a624c5 100755 --- a/src/test/osd/osd-bench.sh +++ b/src/test/osd/osd-bench.sh @@ -16,7 +16,7 @@ # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1 @@ -41,20 +41,20 @@ function TEST_bench() { run_mon $dir a || return 1 run_osd $dir 0 || return 1 - local osd_bench_small_size_max_iops=$(CEPH_ARGS='' ./ceph-conf \ + local osd_bench_small_size_max_iops=$(CEPH_ARGS='' ceph-conf \ --show-config-value osd_bench_small_size_max_iops) - local osd_bench_large_size_max_throughput=$(CEPH_ARGS='' ./ceph-conf \ + local osd_bench_large_size_max_throughput=$(CEPH_ARGS='' ceph-conf \ --show-config-value osd_bench_large_size_max_throughput) - local osd_bench_max_block_size=$(CEPH_ARGS='' ./ceph-conf \ + local osd_bench_max_block_size=$(CEPH_ARGS='' ceph-conf \ --show-config-value osd_bench_max_block_size) - local osd_bench_duration=$(CEPH_ARGS='' ./ceph-conf \ + local osd_bench_duration=$(CEPH_ARGS='' ceph-conf \ --show-config-value osd_bench_duration) # # block size too high # expect_failure $dir osd_bench_max_block_size \ - ./ceph tell osd.0 bench 1024 $((osd_bench_max_block_size + 1)) || return 1 + ceph tell osd.0 bench 1024 $((osd_bench_max_block_size + 1)) || return 1 # # count too high for small (< 1MB) block sizes @@ -62,7 +62,7 @@ function TEST_bench() { local bsize=1024 local max_count=$(($bsize * $osd_bench_duration * $osd_bench_small_size_max_iops)) expect_failure $dir bench_small_size_max_iops \ - ./ceph tell osd.0 bench $(($max_count + 1)) $bsize || return 1 + ceph tell osd.0 bench $(($max_count + 1)) $bsize || return 1 # # count too high for large (>= 1MB) block sizes @@ -70,12 +70,12 @@ function TEST_bench() { local bsize=$((1024 * 1024 + 1)) local max_count=$(($osd_bench_large_size_max_throughput * $osd_bench_duration)) expect_failure $dir osd_bench_large_size_max_throughput \ - ./ceph tell osd.0 bench $(($max_count + 1)) $bsize || return 1 + ceph tell osd.0 bench $(($max_count + 1)) $bsize || return 1 # # default values should work # - ./ceph tell osd.0 bench || return 1 + ceph tell osd.0 bench || return 1 } main osd-bench "$@" diff --git a/src/test/osd/osd-config.sh b/src/test/osd/osd-config.sh index 3cb7fa6c238..8f2f0db9c5d 100755 --- a/src/test/osd/osd-config.sh +++ b/src/test/osd/osd-config.sh @@ -16,7 +16,7 @@ # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1 @@ -47,7 +47,7 @@ function TEST_config_init() { --osd-map-cache-size $cache \ --osd-pg-epoch-persisted-max-stale $stale \ || return 1 - CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 + CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1 grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd.0.log || return 1 } @@ -58,30 +58,30 @@ function TEST_config_track() { run_mon $dir a || return 1 run_osd $dir 0 || return 1 - local osd_map_cache_size=$(CEPH_ARGS='' ./ceph-conf \ + local osd_map_cache_size=$(CEPH_ARGS='' ceph-conf \ --show-config-value osd_map_cache_size) - local osd_map_max_advance=$(CEPH_ARGS='' ./ceph-conf \ + local osd_map_max_advance=$(CEPH_ARGS='' ceph-conf \ --show-config-value osd_map_max_advance) - local osd_pg_epoch_persisted_max_stale=$(CEPH_ARGS='' ./ceph-conf \ + local osd_pg_epoch_persisted_max_stale=$(CEPH_ARGS='' ceph-conf \ --show-config-value osd_pg_epoch_persisted_max_stale) # # lower cache_size under max_advance to trigger the warning # ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1 local cache=$(($osd_map_max_advance / 2)) - ./ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1 - CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 + ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1 + CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1 rm $dir/osd.0.log - CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log reopen || return 1 + CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log reopen || return 1 # # reset cache_size to the default and assert that it does not trigger the warning # ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1 local cache=$osd_map_cache_size - ./ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1 - CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 + ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1 + CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1 # @@ -89,8 +89,8 @@ function TEST_config_track() { # ! grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1 local advance=$(($osd_map_cache_size * 2)) - ./ceph tell osd.0 injectargs "--osd-map-max-advance $advance" || return 1 - CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 + ceph tell osd.0 injectargs "--osd-map-max-advance $advance" || return 1 + CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 grep 'is not > osd_map_max_advance' $dir/osd.0.log || return 1 # @@ -99,7 +99,7 @@ function TEST_config_track() { ! grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd.0.log || return 1 local stale=$(($osd_map_cache_size * 2)) ceph tell osd.0 injectargs "--osd-pg-epoch-persisted-max-stale $stale" || return 1 - CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 + CEPH_ARGS='' ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1 grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd.0.log || return 1 } diff --git a/src/test/osd/osd-copy-from.sh b/src/test/osd/osd-copy-from.sh index 375ad44e35c..2fcf2a8fb9e 100755 --- a/src/test/osd/osd-copy-from.sh +++ b/src/test/osd/osd-copy-from.sh @@ -17,7 +17,7 @@ # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1 @@ -44,19 +44,19 @@ function TEST_copy_from() { run_osd $dir 1 || return 1 # success - ./rados -p rbd put foo rados - ./rados -p rbd cp foo foo2 - ./rados -p rbd stat foo2 + rados -p rbd put foo rados + rados -p rbd cp foo foo2 + rados -p rbd stat foo2 # failure - ./ceph tell osd.\* injectargs -- --osd-debug-inject-copyfrom-error - ! ./rados -p rbd cp foo foo3 - ! ./rados -p rbd stat foo3 + ceph tell osd.\* injectargs -- --osd-debug-inject-copyfrom-error + ! rados -p rbd cp foo foo3 + ! rados -p rbd stat foo3 # success again - ./ceph tell osd.\* injectargs -- --no-osd-debug-inject-copyfrom-error - ! ./rados -p rbd cp foo foo3 - ./rados -p rbd stat foo3 + ceph tell osd.\* injectargs -- --no-osd-debug-inject-copyfrom-error + ! rados -p rbd cp foo foo3 + rados -p rbd stat foo3 } main osd-copy-from "$@" diff --git a/src/test/osd/osd-markdown.sh b/src/test/osd/osd-markdown.sh index 7db2cb07e24..5cd5c6b0d31 100755 --- a/src/test/osd/osd-markdown.sh +++ b/src/test/osd/osd-markdown.sh @@ -16,7 +16,7 @@ # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1 @@ -42,10 +42,10 @@ function markdown_N_impl() { for i in `seq 1 $markdown_times` do # check the OSD is UP - ./ceph osd tree - ./ceph osd tree | grep osd.0 |grep up || return 1 + ceph osd tree + ceph osd tree | grep osd.0 |grep up || return 1 # mark the OSD down. - ./ceph osd down 0 + ceph osd down 0 sleep $sleeptime done } @@ -66,7 +66,8 @@ function TEST_markdown_exceed_maxdown_count() { ceph tell osd.0 injectargs '--osd_max_markdown_period '$period'' || return 1 markdown_N_impl $(($count+1)) $period $sleeptime - ./ceph osd tree | grep down | grep osd.0 || return 1 + # down N+1 times ,the osd.0 shoud die + ceph osd tree | grep down | grep osd.0 || return 1 } function TEST_markdown_boot() { @@ -86,7 +87,7 @@ function TEST_markdown_boot() { markdown_N_impl $count $period $sleeptime #down N times, osd.0 should be up - ./ceph osd tree | grep up | grep osd.0 || return 1 + ceph osd tree | grep up | grep osd.0 || return 1 } function TEST_markdown_boot_exceed_time() { @@ -106,7 +107,7 @@ function TEST_markdown_boot_exceed_time() { ceph tell osd.0 injectargs '--osd_max_markdown_period '$period'' || return 1 markdown_N_impl $(($count+1)) $period $sleeptime - ./ceph osd tree | grep up | grep osd.0 || return 1 + ceph osd tree | grep up | grep osd.0 || return 1 } main osd-markdown "$@" diff --git a/src/test/osd/osd-reactivate.sh b/src/test/osd/osd-reactivate.sh index 9bc29334c6e..e0aff3f48ef 100755 --- a/src/test/osd/osd-reactivate.sh +++ b/src/test/osd/osd-reactivate.sh @@ -13,7 +13,7 @@ # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1 diff --git a/src/test/osd/osd-reuse-id.sh b/src/test/osd/osd-reuse-id.sh index 8efdf5c88bb..59145972a2a 100755 --- a/src/test/osd/osd-reuse-id.sh +++ b/src/test/osd/osd-reuse-id.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1 diff --git a/src/test/osd/osd-scrub-repair.sh b/src/test/osd/osd-scrub-repair.sh index 3b9b1d85673..03580c3f833 100755 --- a/src/test/osd/osd-scrub-repair.sh +++ b/src/test/osd/osd-scrub-repair.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1 diff --git a/src/test/osd/osd-scrub-snaps.sh b/src/test/osd/osd-scrub-snaps.sh index 71eeb19a4ae..d4224489fa4 100755 --- a/src/test/osd/osd-scrub-snaps.sh +++ b/src/test/osd/osd-scrub-snaps.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library Public License for more details. # -source ../qa/workunits/ceph-helpers.sh +source $CEPH_ROOT/qa/workunits/ceph-helpers.sh function run() { local dir=$1