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 if [ -f "$LOG" ]; then
83 CREATED=$(sed -n '/^Rate:/s/^.* \([0-9]*\) creates .*/\1/p' $LOG)
84 [ $CREATED -gt 0 ] && NUM_FILES=$CREATED
87 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
88 --nfiles ${NUM_FILES} --dir ${TESTDIR_SINGLE} --filefmt 'f%%d'"
90 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
92 if [ ${PIPESTATUS[0]} != 0 ]; then
93 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
94 error "mdsrate unlinks for a single client failed, aborting"
101 IFree=$(mdsrate_inodes_available)
102 if [ $IFree -lt $NUM_FILES ]; then
106 if [ -n "$NOMULTI" ]; then
107 echo "NO tests on multiple nodes."
109 if [ -n "$NOCREATE" ]; then
110 echo "NO test for create on multiple nodes."
112 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore
114 log "===== $0 ### $NUM_CLIENTS NODES CREATE with $THREADS_PER_CLIENT threads per client ###"
116 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
117 --nfiles $NUM_FILES --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
119 mpi_run -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) -machinefile ${MACHINEFILE} \
120 ${COMMAND} | tee ${LOG}
121 if [ ${PIPESTATUS[0]} != 0 ]; then
122 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
123 error "mdsrate create on multiple nodes failed, aborting"
127 if [ -n "$NOUNLINK" ]; then
128 echo "NO Test for unlinks multiple nodes."
130 log "===== $0 ### $NUM_CLIENTS NODES UNLINK with $THREADS_PER_CLIENT threads per client ###"
132 if [ -f "$LOG" ]; then
133 CREATED=$(sed -n '/^Rate:/s/^.* \([0-9]*\) creates .*/\1/p' $LOG)
134 [ $CREATED -gt 0 ] && NUM_FILES=$CREATED
137 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
138 --nfiles ${NUM_FILES} --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
140 mpi_run -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) -machinefile ${MACHINEFILE} \
141 ${COMMAND} | tee ${LOG}
142 if [ ${PIPESTATUS[0]} != 0 ]; then
143 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
144 error "mdsrate unlinks multiple nodes failed, aborting"
151 equals_msg `basename $0`: test complete, cleaning up
152 rmdir $BASEDIR || true
154 check_and_cleanup_lustre