mirror of
https://github.com/ceph/ceph
synced 2024-12-23 03:44:23 +00:00
3aae5ca6fd
/bin/bash is a Linuxism. Other operating systems install bash to different paths. Use /usr/bin/env in shebangs to find bash. Signed-off-by: Alan Somers <asomers@gmail.com>
53 lines
605 B
Bash
Executable File
53 lines
605 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
DEPTH=5
|
|
COUNT=10000
|
|
|
|
kill_jobs() {
|
|
jobs -p | xargs kill
|
|
}
|
|
trap kill_jobs INT
|
|
|
|
create_files() {
|
|
for i in `seq 1 $COUNT`
|
|
do
|
|
touch file$i
|
|
done
|
|
}
|
|
|
|
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
|
|
|
|
echo "creating folder hierarchy"
|
|
for i in `seq 1 $DEPTH`; do
|
|
mkdir dir$i
|
|
cd dir$i
|
|
create_files &
|
|
done
|
|
wait
|
|
|
|
echo "created hierarchy, now cleaning up"
|
|
|
|
for i in `seq 1 $DEPTH`; do
|
|
delete_files &
|
|
cd ..
|
|
done
|
|
wait
|
|
|
|
echo "cleaned up hierarchy"
|
|
cd ..
|
|
rm -rf testdir
|