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"
16 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
17 clients=${CLIENTS:-$HOSTNAME}
18 generate_machine_file $clients $MACHINEFILE || return $?
19 num_clients=$(get_node_count ${clients//,/ })
24 cbench_DIR=${cbench_DIR:-""}
25 cbench_IDIRS=${cbench_IDIRS:-4}
26 # FIXME: wiki page requirements is 30, do we really need 30 ?
27 cbench_RUNS=${cbench_RUNS:-4}
29 if [ "$SLOW" = "no" ]; then
37 METABENCH=${METABENCH:-$(which metabench 2> /dev/null || true)}
38 mbench_NFILES=${mbench_NFILES:-30400}
39 [ "$SLOW" = "no" ] && mbench_NFILES=10000
41 mbench_THREADS=${mbench_THREADS:-4}
46 SIMUL=${SIMUL:=$(which simul 2> /dev/null || true)}
48 simul_THREADS=${simul_THREADS:-2}
49 simul_REP=${simul_REP:-20}
50 [ "$SLOW" = "no" ] && simul_REP=2
55 MIB=${MIB:=$(which mib 2> /dev/null || true)}
57 mib_THREADS=${mib_THREADS:-2}
58 mib_xferSize=${mib_xferSize:-1m}
59 mib_xferLimit=${mib_xferLimit:-5000}
60 mib_timeLimit=${mib_timeLimit:-300}
65 MDTEST=${MDTEST:=$(which mdtest 2> /dev/null || true)}
67 mdtest_THREADS=${mdtest_THREADS:-2}
68 mdtest_nFiles=${mdtest_nFiles:-"100000"}
69 # We devide the files by number of core
70 mdtest_nFiles=$((mdtest_nFiles/mdtest_THREADS/num_clients))
71 mdtest_iteration=${mdtest_iteration:-1}
76 cnt_DIR=${cnt_DIR:-""}
77 cnt_NRUN=${cnt_NRUN:-10}
78 [ "$SLOW" = "no" ] && cnt_NRUN=2
83 CASC_RW=${CASC_RW:-$(which cascading_rw 2> /dev/null || true)}
85 casc_THREADS=${casc_THREADS:-2}
86 casc_REP=${casc_REP:-300}
87 [ "$SLOW" = "no" ] && casc_REP=10
92 IOR=${IOR:-$(which IOR 2> /dev/null || true)}
94 ior_THREADS=${ior_THREADS:-2}
95 ior_iteration=${ior_iteration:-1}
96 ior_blockSize=${ior_blockSize:-6} # Gb
97 ior_xferSize=${ior_xferSize:-2m}
98 ior_type=${ior_type:-POSIX}
99 ior_DURATION=${ior_DURATION:-30} # minutes
100 [ "$SLOW" = "no" ] && ior_DURATION=5
103 # write_append_truncate
106 write_THREADS=${write_THREADS:-8}
107 write_REP=${write_REP:-10000}
108 [ "$SLOW" = "no" ] && write_REP=100
113 WRITE_DISJOINT=${WRITE_DISJOINT:-$(which write_disjoint 2> /dev/null || true)}
115 wdisjoint_THREADS=${wdisjoint_THREADS:-4}
116 wdisjoint_REP=${wdisjoint_REP:-10000}
117 [ "$SLOW" = "no" ] && wdisjoint_REP=100
123 PARALLEL_GROUPLOCK=${PARALLEL_GROUPLOCK:-\
124 $(which parallel_grouplock 2> /dev/null || true)}
125 parallel_grouplock_MINTASKS=${parallel_grouplock_MINTASKS:-5}
128 check_and_setup_lustre
137 echo "${var}=${!var}"
139 [ -e $MACHINEFILE ] && cat $MACHINEFILE
143 # 5 min * cbench_RUNS
147 # compile dir kernel-1 680MB
148 # required space 680MB * cbench_IDIRS = ~7 Gb
150 test_compilebench() {
151 print_opts cbench_DIR cbench_IDIRS cbench_RUNS
153 [ x$cbench_DIR = x ] &&
154 { skip_env "compilebench not found" && return; }
156 [ -e $cbench_DIR/compilebench ] || \
157 { skip_env "No compilebench build" && return; }
159 local space=$(df -P $DIR | tail -n 1 | awk '{ print $4 }')
160 if [ $space -le $((680 * 1024 * cbench_IDIRS)) ]; then
161 cbench_IDIRS=$(( space / 680 / 1024))
162 [ $cbench_IDIRS = 0 ] && \
163 skip_env "Need free space atleast 680 Mb, have $space" && return
165 log free space=$space, reducing initial dirs to $cbench_IDIRS
168 # t-f _base needs to be modifyed to set properly tdir
169 # for new "test_foo" functions names
170 # local testdir=$DIR/$tdir
171 local testdir=$DIR/d0.compilebench
176 local cmd="./compilebench -D $testdir -i $cbench_IDIRS \
177 -r $cbench_RUNS --makej"
186 [ $rc = 0 ] || error "compilebench failed: $rc"
189 run_test compilebench "compilebench"
192 [ x$METABENCH = x ] &&
193 { skip_env "metabench not found" && return; }
196 # Need space estimation here.
198 print_opts METABENCH clients mbench_NFILES mbench_THREADS
200 local testdir=$DIR/d0.metabench
202 # mpi_run uses mpiuser
205 # -C Run the file creation tests.
206 # -S Run the file stat tests.
207 # -c nfile Number of files to be used in each test.
208 # -k Cleanup. Remove the test directories.
209 local cmd="$METABENCH -w $testdir -c $mbench_NFILES -C -S -k"
212 # find out if we need to use srun by checking $SRUN_PARTITION
213 if [ "$SRUN_PARTITION" ]; then
214 $SRUN $SRUN_OPTIONS -D $testdir -w $clients -N $num_clients \
215 -n $((num_clients * mbench_THREADS)) -p $SRUN_PARTITION -- $cmd
217 mpi_run -np $((num_clients * $mbench_THREADS)) \
218 -machinefile ${MACHINEFILE} $cmd
222 if [ $rc != 0 ] ; then
223 error "metabench failed! $rc"
227 run_test metabench "metabench"
230 if [ "$NFSCLIENT" ]; then
231 skip "skipped for NFSCLIENT mode"
236 { skip_env "simul not found" && return; }
239 # Need space estimation here.
241 print_opts SIMUL clients simul_REP simul_THREADS
243 local testdir=$DIR/d0.simul
245 # mpi_run uses mpiuser
248 # -n # : repeat each test # times
249 # -N # : repeat the entire set of tests # times
251 local cmd="$SIMUL -d $testdir -n $simul_REP -N $simul_REP"
255 # find out if we need to use srun by checking $SRUN_PARTITION
256 if [ "$SRUN_PARTITION" ]; then
257 $SRUN $SRUN_OPTIONS -D $testdir -w $clients -N $num_clients \
258 -n $((num_clients * simul_THREADS)) -p $SRUN_PARTITION -- $cmd
260 mpi_run -np $((num_clients * $simul_THREADS)) \
261 -machinefile ${MACHINEFILE} $cmd
265 if [ $rc != 0 ] ; then
266 error "simul failed! $rc"
270 run_test simul "simul"
273 local type=${1:-"ssf"}
275 if [ "$NFSCLIENT" ]; then
276 skip "skipped for NFSCLIENT mode"
281 { skip_env "mdtest not found" && return; }
284 # Need space estimation here.
286 print_opts MDTEST mdtest_iteration mdtest_THREADS mdtest_nFiles
288 local testdir=$DIR/d0.mdtest
290 # mpi_run uses mpiuser
293 # -i # : repeat each test # times
295 # -n # : number of file/dir to create/stat/remove
296 # -u : each process create/stat/remove individually
298 local cmd="$MDTEST -d $testdir -i $mdtest_iteration -n $mdtest_nFiles"
299 [ $type = "fpp" ] && cmd="$cmd -u"
302 # find out if we need to use srun by checking $SRUN_PARTITION
303 if [ "$SRUN_PARTITION" ]; then
304 $SRUN $SRUN_OPTIONS -D $testdir -w $clients -N $num_clients \
305 -n $((num_clients * mdtest_THREADS)) -p $SRUN_PARTITION -- $cmd
307 mpi_run -np $((num_clients * mdtest_THREADS)) \
308 -machinefile ${MACHINEFILE} $cmd
312 if [ $rc != 0 ] ; then
313 error "mdtest failed! $rc"
321 run_test mdtestssf "mdtestssf"
326 run_test mdtestfpp "mdtestfpp"
328 test_connectathon() {
329 print_opts cnt_DIR cnt_NRUN
332 { skip_env "connectathon dir not found" && return; }
334 [ -e $cnt_DIR/runtests ] || \
335 { skip_env "No connectathon runtests found" && return; }
337 local testdir=$DIR/d0.connectathon
344 # cthon options (must be in this order)
346 # -N numpasses - will be passed to the runtests script. This argument
347 # is optional. It specifies the number of times to run
350 # One of these test types
355 # -a all of the above
357 # -f a quick functionality test
361 # Include lock tests unless we're running on nfsv4
362 local fstype=$(df -TP $testdir | awk 'NR==2 {print $2}')
363 echo "$testdir: $fstype"
364 if [[ $fstype != "nfs4" ]]; then
368 for test in $tests; do
369 local cmd="./runtests -N $cnt_NRUN $test -f $testdir"
375 [ $rc = 0 ] || error "connectathon failed: $rc"
381 run_test connectathon "connectathon"
384 local type=${1:="ssf"}
387 { skip_env "IOR not found" && return; }
389 local space=$(df -P $DIR | tail -n 1 | awk '{ print $4 }')
390 local total_threads=$(( num_clients * ior_THREADS ))
391 echo "+ $ior_blockSize * 1024 * 1024 * $total_threads "
392 if [ $((space / 2)) -le \
393 $(( ior_blockSize * 1024 * 1024 * total_threads)) ]; then
394 echo "+ $space * 9/10 / 1024 / 1024 / $num_clients / $ior_THREADS"
395 ior_blockSize=$(( space /2 /1024 /1024 / num_clients / ior_THREADS ))
396 [ $ior_blockSize = 0 ] && \
397 skip_env "Need free space more than $((2 * total_threads))GB: \
398 $((total_threads *1024 *1024*2)), have $space" && return
400 local reduced_size="$num_clients x $ior_THREADS x $ior_blockSize"
401 echo "free space=$space, Need: $reduced_size GB"
402 echo "(blockSize reduced to $ior_blockSize GB)"
405 print_opts IOR ior_THREADS ior_DURATION MACHINEFILE
407 local testdir=$DIR/d0.ior
409 # mpi_run uses mpiuser
411 if [ "$NFSCLIENT" ]; then
412 setstripe_nfsserver $testdir -c -1 ||
413 { error "setstripe on nfsserver failed" && return 1; }
415 $LFS setstripe $testdir -c -1 ||
416 { error "setstripe failed" && return 2; }
420 # contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g)"
422 # -t N transferSize -- size of transfer in bytes (e.g.: 8, 4k, 2m, 1g)"
423 # -w writeFile -- write file"
424 # -r readFile -- read existing file"
425 # -T maxTimeDuration -- max time in minutes to run tests"
426 # -k keepFile -- keep testFile(s) on program exit
428 local cmd="$IOR -a $ior_type -b ${ior_blockSize}g -o $testdir/iorData \
429 -t $ior_xferSize -v -w -r -i $ior_iteration -T $ior_DURATION -k"
430 [ $type = "fpp" ] && cmd="$cmd -F"
434 # find out if we need to use srun by checking $SRUN_PARTITION
435 if [ "$SRUN_PARTITION" ]; then
436 $SRUN $SRUN_OPTIONS -D $testdir -w $clients -N $num_clients \
437 -n $((num_clients * ior_THREADS)) -p $SRUN_PARTITION -- $cmd
439 mpi_run -np $((num_clients * $ior_THREADS)) \
440 -machinefile ${MACHINEFILE} $cmd
444 if [ $rc != 0 ] ; then
445 error "ior failed! $rc"
453 run_test iorssf "iorssf"
458 run_test iorfpp "iorfpp"
461 if [ "$NFSCLIENT" ]; then
462 skip "skipped for NFSCLIENT mode"
467 { skip_env "MIB not found" && return; }
469 print_opts MIB mib_THREADS mib_xferSize mib_xferLimit mib_timeLimit \
472 local testdir=$DIR/d0.mib
474 # mpi_run uses mpiuser
476 $LFS setstripe $testdir -c -1 ||
477 { error "setstripe failed" && return 2; }
479 # -I Show intermediate values in output
480 # -H Show headers in output
481 # -L Do not issue new system calls after this many seconds
482 # -s Use system calls of this size
484 # -l Issue no more than this many system calls
485 local cmd="$MIB -t $testdir -s $mib_xferSize -l $mib_xferLimit \
486 -L $mib_timeLimit -HI -p mib.$(date +%Y%m%d%H%M%S)"
489 # find out if we need to use srun by checking $SRUN_PARTITION
490 if [ "$SRUN_PARTITION" ]; then
491 $SRUN $SRUN_OPTIONS -D $testdir -w $clients -N $num_clients \
492 -n $((num_clients * mib_THREADS)) -p $SRUN_PARTITION -- $cmd
494 mpi_run -np $((num_clients * mib_THREADS)) \
495 -machinefile ${MACHINEFILE} $cmd
499 if [ $rc != 0 ] ; then
500 error "mib failed! $rc"
506 test_cascading_rw() {
507 if [ "$NFSCLIENT" ]; then
508 skip "skipped for NFSCLIENT mode"
513 { skip_env "cascading_rw not found" && return; }
516 # Need space estimation here.
518 print_opts CASC_RW clients casc_THREADS casc_REP MACHINEFILE
520 local testdir=$DIR/d0.cascading_rw
522 # mpi_run uses mpiuser
526 # -n: repeat test # times
528 local cmd="$CASC_RW -g -d $testdir -n $casc_REP"
531 mpi_run -np $((num_clients * $casc_THREADS)) \
532 -machinefile ${MACHINEFILE} $cmd
535 if [ $rc != 0 ] ; then
536 error "cascading_rw failed! $rc"
540 run_test cascading_rw "cascading_rw"
542 test_write_append_truncate() {
543 if [ "$NFSCLIENT" ]; then
544 skip "skipped for NFSCLIENT mode"
548 # location is lustre/tests dir
549 if ! which write_append_truncate > /dev/null 2>&1 ; then
550 skip_env "write_append_truncate not found"
555 # Need space estimation here.
557 local testdir=$DIR/d0.write_append_truncate
558 local file=$testdir/f0.wat
560 print_opts clients write_REP write_THREADS MACHINEFILE
563 # mpi_run uses mpiuser
566 local cmd="write_append_truncate -n $write_REP $file"
569 mpi_run -np $((num_clients * $write_THREADS)) \
570 -machinefile ${MACHINEFILE} $cmd
573 if [ $rc != 0 ] ; then
574 error "write_append_truncate failed! $rc"
579 run_test write_append_truncate "write_append_truncate"
581 test_write_disjoint() {
582 if [ "$NFSCLIENT" ]; then
583 skip "skipped for NFSCLIENT mode"
587 [ x$WRITE_DISJOINT = x ] &&
588 { skip_env "write_disjoint not found" && return; }
591 # Need space estimation here.
593 print_opts WRITE_DISJOINT clients wdisjoint_THREADS wdisjoint_REP \
595 local testdir=$DIR/d0.write_disjoint
597 # mpi_run uses mpiuser
600 local cmd="$WRITE_DISJOINT -f $testdir/file -n $wdisjoint_REP"
603 mpi_run -np $((num_clients * $wdisjoint_THREADS)) \
604 -machinefile ${MACHINEFILE} $cmd
607 if [ $rc != 0 ] ; then
608 error "write_disjoint failed! $rc"
612 run_test write_disjoint "write_disjoint"
614 test_parallel_grouplock() {
615 if [ "$NFSCLIENT" ]; then
616 skip "skipped for NFSCLIENT mode"
620 [ x$PARALLEL_GROUPLOCK = x ] &&
621 { skip "PARALLEL_GROUPLOCK not found" && return; }
623 print_opts clients parallel_grouplock_MINTASKS MACHINEFILE
625 local testdir=$DIR/d0.parallel_grouplock
627 # mpi_run uses mpiuser
630 do_nodes $clients "lctl set_param llite.*.max_rw_chunk=0" ||
631 error "set_param max_rw_chunk=0 failed "
636 for i in $(seq 12); do
638 local cmd="$PARALLEL_GROUPLOCK -g -v -d $testdir $subtest"
641 mpi_run -np $parallel_grouplock_MINTASKS \
642 -machinefile ${MACHINEFILE} $cmd
644 if [ $rc != 0 ] ; then
645 error_noexit "parallel_grouplock subtests $subtest failed! $rc"
647 echo "parallel_grouplock subtests $subtest PASS"
649 let status=$((status + rc))
650 # clear debug to collect one log per one test
651 do_nodes $(comma_list $(nodes_list)) lctl clear
653 [ $status -eq 0 ] || error "parallel_grouplock status: $status"
656 run_test parallel_grouplock "parallel_grouplock"
658 statahead_NUMMNTPTS=${statahead_NUMMNTPTS:-5}
659 statahead_NUMFILES=${statahead_NUMFILES:-500000}
661 cleanup_statahead () {
668 for i in $(seq 0 $num_mntpts);do
669 zconf_umount_clients $clients ${mntpt_root}$i ||
670 error_exit "Failed to umount lustre on ${mntpt_root}$i"
675 if [ "$NFSCLIENT" ]; then
676 skip "skipped for NFSCLIENT mode"
681 { skip_env "mdsrate not found" && return; }
683 print_opts MDSRATE clients statahead_NUMMNTPTS statahead_NUMFILES
687 # do not use default "d[0-9]*" dir name
688 # to avoid of rm $statahead_NUMFILES (500k) files in t-f cleanup
690 local testdir=$DIR/$dir
692 # cleanup only if dir exists
693 # cleanup only $statahead_NUMFILES number of files
694 # ignore the other files created by someone else
696 mdsrate_cleanup $((num_clients * 32)) $MACHINEFILE \
697 $statahead_NUMFILES $testdir 'f%%d' --ignore
700 # mpi_run uses mpiuser
703 local num_files=$statahead_NUMFILES
705 local IFree=$(inodes_available)
706 if [ $IFree -lt $num_files ]; then
712 local cmd1="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir $testdir"
713 local cmd2="--nfiles $num_files --filefmt 'f%%d'"
714 local cmd="$cmd1 $cmd2"
717 mpi_run -np $((num_clients * 32)) -machinefile ${MACHINEFILE} $cmd
720 if [ $rc != 0 ] ; then
721 error "mdsrate failed to create $rc"
725 local num_mntpts=$statahead_NUMMNTPTS
726 local mntpt_root=$TMP/mntpt/lustre
727 local mntopts=${MNTOPTSTATAHEAD:-$MOUNTOPT}
729 echo "Mounting $num_mntpts lustre clients starts on $clients"
730 trap "cleanup_statahead $clients $mntpt_root $num_mntpts" EXIT ERR
731 for i in $(seq 0 $num_mntpts); do
732 zconf_mount_clients $clients ${mntpt_root}$i "$mntopts" ||
733 error_exit "Failed to mount lustre on ${mntpt_root}$i on $clients"
736 do_rpc_nodes $clients cancel_lru_locks mdc
738 do_rpc_nodes $clients do_ls $mntpt_root $num_mntpts $dir
740 mdsrate_cleanup $((num_clients * 32)) $MACHINEFILE \
741 $num_files $testdir 'f%%d' --ignore
743 # use rm instead of rmdir because of
744 # testdir could contain the files created by someone else,
745 # or by previous run where is num_files prev > num_files current
747 cleanup_statahead $clients $mntpt_root $num_mntpts
749 run_test statahead "statahead test, multiple clients"
751 # bug 17764 accessing files via nfs,
752 # ASSERTION(!mds_inode_is_orphan(dchild->d_inode)) failed
753 test_nfsread_orphan_file() {
754 if [ ! "$NFSCLIENT" ]; then
755 skip "not NFSCLIENT mode, skipped"
759 # copy file to lustre server
760 local nfsserver=$(nfs_server $MOUNT)
761 do_nodev $nfsserver cp /etc/passwd $DIR/$tfile
762 zconf_mount $nfsserver $MOUNT2
764 # open, wait, unlink and close
765 rmultiop_start --uniq unlink $nfsserver $DIR/$tfile o_uc
766 echo "1. unlinker on NFS server $nfsserver opened the file $DIR/$tfile"
769 # open $DIR2/$tfile and wait
770 rmultiop_start --uniq open $nfsserver $DIR2/$tfile o_c
771 echo "2. open on NFS server $nfsserver opened the file $DIR2/$tfile"
774 # open $DIR/$tfile on nfs client, wait, read
775 multiop_bg_pause $DIR/$tfile o_r10c
777 echo "3. NFS client readder opened the file $DIR/$tfile"
781 rmultiop_stop --uniq unlink $nfsserver
782 echo "4. unlink, close completed"
786 kill -USR1 $NFSREADPID
787 echo "5. NFS client read completed"
791 rmultiop_stop --uniq open $nfsserver
792 zconf_umount $nfsserver $MOUNT2
794 run_test nfsread_orphan_file "accessing files via nfs, bug 17764"
796 complete $(basename $0) $SECONDS
797 check_and_cleanup_lustre