3 # This test was used in a set of CMD3 tests (cmd3-4 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 # set NUM_FILES=0 to force TIME_PERIOD work
17 NUM_FILES=${NUM_FILES:-1000000}
18 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
20 # Local test variables
21 TESTDIR_SINGLE="${BASEDIR}/single"
22 TESTDIR_MULTI="${BASEDIR}/multi"
24 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
26 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
27 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
29 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
31 log "===== $0 ====== "
33 check_and_setup_lustre
37 $LFS setstripe $BASEDIR -c -1
40 IFree=$(mdsrate_inodes_available)
41 if [ $IFree -lt $NUM_FILES ]; then
45 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
47 # Make sure we start with a clean slate
50 if [ -n "$NOSINGLE" ]; then
51 echo "NO Test for creates for a single client."
53 # We can use np = $NUM_CLIENTS to speed up the cleanup
54 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_SINGLE 'f%%d' --ignore
56 log "===== $0 ### 1 NODE CREATE ###"
58 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
59 --nfiles ${NUM_FILES} --dir ${TESTDIR_SINGLE} --filefmt 'f%%d'"
61 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
63 if [ ${PIPESTATUS[0]} != 0 ]; then
64 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
65 error "mdsrate creates for a single client failed, aborting"
68 log "===== $0 ### 1 NODE UNLINK ###"
70 if [ -f "$LOG" ]; then
71 CREATED=$(awk '/total:/ { print $7 }' $LOG)
72 [ $CREATED -gt 0 ] && NUM_FILES=$CREATED
75 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
76 --nfiles ${NUM_FILES} --dir ${TESTDIR_SINGLE} --filefmt 'f%%d'"
78 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
80 if [ ${PIPESTATUS[0]} != 0 ]; then
81 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
82 error "mdsrate unlink on a single client failed, aborting"
88 IFree=$(mdsrate_inodes_available)
89 if [ $IFree -lt $NUM_FILES ]; then
93 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
94 if [ -n "$NOMULTI" ]; then
95 echo "NO test for create on multiple nodes."
97 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore
99 log "===== $0 ### $NUM_CLIENTS NODES CREATE ###"
101 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
102 --nfiles $NUM_FILES --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
104 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
106 if [ ${PIPESTATUS[0]} != 0 ]; then
107 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
108 error "mdsrate create on multiple nodes failed, aborting"
111 log "===== $0 ### $NUM_CLIENTS NODES UNLINK ###"
113 if [ -f "$LOG" ]; then
114 CREATED=$(awk '/total:/ { print $7 }' $LOG)
115 [ $CREATED -gt 0 ] && NUM_FILES=$CREATED
118 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
119 --nfiles ${NUM_FILES} --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
121 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
123 if [ ${PIPESTATUS[0]} != 0 ]; then
124 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
125 error "mdsrate unlink on multiple nodes failed, aborting"
131 rmdir $BASEDIR || true
133 check_and_cleanup_lustre