3 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
4 . $LUSTRE/tests/test-framework.sh
7 echo "-C use chroot instead of cd"
8 echo "-D DIR - use 'DIR' as work directory"
13 PATH=${DBENCH_LIB}:${PATH}
14 MOUNT=${MOUNT:-/mnt/lustre}
15 DIR=${DIR:-$MOUNT/`hostname`}
18 while getopts "CD:" opt $*; do
20 D) [ -d $OPTARG ] && DIR=$OPTARG ;;
28 CLIENT_PREFIX="${DBENCH_LIB} /usr/share/dbench /usr/local/share /usr/lib/dbench"
29 CLIENT_FILE="client.txt client_plain.txt dbench_client"
30 if ! which dbench > /dev/null 2>&1 ; then
31 [ "$MISSING_DBENCH_OK" ] || { error "$0 : $(hostname) dbench is not installed !" && exit 3; }
32 skip_env "$0 : $(hostname) dbench is not installed"
37 for prefix in $CLIENT_PREFIX; do
38 for file in $CLIENT_FILE; do
39 if [ -s "${prefix}/${file}" ]; then
40 CLIENT="${prefix}/${file}";
44 [ "x$CLIENT" != "x" ] && break;
47 if [ -n "$DBENCH_SRC" -a -s "$DBENCH_SRC" ]; then
52 skip_env "$0: no client file found for dbench on $(hostname): "\
53 "DBENCH_LIB=$DBENCH_LIB DBENCH_SRC=$DBENCH_SRC" && exit 0
55 [ ! -s "$TGT" ] && echo "copying $CLIENT to $TGT" && cp $CLIENT $TGT
57 echo "$0 : $(hostname) $TGT file doesn't exist after cp $CLIENT $TGT" && exit 1
59 if [ "x$CHROOT" == "xyes" ]; then
60 echo "copying necessary libs to $DIR"
61 cp `which dbench` $DIR
62 LIBS71=$(ldd $DIR/dbench |
63 sed -e 's/\t*//' -e 's/.*=> //' -e 's/ .*//' -e 's/^\///' |
64 grep -v 'linux-vdso.so.1')
65 tar -C / -chf - $LIBS71 | tar -C $DIR -xvf -
66 if [ "${PIPESTATUS[*]}" != "0 0" ]; then
67 echo "can't copy libs $LIBS71 to $DIR"
79 echo kill dbench main pid=$DBENCHPID
81 rm -rf dbench $LIBS71 client.txt
85 # turn off errexit. rundbench will return error code on failure
90 echo "running 'dbench $@' $PREFIX $PWD at `date`"
92 $RUN dbench -c client.txt $@ &
94 echo "dbench PID=$DBENCHPID"
97 [ $RC -ne 0 ] && killall -9 dbench
99 rm -rf dbench $LIBS71 client.txt