Whamcloud - gitweb
Branch HEAD
authoradilger <adilger>
Wed, 28 May 2008 23:39:49 +0000 (23:39 +0000)
committeradilger <adilger>
Wed, 28 May 2008 23:39:49 +0000 (23:39 +0000)
Add updated racer.sh script
i=oleg.drokin

lustre/tests/racer/dir_create.sh [new file with mode: 0755]
lustre/tests/racer/file_concat.sh [new file with mode: 0755]
lustre/tests/racer/file_create.sh [new file with mode: 0755]
lustre/tests/racer/file_link.sh [new file with mode: 0755]
lustre/tests/racer/file_list.sh [new file with mode: 0755]
lustre/tests/racer/file_rename.sh [new file with mode: 0755]
lustre/tests/racer/file_rm.sh [new file with mode: 0755]
lustre/tests/racer/file_symlink.sh [new file with mode: 0755]
lustre/tests/racer/racer.sh [new file with mode: 0755]

diff --git a/lustre/tests/racer/dir_create.sh b/lustre/tests/racer/dir_create.sh
new file mode 100755 (executable)
index 0000000..80fbbe1
--- /dev/null
@@ -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 (executable)
index 0000000..38181ad
--- /dev/null
@@ -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 (executable)
index 0000000..d94502c
--- /dev/null
@@ -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 (executable)
index 0000000..5c1cac7
--- /dev/null
@@ -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 (executable)
index 0000000..44a3e5f
--- /dev/null
@@ -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 (executable)
index 0000000..9552102
--- /dev/null
@@ -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 (executable)
index 0000000..41d3d62
--- /dev/null
@@ -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 (executable)
index 0000000..44771a5
--- /dev/null
@@ -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 (executable)
index 0000000..c1f8b99
--- /dev/null
@@ -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