#!/bin/bash
-export PATH=`dirname $0`/../utils:$PATH
-NAME=${NAME:-local}
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
-. $LUSTRE/tests/test-framework.sh
-init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+LUSTRE=${LUSTRE:-$(dirname "$0")/..}
-cmd=$1
-shift
-$cmd $@
+if [[ ! -f "$LUSTRE/tests/rpc.sh" ]]; then
+ FILE_PATH=$(which "$0")
+ DIRECTORY=$(dirname "$FILE_PATH")
+ LUSTRE=$(dirname "$DIRECTORY")
+fi
-exit $?
+. "$LUSTRE/tests/test-framework.sh"
+RPC_MODE=true init_test_env
+
+# Reset the trap on ERR set by the framework. Noticing this failure is the
+# framework's job.
+trap - ERR
+
+log "$HOSTNAME: executing $*"
+# Execute the command
+"$@"