trivial updates to get more bits to work together.
authorfsgqa <fsgqa>
Wed, 18 Sep 2002 08:03:37 +0000 (08:03 +0000)
committerfsgqa <fsgqa>
Wed, 18 Sep 2002 08:03:37 +0000 (08:03 +0000)
bench
run.dbench
run.tar
tools/auto-qa

diff --git a/bench b/bench
index 71ebca8..fc7989b 100755 (executable)
--- a/bench
+++ b/bench
@@ -1,7 +1,7 @@
 #!/bin/sh
 # 
 # Wrapper for automating benchmarking runs.
-# Usage:   bench [passes] [uid] [gid] [script]
+# Usage:   bench [passes] [user] [group] [script]
 # 
 # ..where passes is the number of times to run each script; uid/gid
 # gives credentials to use when running the script; and script is a
@@ -67,8 +67,8 @@ _cleanup()
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
 ROOT="."
-LOG="$ROOT/soak.log"
-FULL="$ROOT/soak.full"
+LOG="$ROOT/bench.log"
+FULL="$ROOT/bench.full"
 
 _log()
 {
@@ -93,10 +93,12 @@ _fail()
 _run_benchmark()
 {
     pass=1
+    uid=`id -u $user`
+    gid=`id -g $group`
     
     while [ $pass -le $passes -o $passes -lt 0 ]
     do
-        _log "        *** clean scratch device [starting pass $pass]"
+        _log "        *** clean scratch device [$bench starting, pass $pass]"
         mkfs_xfs -f $SCRATCH_DEV 2>&1 |  _fix_malloc >>$FULL \
                         || _fail "            !!! failed to mkfs SCRATCH_DEV"
 
@@ -106,14 +108,14 @@ _run_benchmark()
         
         _log "        *** mkdir"
         mkdir $SCRATCH_MNT/bench \
-                            || _fail "            !!! couldn't mkdir bench dir"
+                            || _fail "            !!! couldn't mkdir benchdir"
         chown -R $user.$group $SCRATCH_MNT/bench \
-                            || _fail "            !!! couldn't chown bench dir"
+                            || _fail "            !!! couldn't chown benchdir"
         cd $SCRATCH_MNT/bench
 
-        _log "        *** bench"
-        $here/src/runas -u $user -g $group $here/run.$bench > $FULL
-        [ $? -eq 0 ]        || _fail "            !!! non-zero $bench exit code"
+        _log "        *** bench [src/runas -u $uid -g $gid run.$bench]"
+        $here/src/runas -u $uid -g $gid $here/run.$bench | _logp
+        [ $? -eq 0 ]        || _fail "            !!! non-zero $bench status"
         cd $here
 
         _log "        *** unmounting scratch device"
@@ -134,23 +136,26 @@ _require_scratch
 passes=-1
 user=root
 group=root
-benches=`echo run.*`
+benches=`echo run.* | sed -e 's/run\.//g'`
 
 [ $# -gt 0 ] && passes=$1
-[ $# -gt 1 ] && user=$3
-[ $# -gt 2 ] && group=$4
-[ $# -gt 3 ] && benches=$2
+[ $# -gt 1 ] && user=$2
+[ $# -gt 2 ] && group=$3
+[ $# -gt 3 ] && benches=$4
 
-for bench in "$benches"
+[ -z "$benches" -o "$benches" = "*" ] && _fail "no benchmark scripts found"
+
+for bench in $benches
 do 
     echo "" >$FULL
     echo "" >$LOG
     _log "*** benchmark started (passes=$passes, benchmark=$bench)"
     _log "***     (`date`)"
     _log "        *** unmounting scratch device"
-    umount $SCRATCH_DEV 2>&1 |  _fix_malloc >>$FULL
-    
-    _run_benchmark  # $passes $bench $user $group
+    umount $SCRATCH_DEV 2>&1 | _fix_malloc >>$FULL
+
+    _run_benchmark |  _fix_malloc
 
     _log "*** done $bench"
 done
+status=0
index c0f2dd3..2234f52 100755 (executable)
@@ -8,7 +8,9 @@ DBENCH_CLIENTS=${DBENCH_CLIENTS:=10}
 run_dbench()
 {
        mkdir ./dbench || exit 1
+       cd dbench
        dbench $DBENCH_CLIENTS || exit 1
+       cd ..
        rm -fr ./dbench || exit 1
 }
 
diff --git a/run.tar b/run.tar
index c22676f..a5f42bb 100755 (executable)
--- a/run.tar
+++ b/run.tar
@@ -13,9 +13,9 @@ barf()
 
 new_tar()
 {
-       source="/bin /sbin /lib /dev"
-       if [ ! -f $1 ]; then
-               tar cf $1 $source || barf "tar c failed"
+       source="bin sbin lib"
+       if [ ! -f $TARFILE ]; then
+               ( cd / && tar cf $TARFILE $source ) || barf "tar c failed"
        fi
 }
 
@@ -23,7 +23,9 @@ run_tar()
 {
        # %U=user %S=system %E=elapsed
        mkdir ./tar || exit 1
-       /usr/bin/time -f '%U,%S,%E' tar xf $1 ./tar || exit 1
+       cd tar
+       /usr/bin/time -f '%U,%S,%E' tar xf $TARFILE || exit 1
+       cd ..
        rm -fr ./tar || exit 1
 }
 
@@ -31,5 +33,5 @@ if [ $# -gt 0 ]; then
        echo "user,system,elapsed"
        exit 0
 fi
-new_tar $TARFILE
-run_tar $TARFILE
+new_tar
+run_tar
index 92ca38f..70eae80 100755 (executable)
@@ -487,8 +487,8 @@ do
            cd $QADIR
            
            _log "          *** run benchmarks"
-           _sudo ./bench $BENCH_PASSES `id -u && id -g` \
-                       || _fail "          !!! failed to run soak test"
+           _sudo ./bench $BENCH_PASSES `id -nu && id -ng` \
+                       || _fail "          !!! failed to run benchmarks"
 
            new_state="done"
            ;;