Whamcloud - gitweb
LU-15152 tests: auster reports wrong testsuite status
[fs/lustre-release.git] / lustre / tests / mdsrate-lookup-1dir.sh
1 #!/bin/bash
2 #
3 # This test was used in a set of CMD3 tests (cmd3-5 test).
4
5 # Directory lookup retrieval rate single directory 10 million files
6 # 5900 random lookups/sec per client node 62,000 random lookups/sec aggregate
7 #
8 # In a dir containing 10 million non-striped files the mdsrate Test Program will
9 # perform lookups for 10 minutes. This test can be run from a single node for
10 # #1 and from all nodes for #2 aggregate test to measure lookup performance.
11
12 LUSTRE=${LUSTRE:-$(dirname $0)/..}
13 . $LUSTRE/tests/test-framework.sh
14 init_test_env $@
15
16 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
17
18 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
19 BASEDIR=$MOUNT/mdsrate
20 TESTDIR=$BASEDIR/lookup
21
22 # Requirements
23 NUM_FILES=${NUM_FILES:-1000000}
24 TIME_PERIOD=${TIME_PERIOD:-600}                        # seconds
25
26 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
27 CLIENT=$SINGLECLIENT
28 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
29 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
30
31 rm -f $LOG
32
33 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
34
35 log "===== $0 ====== "
36
37 check_and_setup_lustre
38
39 MDSRATE_ENABLE_DNE=${MDSRATE_ENABLE_DNE:-false}
40 if $MDSRATE_ENABLE_DNE; then
41         test_mkdir $BASEDIR
42         mdtcount_opt="--mdtcount $MDSCOUNT"
43 else
44         mkdir $BASEDIR
45 fi
46 if $VERBOSE; then
47         debug_opt="--debug"
48 fi
49 chmod 0777 $BASEDIR
50 mdsrate_STRIPEPARAMS=${mdsrate_STRIPEPARAMS:-${fs_STRIPEPARAMS:-"-c 1"}}
51 setstripe_getstripe $BASEDIR $mdsrate_STRIPEPARAMS
52
53 IFree=$(mdsrate_inodes_available)
54 if [ $IFree -lt $NUM_FILES ]; then
55     NUM_FILES=$IFree
56 fi
57
58 generate_machine_file $NODES_TO_USE $MACHINEFILE ||
59         error "can not generate machinefile"
60
61 p="$TMP/$TESTSUITE-$TESTNAME.parameters"
62 save_lustre_params $(get_facets MDS) mdt.*.enable_remote_dir_gid > $p
63 do_nodes $(comma_list $(mdts_nodes)) \
64         $LCTL set_param mdt.*.enable_remote_dir_gid=-1
65
66 if [ -n "$NOCREATE" ]; then
67     echo "NOCREATE=$NOCREATE  => no file creation."
68 else
69     mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
70
71     log "===== $0 Test preparation: creating ${NUM_FILES} files."
72
73     NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
74     NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
75     if [ $NUM_CLIENTS -gt 50 ]; then
76         NUM_THREADS=$NUM_CLIENTS
77     fi
78         COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir ${TESTDIR}
79                 --nfiles ${NUM_FILES} --filefmt 'f%%d'
80                 $mdtcount_opt $debug_opt"
81         echo "+" ${COMMAND}
82         mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_THREADS} \
83                 ${COMMAND} 2>&1
84
85         # No lockup if error occurs on file creation, abort.
86         if [ ${PIPESTATUS[0]} != 0 ]; then
87                 error_noexit "mdsrate file creation failed, aborting"
88                 restore_lustre_params < $p
89                 mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \
90                                 $TESTDIR 'f%%d' --ignore
91                 exit 1
92         fi
93 fi
94
95 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION}
96         --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
97
98 # 1
99 if [ -n "$NOSINGLE" ]; then
100     echo "NO Test for lookups on a single client."
101 else
102         log "===== $0 ### 1 NODE LOOKUPS ###"
103         echo "+" ${COMMAND}
104         mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} |
105                 tee ${LOG}
106
107         if [ ${PIPESTATUS[0]} != 0 ]; then
108                 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
109                 error_noexit "mdsrate lookup on single client failed, aborting"
110                 restore_lustre_params < $p
111                 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
112                                 $TESTDIR 'f%%d' --ignore
113                 exit 1
114         fi
115 fi
116
117 # 2
118 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
119 if [ -n "$NOMULTI" ]; then
120     echo "NO test for lookups on multiple nodes."
121 else
122         log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
123         echo "+" ${COMMAND}
124         mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
125                 ${COMMAND} | tee ${LOG}
126
127         if [ ${PIPESTATUS[0]} != 0 ]; then
128                 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
129                 error_noexit "mdsrate lookup on multiple nodes failed, aborting"
130                 restore_lustre_params < $p
131                 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
132                                 $TESTDIR 'f%%d' --ignore
133                 exit 1
134         fi
135 fi
136
137 complete $SECONDS
138 restore_lustre_params < $p
139 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
140 rmdir $BASEDIR || true
141 rm -f $MACHINEFILE
142 check_and_cleanup_lustre
143 #rm -f $LOG
144
145 exit 0