[Ocfs2-test-devel] [PATCH] dirop_file_racer: Add a prefix to the file names created.

tristan.ye tristan.ye at oracle.com
Wed Apr 29 20:19:18 PDT 2009


Why don't we add a variable in config.sh(config_shell.skel) then export
it instead of adding an isolated environment var somewhere, other than
this, all looks good to me:-)

One more thing i think we can use DIR_FILE_PREFIX instead of PREFIX to
make it more explicit to let others know it is going to be used just for
dirop_file_racer testcase.


Tristan.


On Wed, 2009-04-29 at 13:53 -0700, Joel Becker wrote:
> The symlink racer couldn't create syminks larger than an inode.  Let's
> add a PREFIX environment variable.  When set, all files created by all
> the tests in dirop_file_racer will start with the PREFIX.  So you can
> set a 250 character PREFIX and file_symlink.sh will create symlinks that
> get to 750 characters or more.  It also helps stress inline directories,
> etc.
> 
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
> ---
>  programs/dirop_fileop_racer/dir_create.sh   |    2 +-
>  programs/dirop_fileop_racer/file_concat.sh  |    4 ++--
>  programs/dirop_fileop_racer/file_create.sh  |    2 +-
>  programs/dirop_fileop_racer/file_link.sh    |    5 +++--
>  programs/dirop_fileop_racer/file_rename.sh  |    5 +++--
>  programs/dirop_fileop_racer/file_rm.sh      |    2 +-
>  programs/dirop_fileop_racer/file_symlink.sh |    5 +++--
>  7 files changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/programs/dirop_fileop_racer/dir_create.sh b/programs/dirop_fileop_racer/dir_create.sh
> index 3595bd2..c3bb319 100755
> --- a/programs/dirop_fileop_racer/dir_create.sh
> +++ b/programs/dirop_fileop_racer/dir_create.sh
> @@ -27,7 +27,7 @@ create(){
>  }
>  
>  while /bin/true ; do 
> -    file=$(($RANDOM%$MAX))
> +    file="${PREFIX}"$(($RANDOM%$MAX))
>      mkdir -p $DIR/$file/$file/ 2> /dev/null
>      create 2> /dev/null
>  done
> diff --git a/programs/dirop_fileop_racer/file_concat.sh b/programs/dirop_fileop_racer/file_concat.sh
> index 7d57416..e3f1b91 100755
> --- a/programs/dirop_fileop_racer/file_concat.sh
> +++ b/programs/dirop_fileop_racer/file_concat.sh
> @@ -29,7 +29,7 @@ concat(){
>  }
>  
>  while /bin/true ; do 
> -    file=$(($RANDOM%$MAX))
> -    new_file=$(($RANDOM%$MAX))
> +    file="${PREFIX}"$(($RANDOM%$MAX))
> +    new_file="${PREFIX}"$(($RANDOM%$MAX))
>      concat 2> /dev/null
>  done
> diff --git a/programs/dirop_fileop_racer/file_create.sh b/programs/dirop_fileop_racer/file_create.sh
> index fa15ea0..2e40a60 100755
> --- a/programs/dirop_fileop_racer/file_create.sh
> +++ b/programs/dirop_fileop_racer/file_create.sh
> @@ -30,7 +30,7 @@ create() {
>  }
>  
>  while /bin/true ; do 
> -    file=$(($RANDOM%$MAX))
> +    file="${PREFIX}"$(($RANDOM%$MAX))
>      create 2> /dev/null
>  done
>  
> diff --git a/programs/dirop_fileop_racer/file_link.sh b/programs/dirop_fileop_racer/file_link.sh
> index ab5b2b4..3dfb8ba 100755
> --- a/programs/dirop_fileop_racer/file_link.sh
> +++ b/programs/dirop_fileop_racer/file_link.sh
> @@ -23,8 +23,9 @@ DIR=$1
>  MAX=$2
>  
>  while /bin/true ; do 
> -    file=$(($RANDOM%$MAX))
> -    new_file=$((($file + 1)%$MAX))
> +    N=$(($RANDOM%$MAX))
> +    file="${PREFIX}"$N
> +    new_file="${PREFIX}"$((($N + 1)%$MAX))
>      ln -s $file $DIR/$new_file 2> /dev/null
>      ln $file $DIR/$new_file 2> /dev/null
>  done
> diff --git a/programs/dirop_fileop_racer/file_rename.sh b/programs/dirop_fileop_racer/file_rename.sh
> index b34f3ff..0122168 100755
> --- a/programs/dirop_fileop_racer/file_rename.sh
> +++ b/programs/dirop_fileop_racer/file_rename.sh
> @@ -23,7 +23,8 @@ DIR=$1
>  MAX=$2
>  
>  while /bin/true ; do 
> -    file=$(($RANDOM%$MAX))
> -    new_file=$((($file + 1)%$MAX))
> +    N=$(($RANDOM%$MAX))
> +    file="${PREFIX}"$N
> +    new_file="${PREFIX}"$((($N + 1)%$MAX))
>      mv $DIR/$file $DIR/$new_file 2> /dev/null
>  done
> diff --git a/programs/dirop_fileop_racer/file_rm.sh b/programs/dirop_fileop_racer/file_rm.sh
> index cd0d707..b2d8932 100755
> --- a/programs/dirop_fileop_racer/file_rm.sh
> +++ b/programs/dirop_fileop_racer/file_rm.sh
> @@ -23,7 +23,7 @@ DIR=$1
>  MAX=$2
>  
>  while /bin/true ; do 
> -    file=$(($RANDOM%$MAX))
> +    file="${PREFIX}"$(($RANDOM%$MAX))
>      rm -rf $DIR/$file 2> /dev/null
>      sleep 1
>  done
> diff --git a/programs/dirop_fileop_racer/file_symlink.sh b/programs/dirop_fileop_racer/file_symlink.sh
> index 74276c1..5a28bbd 100755
> --- a/programs/dirop_fileop_racer/file_symlink.sh
> +++ b/programs/dirop_fileop_racer/file_symlink.sh
> @@ -23,8 +23,9 @@ DIR=$1
>  MAX=$2
>  
>  while /bin/true ; do 
> -    file=$(($RANDOM%$MAX))
> -    new_file=$((($file + 1)%$MAX))
> +    N=$(($RANDOM%$MAX))
> +    file="${PREFIX}"$N
> +    new_file="${PREFIX}"$((($N + 1)%$MAX))
>      ln -s $file $DIR/$new_file 2> /dev/null
>      ln -s $file/$file/$file $DIR/$new_file 2> /dev/null
>  done
> -- 
> 1.6.1.3
> 
> 




More information about the Ocfs2-test-devel mailing list