5 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
6 . $LUSTRE/tests/test-framework.sh
8 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
12 ALWAYS_EXCEPT="$PARALLEL_SCALE_EXCEPT"
17 cbench_DIR=${cbench_DIR:-""}
18 cbench_IDIRS=${cbench_IDIRS:-10}
19 cbench_RUNS=${cbench_RUNS:-10} # FIXME: wiki page requirements is 30, do we really need 30 ?
21 if [ "$SLOW" = "no" ]; then
29 METABENCH=${METABENCH:-$(which metabench 2> /dev/null || true)}
30 mbench_NFILES=${mbench_NFILES:-30400}
31 [ "$SLOW" = "no" ] && mbench_NFILES=10000
32 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
34 mbench_THREADS=${mbench_THREADS:-4}
39 SIMUL=${SIMUL:=$(which simul 2> /dev/null || true)}
41 simul_THREADS=${simul_THREADS:-2}
42 simul_REP=${simul_REP:-20}
43 [ "$SLOW" = "no" ] && simul_REP=2
48 cnt_DIR=${cnt_DIR:-""}
49 cnt_NRUN=${cnt_NRUN:-10}
50 [ "$SLOW" = "no" ] && cnt_NRUN=2
55 CASC_RW=${CASC_RW:-$(which cascading_rw 2> /dev/null || true)}
57 casc_THREADS=${casc_THREADS:-2}
58 casc_REP=${casc_REP:-300}
59 [ "$SLOW" = "no" ] && casc_REP=10
64 IOR=${IOR:-$(which IOR 2> /dev/null || true)}
66 ior_THREADS=${ior_THREADS:-2}
67 ior_blockSize=${ior_blockSize:-6} # Gb
68 ior_DURATION=${ior_DURATION:-30} # minutes
69 [ "$SLOW" = "no" ] && ior_DURATION=5
72 # write_append_truncate
75 write_THREADS=${write_THREADS:-8}
76 write_REP=${write_REP:-10000}
77 [ "$SLOW" = "no" ] && write_REP=100
82 WRITE_DISJOINT=${WRITE_DISJOINT:-$(which write_disjoint 2> /dev/null || true)}
84 wdisjoint_THREADS=${wdisjoint_THREADS:-4}
85 wdisjoint_REP=${wdisjoint_REP:-10000}
86 [ "$SLOW" = "no" ] && wdisjoint_REP=100
92 PARALLEL_GROUPLOCK=${PARALLEL_GROUPLOCK:-$(which parallel_grouplock 2> /dev/null || true)}
93 parallel_grouplock_MINTASKS=${parallel_grouplock_MINTASKS:-5}
96 check_and_setup_lustre
105 echo "${var}=${!var}"
107 [ -e $MACHINEFILE ] && cat $MACHINEFILE
111 # 5 min * cbench_RUNS
115 # compile dir kernel-1 680MB
116 # required space 680MB * cbench_IDIRS = ~7 Gb
118 test_compilebench() {
119 print_opts cbench_DIR cbench_IDIRS cbench_RUNS
121 [ x$cbench_DIR = x ] &&
122 { skip_env "compilebench not found" && return; }
124 [ -e $cbench_DIR/compilebench ] || \
125 { skip_env "No compilebench build" && return; }
127 local space=$(df -P $DIR | tail -n 1 | awk '{ print $4 }')
128 if [ $space -le $((680 * 1024 * cbench_IDIRS)) ]; then
129 cbench_IDIRS=$(( space / 680 / 1024))
130 [ $cbench_IDIRS = 0 ] && \
131 skip_env "Need free space atleast 680 Mb, have $space" && return
133 log free space=$space, reducing initial dirs to $cbench_IDIRS
136 # t-f _base needs to be modifyed to set properly tdir
137 # for new "test_foo" functions names
138 # local testdir=$DIR/$tdir
139 local testdir=$DIR/d0.compilebench
144 local cmd="./compilebench -D $testdir -i $cbench_IDIRS -r $cbench_RUNS --makej"
153 [ $rc = 0 ] || error "compilebench failed: $rc"
156 run_test compilebench "compilebench"
159 [ x$METABENCH = x ] &&
160 { skip_env "metabench not found" && return; }
162 local clients=$CLIENTS
163 [ -z $clients ] && clients=$(hostname)
165 num_clients=$(get_node_count ${clients//,/ })
168 # Need space estimation here.
170 generate_machine_file $clients $MACHINEFILE || return $?
172 print_opts METABENCH clients mbench_NFILES mbench_THREADS
174 local testdir=$DIR/d0.metabench
176 # mpi_run uses mpiuser
179 # -C Run the file creation tests.
180 # -S Run the file stat tests.
181 # -c nfile Number of files to be used in each test.
182 # -k Cleanup. Remove the test directories.
183 local cmd="$METABENCH -w $testdir -c $mbench_NFILES -C -S -k"
185 mpi_run -np $((num_clients * $mbench_THREADS)) -machinefile ${MACHINEFILE} $cmd
187 if [ $rc != 0 ] ; then
188 error "metabench failed! $rc"
192 run_test metabench "metabench"
195 if [ "$NFSCLIENT" ]; then
196 skip "skipped for NFSCLIENT mode"
201 { skip_env "simul not found" && return; }
203 local clients=$CLIENTS
204 [ -z $clients ] && clients=$(hostname)
206 local num_clients=$(get_node_count ${clients//,/ })
209 # Need space estimation here.
211 generate_machine_file $clients $MACHINEFILE || return $?
213 print_opts SIMUL clients simul_REP simul_THREADS
215 local testdir=$DIR/d0.simul
217 # mpi_run uses mpiuser
220 # -n # : repeat each test # times
221 # -N # : repeat the entire set of tests # times
223 local cmd="$SIMUL -d $testdir -n $simul_REP -N $simul_REP"
226 mpi_run -np $((num_clients * $simul_THREADS)) -machinefile ${MACHINEFILE} $cmd
229 if [ $rc != 0 ] ; then
230 error "simul failed! $rc"
234 run_test simul "simul"
236 test_connectathon() {
237 print_opts cnt_DIR cnt_NRUN
240 { skip_env "connectathon dir not found" && return; }
242 [ -e $cnt_DIR/runtests ] || \
243 { skip_env "No connectathon runtests found" && return; }
245 local testdir=$DIR/d0.connectathon
252 # cthon options (must be in this order)
254 # -N numpasses - will be passed to the runtests script. This argument
255 # is optional. It specifies the number of times to run
258 # One of these test types
263 # -a all of the above
265 # -f a quick functionality test
269 # Include lock tests unless we're running on nfsv4
270 local fstype=$(df -TP $testdir | awk 'NR==2 {print $2}')
271 echo "$testdir: $fstype"
272 if [[ $fstype != "nfs4" ]]; then
276 for test in $tests; do
277 local cmd="./runtests -N $cnt_NRUN $test -f $testdir"
283 [ $rc = 0 ] || error "connectathon failed: $rc"
289 run_test connectathon "connectathon"
293 { skip_env "IOR not found" && return; }
295 local clients=$CLIENTS
296 [ -z $clients ] && clients=$(hostname)
298 local num_clients=$(get_node_count ${clients//,/ })
300 local space=$(df -P $DIR | tail -n 1 | awk '{ print $4 }')
301 echo "+ $ior_blockSize * 1024 * 1024 * $num_clients * $ior_THREADS "
302 if [ $((space / 2)) -le $(( ior_blockSize * 1024 * 1024 * num_clients * ior_THREADS)) ]; then
303 echo "+ $space * 9/10 / 1024 / 1024 / $num_clients / $ior_THREADS"
304 ior_blockSize=$(( space /2 /1024 /1024 / num_clients / ior_THREADS ))
305 [ $ior_blockSize = 0 ] && \
306 skip_env "Need free space more than ($num_clients * $ior_THREADS )Gb: $((num_clients*ior_THREADS *1024 *1024*2)), have $space" && return
308 echo "free space=$space, Need: $num_clients x $ior_THREADS x $ior_blockSize Gb (blockSize reduced to $ior_blockSize Gb)"
311 generate_machine_file $clients $MACHINEFILE || return $?
313 print_opts IOR ior_THREADS ior_DURATION MACHINEFILE
315 local testdir=$DIR/d0.ior
317 # mpi_run uses mpiuser
319 if [ "$NFSCLIENT" ]; then
320 setstripe_nfsserver $testdir -c -1 ||
321 { error "setstripe on nfsserver failed" && return 1; }
323 $LFS setstripe $testdir -c -1 ||
324 { error "setstripe failed" && return 2; }
327 # -b N blockSize -- contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g)"
329 # -t N transferSize -- size of transfer in bytes (e.g.: 8, 4k, 2m, 1g)"
330 # -w writeFile -- write file"
331 # -r readFile -- read existing file"
332 # -T maxTimeDuration -- max time in minutes to run tests"
333 # -k keepFile -- keep testFile(s) on program exit
334 local cmd="$IOR -a POSIX -b ${ior_blockSize}g -o $testdir/iorData -t 2m -v -w -r -T $ior_DURATION -k"
337 mpi_run -np $((num_clients * $ior_THREADS)) -machinefile ${MACHINEFILE} $cmd
340 if [ $rc != 0 ] ; then
341 error "ior failed! $rc"
347 test_cascading_rw() {
348 if [ "$NFSCLIENT" ]; then
349 skip "skipped for NFSCLIENT mode"
354 { skip_env "cascading_rw not found" && return; }
356 local clients=$CLIENTS
357 [ -z $clients ] && clients=$(hostname)
359 num_clients=$(get_node_count ${clients//,/ })
362 # Need space estimation here.
364 generate_machine_file $clients $MACHINEFILE || return $?
366 print_opts CASC_RW clients casc_THREADS casc_REP MACHINEFILE
368 local testdir=$DIR/d0.cascading_rw
370 # mpi_run uses mpiuser
374 # -n: repeat test # times
376 local cmd="$CASC_RW -g -d $testdir -n $casc_REP"
379 mpi_run -np $((num_clients * $casc_THREADS)) -machinefile ${MACHINEFILE} $cmd
382 if [ $rc != 0 ] ; then
383 error "cascading_rw failed! $rc"
387 run_test cascading_rw "cascading_rw"
389 test_write_append_truncate() {
390 if [ "$NFSCLIENT" ]; then
391 skip "skipped for NFSCLIENT mode"
395 # location is lustre/tests dir
396 if ! which write_append_truncate > /dev/null 2>&1 ; then
397 skip_env "write_append_truncate not found"
401 local clients=$CLIENTS
402 [ -z $clients ] && clients=$(hostname)
404 local num_clients=$(get_node_count ${clients//,/ })
407 # Need space estimation here.
409 generate_machine_file $clients $MACHINEFILE || return $?
411 local testdir=$DIR/d0.write_append_truncate
412 local file=$testdir/f0.wat
414 print_opts clients write_REP write_THREADS MACHINEFILE
417 # mpi_run uses mpiuser
420 local cmd="write_append_truncate -n $write_REP $file"
423 mpi_run -np $((num_clients * $write_THREADS)) -machinefile ${MACHINEFILE} $cmd
426 if [ $rc != 0 ] ; then
427 error "write_append_truncate failed! $rc"
432 run_test write_append_truncate "write_append_truncate"
434 test_write_disjoint() {
435 if [ "$NFSCLIENT" ]; then
436 skip "skipped for NFSCLIENT mode"
440 [ x$WRITE_DISJOINT = x ] &&
441 { skip_env "write_disjoint not found" && return; }
443 local clients=$CLIENTS
444 [ -z $clients ] && clients=$(hostname)
446 local num_clients=$(get_node_count ${clients//,/ })
449 # Need space estimation here.
451 generate_machine_file $clients $MACHINEFILE || return $?
453 print_opts WRITE_DISJOINT clients wdisjoint_THREADS wdisjoint_REP MACHINEFILE
454 local testdir=$DIR/d0.write_disjoint
456 # mpi_run uses mpiuser
459 local cmd="$WRITE_DISJOINT -f $testdir/file -n $wdisjoint_REP"
462 mpi_run -np $((num_clients * $wdisjoint_THREADS)) -machinefile ${MACHINEFILE} $cmd
465 if [ $rc != 0 ] ; then
466 error "write_disjoint failed! $rc"
470 run_test write_disjoint "write_disjoint"
472 test_parallel_grouplock() {
473 if [ "$NFSCLIENT" ]; then
474 skip "skipped for NFSCLIENT mode"
478 [ x$PARALLEL_GROUPLOCK = x ] &&
479 { skip "PARALLEL_GROUPLOCK not found" && return; }
481 local clients=$CLIENTS
482 [ -z $clients ] && clients=$(hostname)
484 local num_clients=$(get_node_count ${clients//,/ })
486 generate_machine_file $clients $MACHINEFILE || return $?
488 print_opts clients parallel_grouplock_MINTASKS MACHINEFILE
490 local testdir=$DIR/d0.parallel_grouplock
492 # mpi_run uses mpiuser
495 do_nodes $clients "lctl set_param llite.*.max_rw_chunk=0" ||
496 error "set_param max_rw_chunk=0 failed "
501 for i in $(seq 12); do
503 local cmd="$PARALLEL_GROUPLOCK -g -v -d $testdir $subtest"
506 mpi_run -np $parallel_grouplock_MINTASKS -machinefile ${MACHINEFILE} $cmd
508 if [ $rc != 0 ] ; then
509 error_noexit "parallel_grouplock subtests $subtest failed! $rc"
511 echo "parallel_grouplock subtests $subtest PASS"
513 let status=$((status + rc))
514 # clear debug to collect one log per one test
515 do_nodes $(comma_list $(nodes_list)) lctl clear
517 [ $status -eq 0 ] || error "parallel_grouplock status: $status"
520 run_test parallel_grouplock "parallel_grouplock"
522 statahead_NUMMNTPTS=${statahead_NUMMNTPTS:-5}
523 statahead_NUMFILES=${statahead_NUMFILES:-500000}
525 cleanup_statahead () {
532 for i in $(seq 0 $num_mntpts);do
533 zconf_umount_clients $clients ${mntpt_root}$i ||
534 error_exit "Failed to umount lustre on ${mntpt_root}$i"
539 if [ "$NFSCLIENT" ]; then
540 skip "skipped for NFSCLIENT mode"
545 { skip_env "mdsrate not found" && return; }
547 local clients=$CLIENTS
548 [ -z $clients ] && clients=$(hostname)
550 local num_clients=$(get_node_count ${clients//,/ })
552 generate_machine_file $clients $MACHINEFILE || return $?
554 print_opts MDSRATE clients statahead_NUMMNTPTS statahead_NUMFILES
558 # do not use default "d[0-9]*" dir name
559 # to avoid of rm $statahead_NUMFILES (500k) files in t-f cleanup
561 local testdir=$DIR/$dir
563 # cleanup only if dir exists
564 # cleanup only $statahead_NUMFILES number of files
565 # ignore the other files created by someone else
567 mdsrate_cleanup $((num_clients * 32)) $MACHINEFILE $statahead_NUMFILES $testdir 'f%%d' --ignore
570 # mpi_run uses mpiuser
573 local num_files=$statahead_NUMFILES
575 local IFree=$(inodes_available)
576 if [ $IFree -lt $num_files ]; then
582 local cmd="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir $testdir --nfiles $num_files --filefmt 'f%%d'"
585 mpi_run -np $((num_clients * 32)) -machinefile ${MACHINEFILE} $cmd
588 if [ $rc != 0 ] ; then
589 error "mdsrate failed to create $rc"
593 local num_mntpts=$statahead_NUMMNTPTS
594 local mntpt_root=$TMP/mntpt/lustre
595 local mntopts=${MNTOPTSTATAHEAD:-$MOUNTOPT}
597 echo "Mounting $num_mntpts lustre clients starts on $clients"
598 trap "cleanup_statahead $clients $mntpt_root $num_mntpts" EXIT ERR
599 for i in $(seq 0 $num_mntpts); do
600 zconf_mount_clients $clients ${mntpt_root}$i "$mntopts" ||
601 error_exit "Failed to mount lustre on ${mntpt_root}$i on $clients"
604 do_rpc_nodes $clients cancel_lru_locks mdc
606 do_rpc_nodes $clients do_ls $mntpt_root $num_mntpts $dir
608 mdsrate_cleanup $((num_clients * 32)) $MACHINEFILE $num_files $testdir 'f%%d' --ignore
610 # use rm instead of rmdir because of
611 # testdir could contain the files created by someone else,
612 # or by previous run where is num_files prev > num_files current
614 cleanup_statahead $clients $mntpt_root $num_mntpts
617 run_test statahead "statahead test, multiple clients"
619 complete $(basename $0) $SECONDS
620 check_and_cleanup_lustre