diff --git a/lustre/tests/racer/dir_create.sh b/lustre/tests/racer/dir_create.sh new file mode 100755 index 0000000000000000000000000000000000000000..80fbbe128574f25890c271f27a83d30ca95ddb4b --- /dev/null +++ b/lustre/tests/racer/dir_create.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 + +create(){ + echo "asdf" > $DIR/$file/$file/$file +} + +while /bin/true ; do + file=$(($RANDOM%$MAX)) + mkdir -p $DIR/$file/$file/ 2> /dev/null + create 2> /dev/null +done diff --git a/lustre/tests/racer/file_concat.sh b/lustre/tests/racer/file_concat.sh new file mode 100755 index 0000000000000000000000000000000000000000..38181ad271208216491aab395e102eae96815849 --- /dev/null +++ b/lustre/tests/racer/file_concat.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 + +concat(){ + cat $DIR/$file >> $DIR/$new_file + cat $DIR/$file/$file/$file >> $DIR/$new_file + +} + +while /bin/true ; do + file=$(($RANDOM%$MAX)) + new_file=$(($RANDOM%$MAX)) + concat 2> /dev/null +done diff --git a/lustre/tests/racer/file_create.sh b/lustre/tests/racer/file_create.sh new file mode 100755 index 0000000000000000000000000000000000000000..d94502c117b6d02b38fdbdf877f54b61c5641e4a --- /dev/null +++ b/lustre/tests/racer/file_create.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 +MAX_MB=256 + +create() { + SIZE=$(($RANDOM*MAX_MB/32)) + echo "file_create: SIZE=$SIZE" + dd if=/dev/zero of=$DIR/$file bs=1k count=$SIZE +} + +while /bin/true ; do + file=$(($RANDOM%$MAX)) + create 2> /dev/null +done + diff --git a/lustre/tests/racer/file_link.sh b/lustre/tests/racer/file_link.sh new file mode 100755 index 0000000000000000000000000000000000000000..5c1cac726fabacc44eba1a5db733c56cc68c7444 --- /dev/null +++ b/lustre/tests/racer/file_link.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 + +while /bin/true ; do + file=$(($RANDOM%$MAX)) + new_file=$((($file + 1)%$MAX)) + ln $file $DIR/$new_file 2> /dev/null +done diff --git a/lustre/tests/racer/file_list.sh b/lustre/tests/racer/file_list.sh new file mode 100755 index 0000000000000000000000000000000000000000..44a3e5fc0d0e47b4ece55479b5aaf846f58f64a6 --- /dev/null +++ b/lustre/tests/racer/file_list.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 + +while /bin/true ; do + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + ls -R $DIR/ > /dev/null 2> /dev/null & + + wait + sleep 1 +done diff --git a/lustre/tests/racer/file_rename.sh b/lustre/tests/racer/file_rename.sh new file mode 100755 index 0000000000000000000000000000000000000000..955210293e6d143079397a98337efad7dde7910c --- /dev/null +++ b/lustre/tests/racer/file_rename.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 + +while /bin/true ; do + file=$(($RANDOM%$MAX)) + new_file=$((($file + 1)%$MAX)) + mv $DIR/$file $DIR/$new_file 2> /dev/null +done diff --git a/lustre/tests/racer/file_rm.sh b/lustre/tests/racer/file_rm.sh new file mode 100755 index 0000000000000000000000000000000000000000..41d3d62db4aa87bf7821d7fc607406554d9cff42 --- /dev/null +++ b/lustre/tests/racer/file_rm.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 + +while /bin/true ; do + file=$(($RANDOM%$MAX)) + rm -rf $DIR/$file 2> /dev/null + sleep 1 +done + + diff --git a/lustre/tests/racer/file_symlink.sh b/lustre/tests/racer/file_symlink.sh new file mode 100755 index 0000000000000000000000000000000000000000..44771a52d02cb515822b882ab333521eef3c32d2 --- /dev/null +++ b/lustre/tests/racer/file_symlink.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +DIR=$1 +MAX=$2 + +while /bin/true ; do + file=$(($RANDOM%$MAX)) + new_file=$((($file + 1)%$MAX)) + ln -s $file $DIR/$new_file 2> /dev/null + ln -s $file/$file/$file $DIR/$new_file 2> /dev/null +done diff --git a/lustre/tests/racer/racer.sh b/lustre/tests/racer/racer.sh new file mode 100755 index 0000000000000000000000000000000000000000..c1f8b9970fc683964adc1be2547d446bb0c3f205 --- /dev/null +++ b/lustre/tests/racer/racer.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +MAX_FILES=${MAX_FILES:-20} +DIR=${DIR:-$1} +DIR=${DIR:-"/mnt/lustre/racer"} +if ! [ -d "$DIR" -o -d "`basename $DIR`" ]; then + echo "$0: '$DIR' and '`basename $DIR`' are not directories" + exit 1 +fi +DURATION=${DURATION:-$((60*5))} + +NUM_THREADS=${NUM_THREADS:-$2} +NUM_THREADS=${NUM_THREADS:-3} + +[ -e $DIR ] || mkdir $DIR + +racer_cleanup() +{ + killall file_create.sh + killall dir_create.sh + killall file_rm.sh + killall file_rename.sh + killall file_link.sh + killall file_symlink.sh + killall file_list.sh + killall file_concat.sh + trap 0 +} + +echo "Running $0 for $DURATION seconds. CTRL-C to exit" +trap " + echo \"Cleaning up\" + racer_cleanup + exit 0 +" 2 + +cd `dirname $0` +for N in `seq 1 $NUM_THREADS`; do + ./file_create.sh $DIR $MAX_FILES & + ./dir_create.sh $DIR $MAX_FILES & + ./file_rename.sh $DIR $MAX_FILES & + ./file_link.sh $DIR $MAX_FILES & + ./file_symlink.sh $DIR $MAX_FILES & + ./file_concat.sh $DIR $MAX_FILES & + ./file_list.sh $DIR & + ./file_rm.sh $DIR $MAX_FILES & +done + +sleep $DURATION; +racer_cleanup +# Check our to see whether our test DIR is still available. +df $DIR +RC=$? +if [ $RC -eq 0 ]; then + echo "We survived $0 for $DURATION seconds." +fi +exit $RC