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}
16 NUM_FILES=${NUM_FILES:-1000000}
17 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
19 # Local test variables
20 TESTDIR_SINGLE="${TESTDIR}/single"
21 TESTDIR_MULTI="${TESTDIR}/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
43 IFree=$(inodes_available)
44 if [ $IFree -lt $NUM_FILES ]; then
48 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
50 $LFS setstripe $TESTDIR -i 0 -c 1
53 if [ -n "$NOSINGLE" ]; then
54 echo "NO Tests on single client."
56 if [ -n "$NOCREATE" ]; then
57 echo "NO Test for creates for a single client."
59 # We can use np = $NUM_CLIENTS to speed up the cleanup
60 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore
62 log "===== $0 ### 1 NODE CREATE ###"
63 echo "Running creates on 1 node(s)."
65 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
66 --nfiles $NUM_FILES --dir ${TESTDIR_SINGLE} --filefmt 'f%%d'"
68 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
70 if [ ${PIPESTATUS[0]} != 0 ]; then
71 [ -f $LOG ] && cat $LOG
72 error "mpirun ... mdsrate ... failed, aborting"
76 if [ -n "$NOUNLINK" ]; then
77 echo "NO Test for unlinks for a single client."
79 log "===== $0 ### 1 NODE UNLINK ###"
80 echo "Running unlinks on 1 node(s)."
82 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink --time ${TIME_PERIOD}
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 ] && cat $LOG
89 error "mpirun ... mdsrate ... failed, aborting"
94 IFree=$(inodes_available)
95 if [ $IFree -lt $NUM_FILES ]; then
99 if [ -n "$NOMULTI" ]; then
100 echo "NO tests on multiple nodes."
102 if [ -n "$NOCREATE" ]; then
103 echo "NO test for create on multiple nodes."
105 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore
107 log "===== $0 ### $NUM_CLIENTS NODES CREATE ###"
108 echo "Running creates on ${NUM_CLIENTS} node(s) with $THREADS_PER_CLIENT threads per client."
110 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
111 --nfiles $NUM_FILES --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
113 mpi_run -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) -machinefile ${MACHINEFILE} \
114 ${COMMAND} | tee ${LOG}
115 if [ ${PIPESTATUS[0]} != 0 ]; then
116 [ -f $LOG ] && cat $LOG
117 error "mpirun ... mdsrate ... failed, aborting"
121 if [ -n "$NOUNLINK" ]; then
122 echo "NO Test for unlinks multiple nodes."
124 log "===== $0 ### $NUM_CLIENTS NODES UNLINK ###"
125 echo "Running unlinks on ${NUM_CLIENTS} node(s) with $THREADS_PER_CLIENT threads per client."
127 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink --time ${TIME_PERIOD}
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 ] && cat $LOG
134 error "mpirun ... mdsrate ... failed, aborting"
139 equals_msg `basename $0`: test complete, cleaning up
140 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore
141 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore
143 check_and_cleanup_lustre