From e5b99917036fc0420672abc26a28586e6157e101 Mon Sep 17 00:00:00 2001 From: grev Date: Wed, 25 Feb 2009 16:52:48 +0000 Subject: [PATCH] b=18468 o=Adilger i=Oleg.Drokin i=grev make racer harder --- lustre/tests/racer/dir_create.sh | 2 +- lustre/tests/racer/file_concat.sh | 4 ++-- lustre/tests/racer/file_create.sh | 4 ++-- lustre/tests/racer/file_link.sh | 4 ++-- lustre/tests/racer/file_rename.sh | 4 ++-- lustre/tests/racer/file_rm.sh | 2 +- lustre/tests/racer/file_symlink.sh | 4 ++-- lustre/tests/racer/racer.sh | 36 +++++++++++++++--------------------- 8 files changed, 27 insertions(+), 33 deletions(-) diff --git a/lustre/tests/racer/dir_create.sh b/lustre/tests/racer/dir_create.sh index 80fbbe1..a280e0a 100755 --- a/lustre/tests/racer/dir_create.sh +++ b/lustre/tests/racer/dir_create.sh @@ -8,7 +8,7 @@ create(){ } while /bin/true ; do - file=$(($RANDOM%$MAX)) + 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 index 38181ad..8dde304 100755 --- a/lustre/tests/racer/file_concat.sh +++ b/lustre/tests/racer/file_concat.sh @@ -10,7 +10,7 @@ concat(){ } while /bin/true ; do - file=$(($RANDOM%$MAX)) - new_file=$(($RANDOM%$MAX)) + 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 index d94502c..70ba0fd 100755 --- a/lustre/tests/racer/file_create.sh +++ b/lustre/tests/racer/file_create.sh @@ -5,13 +5,13 @@ MAX=$2 MAX_MB=256 create() { - SIZE=$(($RANDOM*MAX_MB/32)) + 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)) + file=$((RANDOM % MAX)) create 2> /dev/null done diff --git a/lustre/tests/racer/file_link.sh b/lustre/tests/racer/file_link.sh index 5c1cac7..aaf498d 100755 --- a/lustre/tests/racer/file_link.sh +++ b/lustre/tests/racer/file_link.sh @@ -4,7 +4,7 @@ DIR=$1 MAX=$2 while /bin/true ; do - file=$(($RANDOM%$MAX)) - new_file=$((($file + 1)%$MAX)) + file=$((RANDOM % $MAX)) + new_file=$((RANDOM % MAX)) ln $file $DIR/$new_file 2> /dev/null done diff --git a/lustre/tests/racer/file_rename.sh b/lustre/tests/racer/file_rename.sh index 9552102..a4ef5b8 100755 --- a/lustre/tests/racer/file_rename.sh +++ b/lustre/tests/racer/file_rename.sh @@ -4,7 +4,7 @@ DIR=$1 MAX=$2 while /bin/true ; do - file=$(($RANDOM%$MAX)) - new_file=$((($file + 1)%$MAX)) + file=$((RANDOM % MAX)) + new_file=$((RANDOM % 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 index 41d3d62..20d5226 100755 --- a/lustre/tests/racer/file_rm.sh +++ b/lustre/tests/racer/file_rm.sh @@ -4,7 +4,7 @@ DIR=$1 MAX=$2 while /bin/true ; do - file=$(($RANDOM%$MAX)) + 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 index 44771a5..187b026 100755 --- a/lustre/tests/racer/file_symlink.sh +++ b/lustre/tests/racer/file_symlink.sh @@ -4,8 +4,8 @@ DIR=$1 MAX=$2 while /bin/true ; do - file=$(($RANDOM%$MAX)) - new_file=$((($file + 1)%$MAX)) + file=$((RANDOM % MAX)) + new_file=$((RANDOM % 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 index 645e349..1274d02 100755 --- a/lustre/tests/racer/racer.sh +++ b/lustre/tests/racer/racer.sh @@ -10,40 +10,34 @@ NUM_THREADS=${NUM_THREADS:-3} mkdir -p $DIR +RACER_PROGS="file_create dir_create file_rm file_rename file_link file_symlink +file_list file_concat" + 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 + for P in $RACER_PROGS; do + killall $P.sh + done + trap 0 } echo "Running $0 for $DURATION seconds. CTRL-C to exit" trap " - echo \"Cleaning up\" - racer_cleanup - exit 0 + echo \"Cleaning up\" + racer_cleanup + exit 0 " 2 15 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 & + for P in $RACER_PROGS; do + ./$P.sh $DIR $MAX_FILES & + done done -sleep $DURATION; +sleep $DURATION racer_cleanup + # Check our to see whether our test DIR is still available. df $DIR RC=$? -- 1.8.3.1