--- /dev/null
+#!/bin/sh
+export PATH=/sbin:/usr/sbin:$PATH
+
+SRCDIR="`dirname $0`/"
+. $SRCDIR/common.sh
+
+runthreads() {
+ THR=$1
+ DO=$2
+ CNT=$3
+ V=$4
+ PGS=$5
+
+ case $DO in
+ test_getattr)
+ RW=
+ ;;
+ test_brw_write)
+ DO=test_brw
+ RW=w
+ ;;
+
+ test_brw_read)
+ DO=test_brw
+ RW=r
+ ;;
+ esac
+
+ if [ -e endrun ]; then
+ rm endrun
+ echo "exiting because endrun file was found"
+ exit 0
+ fi
+
+ $OBDCTL --threads $THR v '$OSCDEV' $DO $CNT $RW $V $PGS $OID || exit 1
+}
+
+if [ -z "`$OBDCTL device_list | grep osc`" ]; then
+ setup_opts $@
+
+ setup_portals
+ setup_lustre
+
+ setup_server || exit -1
+ setup_client || exit -1
+fi
+
+OID=`$OBDCTL --device '$OSCDEV' create 1 | awk '/is object id/ { print $6 }'`
+[ -z "$OID" ] && echo "error creating object" 1>&2 && exit 1
+
+# TODO: obdctl needs to check on the progress of each forked thread
+# (IPC SHM, sockets?) to see if it hangs.
+while date; do
+ PG=1
+ PGV=16
+ # We use '--threads 1 X' instead of '--device X' so that
+ # obdctl can monitor the forked thread for progress (TODO).
+ debug_server_off
+ debug_client_off
+ runthreads 1 test_brw_write 10000000 -30 $PG
+ runthreads 1 test_brw_read 10000000 -30 $PG
+
+ [ "$PGV" ] && runthreads 1 test_brw_write 1000000 -30 $PGV
+ [ "$PGV" ] && runthreads 1 test_brw_read 1000000 -30 $PGV
+
+ runthreads 2 test_brw_write 10000000 -30 $PG
+ runthreads 2 test_brw_read 10000000 -30 $PG
+
+ [ "$PGV" ] && runthreads 2 test_brw_write 1000000 -30 $PGV
+ [ "$PGV" ] && runthreads 2 test_brw_read 1000000 -30 $PGV
+
+ runthreads 10 test_brw_write 1000000 -30 $PG
+ runthreads 10 test_brw_read 1000000 -30 $PG
+
+ [ "$PGV" ] && runthreads 10 test_brw_write 100000 -60 $PGV
+ [ "$PGV" ] && runthreads 10 test_brw_read 100000 -60 $PGV
+
+ runthreads 32 test_brw_write 1000000 -30 $PG
+ runthreads 32 test_brw_read 1000000 -30 $PG
+
+ [ "$PGV" ] && runthreads 32 test_brw_write 100000 -60 $PGV
+ [ "$PGV" ] && runthreads 32 test_brw_read 100000 -60 $PGV
+
+ runthreads 64 test_brw_write 1000000 -30 $PG
+ runthreads 64 test_brw_read 1000000 -30 $PG
+
+ [ "$PGV" ] && runthreads 64 test_brw_write 100000 -60 $PGV
+ [ "$PGV" ] && runthreads 64 test_brw_read 100000 -60 $PGV
+
+ runthreads 100 test_brw_write 100000 -60 $PG
+ runthreads 100 test_brw_read 100000 -60 $PG
+
+ [ "$PGV" ] && runthreads 100 test_brw_write 100000 -60 $PGV
+ [ "$PGV" ] && runthreads 100 test_brw_read 100000 -60 $PGV
+done
+
+$OBDCTL --device '$OSCDEV' destroy $OID
+
+cleanup_client || exit -1
+cleanup_server || exit -1
+cleanup_lustre
+cleanup_portals