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 mdsrate_STRIPEPARAMS=${mdsrate_STRIPEPARAMS:-${fs_STRIPEPARAMS:-"-c -1"}}
38 setstripe_getstripe $BASEDIR $mdsrate_STRIPEPARAMS
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 ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} |
64 if [ ${PIPESTATUS[0]} != 0 ]; then
65 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
66 error_noexit "mdsrate create on single client failed, aborting"
67 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
68 $TESTDIR_SINGLE 'f%%d' --ignore
72 log "===== $0 ### 1 NODE UNLINK ###"
74 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
75 --nfiles ${NUM_FILES} --dir ${TESTDIR_SINGLE} --filefmt 'f%%d'"
77 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} | tee ${LOG}
79 if [ ${PIPESTATUS[0]} != 0 ]; then
80 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
81 error "mdsrate unlink on a single client failed, aborting"
87 IFree=$(mdsrate_inodes_available)
88 if [ $IFree -lt $NUM_FILES ]; then
92 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
93 if [ -n "$NOMULTI" ]; then
94 echo "NO test for create on multiple nodes."
96 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR_MULTI 'f%%d' --ignore
98 log "===== $0 ### $NUM_CLIENTS NODES CREATE ###"
100 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --time ${TIME_PERIOD}
101 --nfiles $NUM_FILES --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
103 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
104 ${COMMAND} | tee ${LOG}
106 if [ ${PIPESTATUS[0]} != 0 ]; then
107 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
108 error_noexit "mdsrate create on multiple nodes failed, aborting"
109 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
110 $TESTDIR_MULTI 'f%%d' --ignore
114 log "===== $0 ### $NUM_CLIENTS NODES UNLINK ###"
116 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --unlink
117 --nfiles ${NUM_FILES} --dir ${TESTDIR_MULTI} --filefmt 'f%%d'"
119 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
120 ${COMMAND} | tee ${LOG}
122 if [ ${PIPESTATUS[0]} != 0 ]; then
123 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
124 error "mdsrate unlink on multiple nodes failed, aborting"
130 rmdir $BASEDIR || true
132 check_and_cleanup_lustre