Whamcloud - gitweb
b=23382 t-f: do_nodes(): wrong sed RE
[fs/lustre-release.git] / lustre / tests / mdsrate-stat-large.sh
1 #!/bin/sh
2 #
3 # This test was used in a set of CMD3 tests (cmd3-8 test).
4
5 # File attribute retrieval rate for large file creation
6 # 3300 ops/sec/OST for single node 28500 ops/sec/OST aggregate
7
8 # In a dir containing 10 million striped files, the mdsrate Test Program will
9 # perform directory ordered stat's (readdir) for 10 minutes. This test will be
10 # run from a single node for #1 and from all nodes for #2 aggregate test to
11 # measure stat performance.  
12
13 LUSTRE=${LUSTRE:-`dirname $0`/..}
14 . $LUSTRE/tests/test-framework.sh
15 init_test_env $@
16 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
17
18 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
19
20 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
21 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
22 TESTDIR=$MOUNT/mdsrate
23
24 # Requirements
25 NUM_FILES=${NUM_FILES:-1000000}
26 TIME_PERIOD=${TIME_PERIOD:-600}                        # seconds
27
28 # --random_order (default) -OR- --readdir_order
29 DIR_ORDER=${DIR_ORDER:-"--readdir_order"}
30
31 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
32 CLIENT=$SINGLECLIENT
33 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
34 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
35
36 rm -f $LOG
37
38 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
39
40 log "===== $0 ====== " 
41
42 check_and_setup_lustre
43 mkdir -p $TESTDIR
44 chmod 0777 $TESTDIR
45
46 IFree=$(mdsrate_inodes_available)
47 if [ $IFree -lt $NUM_FILES ]; then
48     NUM_FILES=$IFree
49 fi
50
51 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
52
53 $LFS setstripe $TESTDIR -c -1
54 get_stripe $TESTDIR
55
56 if [ -n "$NOCREATE" ]; then
57     echo "NOCREATE=$NOCREATE  => no file creation."
58 else
59     mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
60
61     log "===== $0 Test preparation: creating ${NUM_FILES} files."
62
63     COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --dir ${TESTDIR}
64                         --nfiles ${NUM_FILES} --filefmt 'f%%d'"
65     echo "+" ${COMMAND}
66
67     mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} 2>&1
68     [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting"
69
70 fi
71
72 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD}
73         --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'
74         ${DIR_ORDER} ${SEED_OPTION}"
75
76 # 1
77 if [ -n "$NOSINGLE" ]; then
78     echo "NO Test for stats on a single client."
79 else
80     log "===== $0 ### 1 NODE STAT ###"
81     echo "+" ${COMMAND}
82
83     mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
84
85     if [ ${PIPESTATUS[0]} != 0 ]; then
86         [ -f $LOG ] && sed -e "s/^/log: /" $LOG
87         error "mdsrate stats on a single client failed, aborting"
88     fi
89 fi
90
91 # 2
92 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
93 if [ -n "$NOMULTI" ]; then
94     echo "NO test for stats on multiple nodes."
95 else
96     log "===== $0 ### ${NUM_CLIENTS} NODES STAT ###"
97     echo "+" ${COMMAND}
98
99     mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
100
101     if [ ${PIPESTATUS[0]} != 0 ]; then
102         [ -f $LOG ] && sed -e "s/^/log: /" $LOG
103         error "mdsrate stats on multiple nodes failed, aborting"
104     fi
105 fi
106
107 equals_msg `basename $0`: test complete, cleaning up
108 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
109 rm -f $MACHINEFILE
110 check_and_cleanup_lustre
111 #rm -f $LOG
112
113 exit 0