diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-10-03 17:18:01 +0800 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2013-10-05 11:31:12 +0800 |
commit | e0be61e4ab5f68a6da87bc41ca1cc4276457ef20 (patch) | |
tree | 0b50e857a72be480900e6038ac29b7b9c2d2c3f2 | |
parent | f82aefafd4c9db3bd55730b1cdfcffd7fab78e3e (diff) | |
download | ceph-e0be61e4ab5f68a6da87bc41ca1cc4276457ef20.tar.gz |
qa/workunits: Add large number of files in a directory test script
Test the directory fragments feature
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
-rwxr-xr-x | qa/workunits/misc/dirfrag.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/qa/workunits/misc/dirfrag.sh b/qa/workunits/misc/dirfrag.sh new file mode 100755 index 00000000000..104b7bc02ae --- /dev/null +++ b/qa/workunits/misc/dirfrag.sh @@ -0,0 +1,46 @@ +#!/bin/sh -e + +DEPTH=5 +COUNT=10000 + +function kill_jobs { + jobs -p | xargs kill +} +trap kill_jobs SIGINT + +function create_files { + for i in `seq 1 $COUNT` + do + touch file$i + done +} + +function delete_files { + for i in `ls -f` + do + if [[ ${i}a = file*a ]] + then + rm -f $i + fi + done +} + +rm -rf testdir +mkdir testdir +cd testdir + +for i in `seq 1 $DEPTH`; do + mkdir dir$i + cd dir$i + create_files & +done +wait + +for i in `seq 1 $DEPTH`; do + delete_files & + cd .. +done +wait + +cd .. +rm -rf testdir |