SRCDIR="`dirname $0`/"
. $SRCDIR/common.sh
-setup_opts $@
+OSCNAME="`$OBDCTL device_list 2> /dev/null | awk '/ osc | lov / { print $4 }' | tail -1`"
-setup_portals
-setup_lustre
+if [ -z "$OSCNAME" ]; then
+ echo "$0: needs an OSC set up first" 1>&2
+ exit 1
+fi
-# TODO: obdctl needs to check on the progress of each forked thread
-# (IPC SHM, sockets?) to see if it hangs.
-for CMD in test_getattr test_brw_read test_brw_write; do
- case $CMD in
- test_brw_read) CMD=test_brw; RW=r ;;
- test_brw_write) CMD=test_brw; RW=w ;;
- *) RW= ;;
+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
- setup_server || exit -1
- setup_client || exit -1
+ $OBDCTL --threads $THR v \$$OSCNAME $DO $CNT $RW $V $PGS $OID || exit 1
- OSC_DEVNO=`$OBDCTL name2dev OSCDEV`
+ if [ -e endrun ]; then
+ rm endrun
+ echo "exiting because endrun file was found"
+ exit 0
+ fi
+}
- # We use '--threads 1 X' instead of '--device X' so that
- # obdctl can modnitor the forked thread for progress (TODO).
- $OBDCTL --threads 1 v $OSC_DEVNO $CMD 1 $RW v || exit -1
- $OBDCTL --threads 1 v $OSC_DEVNO $CMD 100 $RW v || exit -1
+OID=`$OBDCTL --device \\$$OSCNAME create 1 | awk '/is object id/ { print $6 }'`
+
+# TODO: obdctl needs to check on the progress of each forked thread
+# (IPC SHM, sockets?) to see if it hangs.
+for CMD in test_getattr test_brw_write test_brw_read; do
+ case $CMD in
+ test_getattr)
+ PG=
+ PGV=
+ ;;
+ test_brw_write)
+ PG=1
+ PGV=16
+ ;;
- #cleanup_client || exit -1
- #cleanup_server || exit -1
+ test_brw_read)
+ PG=1
+ case $OSTNODE in
+ ba*) PGV= ;; # disabled until the BA OST code is updated
+ *) PGV=16 ;;
+ esac
+ ;;
+ esac
- #setup_server || exit -1
- #setup_client || exit -1
+ # We use '--threads 1 X' instead of '--device X' so that
+ # obdctl can monitor the forked thread for progress (TODO).
+ runthreads 1 $CMD 1 1 $PG
+ runthreads 1 $CMD 100 1 $PG
debug_server_off
debug_client_off
- $OBDCTL --threads 1 v $OSC_DEVNO $CMD 10000 $RW 100 || exit -1
- $OBDCTL --threads 1 v $OSC_DEVNO $CMD 1000000 $RW -10 || exit -1
+ runthreads 1 $CMD 10000 100 $PG
+ [ "$PGV" ] && runthreads 1 $CMD 1000 100 $PGV
- debug_server_on
- debug_client_on
- $OBDCTL --threads 2 v $OSC_DEVNO $CMD 100 $RW v || exit -1
+ runthreads 1 $CMD 1000000 -30 $PG
+ [ "$PGV" ] && runthreads 1 $CMD 100000 -30 $PGV
- debug_server_off
- debug_client_off
- $OBDCTL --threads 2 v $OSC_DEVNO $CMD 10000 $RW 100 || exit -1
- $OBDCTL --threads 2 v $OSC_DEVNO $CMD 1000000 $RW -30 || exit -1
+ runthreads 1 $CMD 100 1 $PG
+
+ runthreads 2 $CMD 10000 100 $PG
+ [ "$PGV" ] && runthreads 2 $CMD 1000 100 $PGV
+
+ runthreads 2 $CMD 1000000 -30 $PG
+ [ "$PGV" ] && runthreads 2 $CMD 100000 -30 $PGV
- $OBDCTL --threads 10 v $OSC_DEVNO $CMD 10000 $RW 1000 || exit -1
- $OBDCTL --threads 100 v $OSC_DEVNO $CMD 10000 $RW -30 || exit -1
+ runthreads 10 $CMD 10000 1000 $PG
+ [ "$PGV" ] && runthreads 10 $CMD 1000 1000 $PGV
- cleanup_client || exit -1
- cleanup_server || exit -1
+ runthreads 100 $CMD 10000 -30 $PG
done
-cleanup_lustre
-cleanup_portals
+$OBDCTL --device \$$OSCNAME destroy $OID