You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com> on 2011/05/09 00:03:31 UTC
Re: svn commit: r1100723 - /subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
2011-05-08 13:53:14 danielsh@apache.org napisał(a):
> Author: danielsh
> Date: Sun May 8 11:53:14 2011
> New Revision: 1100723
>
> URL: http://svn.apache.org/viewvc?rev=1100723&view=rev
> Log:
> * tools/dev/benchmarks/large_dirs/create_bigdir.sh
> Remove bash-specific syntaxes and convert the script to #!/bin/sh.
> Uses of 'seq' remain and an 'xargs' has been added, these are for
> a subsequent commit.
>
> Modified:
> subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
>
> Modified: subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
> URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh?rev=1100723&r1=1100722&r2=1100723&view=diff
> ==============================================================================
> --- subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh (original)
> +++ subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh Sun May 8 11:53:14 2011
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>
> # Licensed to the Apache Software Foundation (ASF) under one
> # or more contributor license agreements. See the NOTICE file
> @@ -51,7 +51,7 @@ SERVEROPTS="-c 0 -M 400"
>
> # from here on, we should be good
>
> -TIMEFORMAT=$'%3R %3U %3S'
> +TIMEFORMAT='%3R %3U %3S'
> REPONAME=dirs
> PORT=54321
> if [ "${SVNSERVE}" != "" ] ; then
> @@ -65,7 +65,8 @@ fi
> rm -rf $WC $REPOROOT/$REPONAME
> mkdir $REPOROOT/$REPONAME
> ${SVNADMIN} create $REPOROOT/$REPONAME
> -echo -e "[general]\nanon-access = write\n" > $REPOROOT/$REPONAME/conf/svnserve.conf
> +echo "[general]
> +anon-access = write" > $REPOROOT/$REPONAME/conf/svnserve.conf
>
> # fire up svnserve
>
> @@ -89,7 +90,7 @@ fi
>
> # print header
>
> -echo -n "using "
> +printf "using "
> ${SVN} --version | grep " version"
> echo
>
> @@ -101,7 +102,7 @@ ${SVN} co $URL $WC > /dev/null
> # functions that execute an SVN command
>
> run_svn() {
> - if [ "${VALGRIND}" == "" ] ; then
> + if [ "${VALGRIND}" = "" ] ; then
> time ${SVN} $1 $WC/$2 $3 > /dev/null
> else
> ${VALGRIND} ${VG_OUTFILE}="${VG_TOOL}.out.$1.$2" ${SVN} $1 $WC/$2 $3 > /dev/null
> @@ -109,7 +110,7 @@ run_svn() {
> }
>
> run_svn_del() {
> - if [ "${VALGRIND}" == "" ] ; then
> + if [ "${VALGRIND}" = "" ] ; then
> time ${SVN} del $WC/${1}_c/$2 -q > /dev/null
> else
> ${VALGRIND} ${VG_OUTFILE}="${VG_TOOL}.out.del.$1" ${SVN} del $WC/${1}_c/$2 -q > /dev/null
> @@ -117,7 +118,7 @@ run_svn_del() {
> }
>
> run_svn_ci() {
> - if [ "${VALGRIND}" == "" ] ; then
> + if [ "${VALGRIND}" = "" ] ; then
> time ${SVN} ci $WC/$1 -m "" -q > /dev/null
> else
> ${VALGRIND} ${VG_OUTFILE}="${VG_TOOL}.out.ci_$2.$1" ${SVN} ci $WC/$1 -m "" -q > /dev/null
> @@ -125,7 +126,7 @@ run_svn_ci() {
> }
>
> run_svn_cp() {
> - if [ "${VALGRIND}" == "" ] ; then
> + if [ "${VALGRIND}" = "" ] ; then
> time ${SVN} cp $WC/$1 $WC/$2 > /dev/null
> else
> ${VALGRIND} ${VG_OUTFILE}="${VG_TOOL}.out.cp.$1" ${SVN} cp $WC/$1 $WC/$2 > /dev/null
> @@ -133,7 +134,7 @@ run_svn_cp() {
> }
>
> run_svn_get() {
> - if [ "${VALGRIND}" == "" ] ; then
> + if [ "${VALGRIND}" = "" ] ; then
> time ${SVN} $1 $URL $WC -q > /dev/null
> else
> ${VALGRIND} ${VG_OUTFILE}="${VG_TOOL}.out.$1.$2" ${SVN} $1 $URL $WC -q > /dev/null
> @@ -145,57 +146,57 @@ run_svn_get() {
> while [ $FILECOUNT -lt $MAXCOUNT ]; do
> echo "Processing $FILECOUNT files in the same folder"
>
> - echo -ne "\tCreating files ... \t real user sys\n"
> + printf "\tCreating files ... \t real user sys\n"
> mkdir $WC/$FILECOUNT
> for i in `seq 1 ${FILECOUNT}`; do
> echo "File number $i" > $WC/$FILECOUNT/$i
> done
>
> - echo -ne "\tAdding files ... \t"
> + printf "\tAdding files ... \t"
> run_svn add $FILECOUNT -q
>
> - echo -ne "\tRunning status ... \t"
> + printf "\tRunning status ... \t"
> run_svn st $FILECOUNT -q
>
> - echo -ne "\tCommit files ... \t"
> + printf "\tCommit files ... \t"
> run_svn_ci $FILECOUNT add
>
> - echo -ne "\tListing files ... \t"
> + printf "\tListing files ... \t"
> run_svn ls $FILECOUNT
>
> - echo -ne "\tUpdating files ... \t"
> + printf "\tUpdating files ... \t"
> run_svn up $FILECOUNT -q
>
> - echo -ne "\tLocal copy ... \t"
> + printf "\tLocal copy ... \t"
> run_svn_cp $FILECOUNT ${FILECOUNT}_c
>
> - echo -ne "\tCommit copy ... \t"
> + printf "\tCommit copy ... \t"
> run_svn_ci ${FILECOUNT}_c copy
>
> - echo -ne "\tDelete 1 file ... \t"
> + printf "\tDelete 1 file ... \t"
> run_svn_del ${FILECOUNT} 1
>
> - echo -ne "\tDeleting files ... \t"
> - time (
> - for i in `seq 2 ${FILECOUNT}`; do
> + printf "\tDeleting files ... \t"
> + time sh -c "
> + for i in `seq 2 ${FILECOUNT} | xargs`; do
> ${SVN} del $WC/${FILECOUNT}_c/$i -q
> - done )
> + done "
>
> - echo -ne "\tCommit deletions ...\t"
> + printf "\tCommit deletions ...\t"
> run_svn_ci ${FILECOUNT}_c del
>
> rm -rf $WC
>
> - echo -ne "\tExport all ... \t"
> + printf "\tExport all ... \t"
> run_svn_get export $FILECOUNT
>
> rm -rf $WC
> mkdir $WC
>
> - echo -ne "\tCheck out all ... \t"
> + printf "\tCheck out all ... \t"
> run_svn_get co $FILECOUNT
>
> - let FILECOUNT=2*FILECOUNT
> + FILECOUNT=`echo 2 \* $FILECOUNT | bc`
bc is an external program, which might be unavailable.
The portable solution is $((...)) syntax:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04
--
Arfrever Frehtes Taifersar Arahesis
Re: svn commit: r1100723 -
/subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
Posted by Daniel Shahaf <da...@apache.org>.
Philip Martin wrote on Mon, May 09, 2011 at 13:26:29 +0100:
> Daniel Shahaf <da...@apache.org> writes:
>
> > SunOS 5.10's /bin/sh chokes:
> >
> > $ echo $((5*2))
> > syntax error: `(' unexpected
> >
> > Daniel
> > (I didn't test it before because the host I used has a time-based login policy)
>
> SunOS's /bin/sh is Bourne, not POSIX. SunOS provides /usr/xpg4/bin/sh
> which is POSIX.
>
... and indeed $((5*2)) works there.
Thanks.
Re: svn commit: r1100723 - /subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
Posted by Philip Martin <ph...@wandisco.com>.
Daniel Shahaf <da...@apache.org> writes:
> SunOS 5.10's /bin/sh chokes:
>
> $ echo $((5*2))
> syntax error: `(' unexpected
>
> Daniel
> (I didn't test it before because the host I used has a time-based login policy)
SunOS's /bin/sh is Bourne, not POSIX. SunOS provides /usr/xpg4/bin/sh
which is POSIX.
--
Philip
Re: svn commit: r1100723 -
/subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
Posted by Daniel Shahaf <da...@apache.org>.
Daniel Shahaf wrote on Mon, May 09, 2011 at 11:25:08 +0300:
> Arfrever Frehtes Taifersar Arahesis wrote on Mon, May 09, 2011 at 00:03:31 +0200:
> > 2011-05-08 13:53:14 danielsh@apache.org napisał(a):
> > > + FILECOUNT=`echo 2 \* $FILECOUNT | bc`
> >
> > bc is an external program, which might be unavailable.
> > The portable solution is $((...)) syntax:
> > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04
> >
>
> I've checked the OpenBSD manpage and it indicated that bc was POSIX
> compliant/compatible, so I assumed it was okay to use.
>
> I haven't found yet an environment which doesn't support $((..)),
SunOS 5.10's /bin/sh chokes:
$ echo $((5*2))
syntax error: `(' unexpected
Daniel
(I didn't test it before because the host I used has a time-based login policy)
Re: svn commit: r1100723 -
/subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
Posted by Daniel Shahaf <da...@apache.org>.
Arfrever Frehtes Taifersar Arahesis wrote on Mon, May 09, 2011 at 00:03:31 +0200:
> 2011-05-08 13:53:14 danielsh@apache.org napisał(a):
> > + FILECOUNT=`echo 2 \* $FILECOUNT | bc`
>
> bc is an external program, which might be unavailable.
> The portable solution is $((...)) syntax:
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04
>
I've checked the OpenBSD manpage and it indicated that bc was POSIX
compliant/compatible, so I assumed it was okay to use.
I haven't found yet an environment which doesn't support $((..)), so if
you're confident that that's more portable than bc than please do make
the change.
Thanks for the pointer/review.
Daniel
> --
> Arfrever Frehtes Taifersar Arahesis