3 # This test was used in a set of CMD3 tests (cmd3-3 test).
5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
8 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
10 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
12 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
13 BASEDIR=$MOUNT/mdsrate
16 NUM_FILES=${NUM_FILES:-1000000}
17 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
19 # Local test variables
20 TESTDIR_SINGLE="${BASEDIR}/single"
21 TESTDIR_MULTI="${BASEDIR}/multi"
23 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
25 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
26 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
27 # XXX - this needs to be determined given the number of MDTs and the number
29 THREADS_PER_CLIENT=3 # threads/client for multi client test
30 if [ $NUM_CLIENTS -gt 50 ]; then
34 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
36 # Make sure we start with a clean slate
39 log "===== $0 ====== "
41 check_and_setup_lustre
45 $LFS setstripe $BASEDIR -i 0 -c 1
48 IFree=$(mdsrate_inodes_available)
49 if [ $IFree -lt $NUM_FILES ]; then
53 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
55 if [ -n "$NOSINGLE" ]; then
56 echo "NO Tests on single client."
58 if [ -n "$NOCREATE" ]; then
59 echo "NO Test for creates for a single client."
61 # We can use np = $NUM_CLIENTS to speed up the cleanup
62 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore
64 log "===== $0 ### 1 NODE CREATE ###"
66 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
67 --nfiles $NUM_FILES --dir ${TESTDIR_SINGLE} --filefmt 'f%%d'"
69 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
71 if [ ${PIPESTATUS[0]} != 0 ]; then
72 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
73 error "mdsrate create for a single client failed, aborting"
77 if [ -n "$NOUNLINK" ]; then
78 echo "NO Test for unlinks for a single client."
80 log "===== $0 ### 1 NODE UNLINK ###"
82 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
83 --nfiles ${NUM_FILES} --dir ${TESTDIR_SINGLE} --filefmt 'f%%d'"
85 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
87 if [ ${PIPESTATUS[0]} != 0 ]; then
88 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
89 error "mdsrate unlinks for a single client failed, aborting"
96 IFree=$(mdsrate_inodes_available)
97 if [ $IFree -lt $NUM_FILES ]; then
101 if [ -n "$NOMULTI" ]; then
102 echo "NO tests on multiple nodes."
104 if [ -n "$NOCREATE" ]; then
105 echo "NO test for create on multiple nodes."
107 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore
109 log "===== $0 ### $NUM_CLIENTS NODES CREATE with $THREADS_PER_CLIENT threads per client ###"
111 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
112 --nfiles $NUM_FILES --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
114 mpi_run -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) -machinefile ${MACHINEFILE} \
115 ${COMMAND} | tee ${LOG}
116 if [ ${PIPESTATUS[0]} != 0 ]; then
117 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
118 error "mdsrate create on multiple nodes failed, aborting"
122 if [ -n "$NOUNLINK" ]; then
123 echo "NO Test for unlinks multiple nodes."
125 log "===== $0 ### $NUM_CLIENTS NODES UNLINK with $THREADS_PER_CLIENT threads per client ###"
127 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
128 --nfiles ${NUM_FILES} --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
130 mpi_run -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) -machinefile ${MACHINEFILE} \
131 ${COMMAND} | tee ${LOG}
132 if [ ${PIPESTATUS[0]} != 0 ]; then
133 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
134 error "mdsrate unlinks multiple nodes failed, aborting"
141 equals_msg `basename $0`: test complete, cleaning up
142 rmdir $BASEDIR || true
144 check_and_cleanup_lustre