3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
6 # e.g. ONLY="22 23" or ONLY="`seq 32 39`" or EXCEPT="31"
10 # bug number for skipped test: 1979
11 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"42b"}
12 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
15 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
17 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
18 CREATETEST=${CREATETEST:-createtest}
20 LSTRIPE=${LSTRIPE:-lstripe}
22 MCREATE=${MCREATE:-mcreate}
23 OPENFILE=${OPENFILE:-openfile}
24 OPENUNLINK=${OPENUNLINK:-openunlink}
25 TOEXCL=${TOEXCL:-toexcl}
26 TRUNCATE=${TRUNCATE:-truncate}
27 MUNLINK=${MUNLINK:-munlink}
28 SOCKETSERVER=${SOCKETSERVER:-socketserver}
29 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
31 if [ $UID -ne 0 ]; then
35 RUNAS_ID=${RUNAS_ID:-500}
36 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
39 export NAME=${NAME:-local}
45 sh llmountcleanup.sh > /dev/null || exit 20
52 sh llrmount.sh > /dev/null || exit 10
60 lctl mark "$*" 2> /dev/null || true
64 if ! mount | grep -q $DIR; then
68 test_$1 || error "test_$1: $?"
78 for E in $EXCEPT $ALWAYS_EXCEPT; do
88 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
95 if [ ${!testname}x != x ]; then
100 if [ ${!testname}x != x ]; then
108 if [ ${!testname}x != x ]; then
109 echo "skipping excluded test $1"
112 testname=EXCEPT_$base
113 if [ ${!testname}x != x ]; then
114 echo "skipping excluded test $1 (base $base)"
121 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
125 if [ "$SANITYLOG" ]; then
126 echo "FAIL: $@" >> $SANITYLOG
136 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
137 if [ -z "$MOUNT" ]; then
139 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
140 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
144 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
147 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
149 LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
150 STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
152 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
153 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
154 rm -rf $DIR/[Rdfs][1-9]*
158 echo preparing for tests involving mounts
159 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
161 mke2fs -F $EXT2_DEV 1000 > /dev/null
165 $CHECKSTAT -t file $DIR/f || error
167 $CHECKSTAT -a $DIR/f || error
169 run_test 0 "touch .../f ; rm .../f ============================="
174 $CHECKSTAT -t dir $DIR/d1/d2 || error
176 run_test 1a "mkdir .../d1; mkdir .../d1/d2 ====================="
181 $CHECKSTAT -a $DIR/d1 || error
183 run_test 1b "rmdir .../d1/d2; rmdir .../d1 ====================="
188 $CHECKSTAT -t file $DIR/d2/f || error
190 run_test 2a "mkdir .../d2; touch .../d2/f ======================"
194 $CHECKSTAT -a $DIR/d2 || error
196 run_test 2b "rm -r .../d2; checkstat .../d2/f ======================"
200 $CHECKSTAT -t dir $DIR/d3 || error
202 run_test 3a "mkdir .../d3 ======================================"
205 if [ ! -d $DIR/d3 ]; then
209 $CHECKSTAT -t file $DIR/d3/f || error
211 run_test 3b "touch .../d3/f ===================================="
215 $CHECKSTAT -a $DIR/d3 || error
217 run_test 3c "rm -r .../d3 ======================================"
221 $CHECKSTAT -t dir $DIR/d4 || error
223 run_test 4a "mkdir .../d4 ======================================"
226 if [ ! -d $DIR/d4 ]; then
230 $CHECKSTAT -t dir $DIR/d4/d2 || error
232 run_test 4b "mkdir .../d4/d2 ==================================="
237 chmod 0707 $DIR/d5/d2
238 $CHECKSTAT -t dir -p 0707 $DIR/d5/d2 || error
240 run_test 5 "mkdir .../d5 .../d5/d2; chmod .../d5/d2 ============"
244 chmod 0666 $DIR/f6a || error
245 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
247 run_test 6a "touch .../f6a; chmod .../f6a ======================"
250 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6b" && return
251 if [ ! -f $DIR/f6a ]; then
255 $RUNAS chmod 0444 $DIR/f6a && error
256 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
258 run_test 6b "$RUNAS chmod .../f6a (should return error) =="
261 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6c" && return
263 chown $RUNAS_ID $DIR/f6c || error
264 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
266 run_test 6c "touch .../f6c; chown .../f6c ======================"
269 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6d" && return
270 if [ ! -f $DIR/f6c ]; then
272 chown $RUNAS_ID $DIR/f6c
274 $RUNAS chown $UID $DIR/f6c && error
275 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
277 run_test 6d "$RUNAS chown .../f6c (should return error) =="
280 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6e" && return
282 chgrp $RUNAS_ID $DIR/f6e || error
283 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
285 run_test 6e "touch .../f6e; chgrp .../f6e ======================"
288 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6f" && return
289 if [ ! -f $DIR/f6e ]; then
291 chgrp $RUNAS_ID $DIR/f6e
293 $RUNAS chgrp $UID $DIR/f6e && error
294 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
296 run_test 6f "$RUNAS chgrp .../f6e (should return error) =="
299 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6g" && return
300 mkdir $DIR/d6g || error
301 chmod 777 $DIR/d6g || error
302 $RUNAS mkdir $DIR/d6g/d || error
303 chmod g+s $DIR/d6g/d || error
304 mkdir $DIR/d6g/d/subdir
305 $CHECKSTAT -g \#$RUNAS_ID $DIR/d6g/d/subdir || error
307 run_test 6g "Is new dir in sgid dir inheriting group?"
313 $CHECKSTAT -t file -p 0666 $DIR/d7/f || error
315 run_test 7a "mkdir .../d7; mcreate .../d7/f; chmod .../d7/f ===="
318 if [ ! -d $DIR/d7 ]; then
322 echo -n foo > $DIR/d7/f2
323 [ "`cat $DIR/d7/f2`" = "foo" ] || error
324 $CHECKSTAT -t file -s 3 $DIR/d7/f2 || error
326 run_test 7b "mkdir .../d7; mcreate d7/f2; echo foo > d7/f2 ====="
332 $CHECKSTAT -t file -p 0666 $DIR/d8/f || error
334 run_test 8 "mkdir .../d8; touch .../d8/f; chmod .../d8/f ======="
340 $CHECKSTAT -t dir $DIR/d9/d2/d3 || error
342 run_test 9 "mkdir .../d9 .../d9/d2 .../d9/d2/d3 ================"
348 $CHECKSTAT -t file $DIR/d10/d2/f || error
350 run_test 10 "mkdir .../d10 .../d10/d2; touch .../d10/d2/f ======"
355 chmod 0666 $DIR/d11/d2
356 chmod 0705 $DIR/d11/d2
357 $CHECKSTAT -t dir -p 0705 $DIR/d11/d2 || error
359 run_test 11 "mkdir .../d11 d11/d2; chmod .../d11/d2 ============"
364 chmod 0666 $DIR/d12/f
365 chmod 0654 $DIR/d12/f
366 $CHECKSTAT -t file -p 0654 $DIR/d12/f || error
368 run_test 12 "touch .../d12/f; chmod .../d12/f .../d12/f ========"
372 dd if=/dev/zero of=$DIR/d13/f count=10
374 $CHECKSTAT -t file -s 0 $DIR/d13/f || error
376 run_test 13 "creat .../d13/f; dd .../d13/f; > .../d13/f ========"
382 $CHECKSTAT -a $DIR/d14/f || error
384 run_test 14 "touch .../d14/f; rm .../d14/f; rm .../d14/f ======="
389 mv $DIR/d15/f $DIR/d15/f2
390 $CHECKSTAT -t file $DIR/d15/f2 || error
392 run_test 15 "touch .../d15/f; mv .../d15/f .../d15/f2 =========="
398 $CHECKSTAT -a $DIR/d16/f || error
400 run_test 16 "touch .../d16/f; rm -rf .../d16/f ================="
405 ln -s $DIR/d17/f $DIR/d17/l-exist
407 $CHECKSTAT -l $DIR/d17/f $DIR/d17/l-exist || error
408 $CHECKSTAT -f -t f $DIR/d17/l-exist || error
410 $CHECKSTAT -a $DIR/l-exist || error
412 run_test 17a "symlinks: create, remove (real) =================="
415 if [ ! -d $DIR/d17 ]; then
418 ln -s no-such-file $DIR/d17/l-dangle
420 $CHECKSTAT -l no-such-file $DIR/d17/l-dangle || error
421 $CHECKSTAT -fa $DIR/d17/l-dangle || error
423 $CHECKSTAT -a $DIR/l-dangle || error
425 run_test 17b "symlinks: create, remove (dangling) =============="
431 run_test 18 "touch .../f ; ls ... =============================="
437 $CHECKSTAT -a $DIR/f19 || error
439 run_test 19a "touch .../f19 ; ls -l ... ; rm .../f19 ==========="
442 ls -l $DIR/f19 && error || true
444 run_test 19b "ls -l .../f19 (should return error) =============="
447 [ $RUNAS_ID -eq $UID ] && echo "skipping test 19c" && return
448 $RUNAS touch $DIR/f19 && error || true
450 run_test 19c "$RUNAS touch .../f19 (should return error) =="
453 cat $DIR/f19 && error || true
455 run_test 19d "cat .../f19 (should return error) =============="
467 $CHECKSTAT -a $DIR/f || error
469 run_test 20 "touch .../f ; ls -l ... ==========================="
473 [ -f $DIR/d21/dangle ] && rm -f $DIR/d21/dangle
474 ln -s dangle $DIR/d21/link
475 echo foo >> $DIR/d21/link
477 $CHECKSTAT -t link $DIR/d21/link || error
478 $CHECKSTAT -f -t file $DIR/d21/link || error
480 run_test 21 "write to dangling link ============================"
484 chown $RUNAS_ID $DIR/d22
485 # Tar gets pissy if it can't access $PWD *sigh*
487 $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
488 $RUNAS tar xfC - $DIR/d22)
490 $CHECKSTAT -t dir $DIR/d22/etc || error
491 $CHECKSTAT -u \#$RUNAS_ID $DIR/d22/etc || error
493 run_test 22 "unpack tar archive as non-root user ==============="
498 $TOEXCL -e $DIR/d23/f23 || error
500 run_test 23 "O_CREAT|O_EXCL in subdir =========================="
503 echo '== rename sanity =============================================='
504 echo '-- same directory rename'
507 mv $DIR/R1/f $DIR/R1/g
508 $CHECKSTAT -t file $DIR/R1/g || error
510 run_test 24a "touch .../R1/f; rename .../R1/f .../R1/g ========="
515 mv $DIR/R2/f $DIR/R2/g
516 $CHECKSTAT -a $DIR/R2/f || error
517 $CHECKSTAT -t file $DIR/R2/g || error
519 run_test 24b "touch .../R2/{f,g}; rename .../R2/f .../R2/g ====="
524 mv $DIR/R3/f $DIR/R3/g
525 $CHECKSTAT -a $DIR/R3/f || error
526 $CHECKSTAT -t dir $DIR/R3/g || error
528 run_test 24c "mkdir .../R3/f; rename .../R3/f .../R3/g ========="
533 perl -e "rename \"$DIR/R4/f\", \"$DIR/R4/g\";"
534 $CHECKSTAT -a $DIR/R4/f || error
535 $CHECKSTAT -t dir $DIR/R4/g || error
537 run_test 24d "mkdir .../R4/{f,g}; rename .../R4/f .../R4/g ====="
540 echo '-- cross directory renames --'
543 mv $DIR/R5a/f $DIR/R5b/g
544 $CHECKSTAT -a $DIR/R5a/f || error
545 $CHECKSTAT -t file $DIR/R5b/g || error
547 run_test 24e "touch .../R5a/f; rename .../R5a/f .../R5b/g ======"
551 touch $DIR/R6a/f $DIR/R6b/g
552 mv $DIR/R6a/f $DIR/R6b/g
553 $CHECKSTAT -a $DIR/R6a/f || error
554 $CHECKSTAT -t file $DIR/R6b/g || error
556 run_test 24f "touch .../R6a/f R6b/g; mv .../R6a/f .../R6b/g ===="
561 mv $DIR/R7a/d $DIR/R7b/e
562 $CHECKSTAT -a $DIR/R7a/d || error
563 $CHECKSTAT -t dir $DIR/R7b/e || error
565 run_test 24g "mkdir .../R7a/d; rename .../R7a/d .../R5b/e ======"
569 mkdir $DIR/R8a/d $DIR/R8b/e
570 perl -e "rename \"$DIR/R8a/d\", \"$DIR/R8b/e\";"
571 $CHECKSTAT -a $DIR/R8a/d || error
572 $CHECKSTAT -t dir $DIR/R8b/e || error
574 run_test 24h "mkdir .../R8{a,b} R8a/{d,e}; mv .../R8a/d .../R8b/e"
577 echo "-- rename error cases"
581 perl -e "rename \"$DIR/R9/f\", \"$DIR/R9/a\";"
582 $CHECKSTAT -t file $DIR/R9/f || error
583 $CHECKSTAT -t dir $DIR/R9/a || error
584 $CHECKSTAT -a file $DIR/R9/a/f || error
586 run_test 24i "rename file to dir error: touch f ; mkdir a ; rename f a"
590 perl -e "rename \"$DIR/R10/f\", \"$DIR/R10/g\""
591 $CHECKSTAT -t dir $DIR/R10 || error
592 $CHECKSTAT -a $DIR/R10/f || error
593 $CHECKSTAT -a $DIR/R10/g || error
595 run_test 24j "source does not exist ============================"
598 mkdir $DIR/R11a $DIR/R11a/d
600 mv $DIR/R11a/f $DIR/R11a/d
601 $CHECKSTAT -a $DIR/R11a/f || error
602 $CHECKSTAT -t file $DIR/R11a/d/f || error
604 run_test 24k "touch .../R11a/f; mv .../R11a/f .../R11a/d ======="
607 echo '== symlink sanity ============================================='
610 touch $DIR/s25/foo || error
612 run_test 25a "create file in symlinked directory ==============="
615 if [ ! -d $DIR/d25 ]; then
618 $CHECKSTAT -t file $DIR/s25/foo || error
620 run_test 25b "lookup file in symlinked directory ==============="
625 ln -s d26/d26-2 $DIR/s26
626 touch $DIR/s26/foo || error
628 run_test 26a "multiple component symlink ======================="
631 mkdir -p $DIR/d26b/d26-2
632 ln -s d26b/d26-2/foo $DIR/s26-2
633 touch $DIR/s26-2 || error
635 run_test 26b "multiple component symlink at end of lookup ======"
640 ln -s d26.2 $DIR/s26.2-1
641 ln -s s26.2-1 $DIR/s26.2-2
642 ln -s s26.2-2 $DIR/s26.2-3
643 chmod 0666 $DIR/s26.2-3/foo
645 run_test 26c "chain of symlinks ================================"
647 # recursive symlinks (bug 439)
649 ln -s d26-3/foo $DIR/d26-3
651 run_test 26d "create multiple component recursive symlink ======"
654 if [ ! -h $DIR/d26-3 ]; then
659 run_test 26e "unlink multiple component recursive symlink ======"
662 echo '== stripe sanity =============================================='
664 $LSTRIPE $DIR/d27/f0 8192 0 1 || error
665 $CHECKSTAT -t file $DIR/d27/f0 || error
667 log "== test_27b: write to one stripe file ========================="
668 cp /etc/hosts $DIR/d27/f0 || error
670 run_test 27a "one stripe file =================================="
673 [ "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
674 if [ ! -d $DIR/d27 ]; then
677 $LSTRIPE $DIR/d27/f01 8192 0 2 || error
678 [ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
679 error "two-stripe file doesn't have two stripes"
681 log "== test_27d: write to two stripe file file f01 ================"
682 dd if=/dev/zero of=$DIR/d27/f01 bs=4k count=4 || error
684 run_test 27c "create two stripe file f01 ======================="
687 if [ ! -d $DIR/d27 ]; then
690 $LSTRIPE $DIR/d27/fdef 0 -1 0 || error
691 $CHECKSTAT -t file $DIR/d27/fdef || error
692 #dd if=/dev/zero of=$DIR/d27/fdef bs=4k count=4 || error
694 run_test 27d "create file with default settings ================"
697 if [ ! -d $DIR/d27 ]; then
700 $LSTRIPE $DIR/d27/f12 8192 1 2 || error
701 $LSTRIPE $DIR/d27/f12 8192 1 2 && error
702 $CHECKSTAT -t file $DIR/d27/f12 || error
704 run_test 27e "lstripe existing file (should return error) ======"
707 if [ ! -d $DIR/d27 ]; then
710 $LSTRIPE $DIR/d27/fbad 100 1 1 && error
711 dd if=/dev/zero of=$DIR/d27/f12 bs=4k count=4 || error
712 $LFIND $DIR/d27/fbad || error
714 run_test 27f "lstripe with bad stripe size (should return error)"
717 if [ ! -d $DIR/d27 ]; then
720 $MCREATE $DIR/d27/fnone || error
722 log "== test 27h: lfind with no objects ============================"
723 $LFIND $DIR/d27/fnone 2>&1 | grep -q "no stripe info" || error
725 log "== test 27i: lfind with some objects =========================="
726 touch $DIR/d27/fsome || error
727 $LFIND $DIR/d27/fsome | grep -q obdidx || error
729 run_test 27g "test lfind ======================================="
733 $CREATETEST $DIR/d28/ct || error
735 run_test 28 "create/mknod/mkdir with bad file types ============"
738 for d in /proc/fs/lustre/ldlm/namespaces/$1*; do
739 echo clear > $d/lru_size
741 grep [0-9] /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null
750 MDCDIR=${MDCDIR:-/proc/fs/lustre/ldlm/namespaces/MDC_*}
751 LOCKCOUNTORIG=`cat $MDCDIR/lock_count`
752 LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count`
756 LOCKCOUNTCURRENT=`cat $MDCDIR/lock_count`
757 LOCKUNUSEDCOUNTCURRENT=`cat $MDCDIR/lock_unused_count`
758 if [ $LOCKCOUNTCURRENT -gt $LOCKCOUNTORIG ]; then
759 echo "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG"
762 if [ $LOCKUNUSEDCOUNTCURRENT -gt $LOCKUNUSEDCOUNTORIG ]; then
763 echo "UNUSED: $LOCKUNUSEDCOUNTCURRENT > $LOCKUNUSEDCOUNTORIG"
767 run_test 29 "IT_GETATTR regression ============================"
774 run_test 30 "run binary from Lustre (execve) ==================="
777 $OPENUNLINK $DIR/f31 $DIR/f31 || error
778 $CHECKSTAT -a $DIR/f31 || error
780 run_test 31a "open-unlink file =================================="
783 touch $DIR/f31 || error
784 ln $DIR/f31 $DIR/f31b || error
785 multiop $DIR/f31b Ouc || error
786 $CHECKSTAT -t file $DIR/f31 || error
788 run_test 31b "unlink file with multiple links while open ======="
791 touch $DIR/f31 || error
792 ln $DIR/f31 $DIR/f31c || error
793 multiop $DIR/f31 O_uc &
795 multiop $DIR/f31c Ouc
800 run_test 31c "open-unlink file with multiple links ============="
803 opendirunlink $DIR/d31d $DIR/d31d || error
804 $CHECKSTAT -a $DIR/d31d || error
806 run_test 31d "remove of open directory ========================="
809 echo "== more mountpoints and symlinks ================="
810 [ -e $DIR/d32a ] && rm -fr $DIR/d32a
811 mkdir -p $DIR/d32a/ext2-mountpoint
812 mount -t ext2 -o loop $EXT2_DEV $DIR/d32a/ext2-mountpoint || error
813 $CHECKSTAT -t dir $DIR/d32a/ext2-mountpoint/.. || error
814 umount $DIR/d32a/ext2-mountpoint || error
816 run_test 32a "stat d32a/ext2-mountpoint/.. ====================="
819 [ -e $DIR/d32b ] && rm -fr $DIR/d32b
820 mkdir -p $DIR/d32b/ext2-mountpoint
821 mount -t ext2 -o loop $EXT2_DEV $DIR/d32b/ext2-mountpoint || error
822 ls -al $DIR/d32b/ext2-mountpoint/.. || error
823 umount $DIR/d32b/ext2-mountpoint || error
825 run_test 32b "open d32b/ext2-mountpoint/.. ====================="
828 [ -e $DIR/d32c ] && rm -fr $DIR/d32c
829 mkdir -p $DIR/d32c/ext2-mountpoint
830 mount -t ext2 -o loop $EXT2_DEV $DIR/d32c/ext2-mountpoint || error
831 mkdir -p $DIR/d32c/d2/test_dir
832 $CHECKSTAT -t dir $DIR/d32c/ext2-mountpoint/../d2/test_dir || error
833 umount $DIR/d32c/ext2-mountpoint || error
835 run_test 32c "stat d32c/ext2-mountpoint/../d2/test_dir ========="
838 [ -e $DIR/d32d ] && rm -fr $DIR/d32d
839 mkdir -p $DIR/d32d/ext2-mountpoint
840 mount -t ext2 -o loop $EXT2_DEV $DIR/d32d/ext2-mountpoint || error
841 mkdir -p $DIR/d32d/d2/test_dir
842 ls -al $DIR/d32d/ext2-mountpoint/../d2/test_dir || error
843 umount $DIR/d32d/ext2-mountpoint || error
845 run_test 32d "open d32d/ext2-mountpoint/../d2/test_dir ========="
848 [ -e $DIR/d32e ] && rm -fr $DIR/d32e
849 mkdir -p $DIR/d32e/tmp
850 TMP_DIR=$DIR/d32e/tmp
851 ln -s $DIR/d32e $TMP_DIR/symlink11
852 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
853 $CHECKSTAT -t link $DIR/d32e/tmp/symlink11 || error
854 $CHECKSTAT -t link $DIR/d32e/symlink01 || error
856 run_test 32e "stat d32e/symlink->tmp/symlink->lustre-subdir ===="
859 [ -e $DIR/d32f ] && rm -fr $DIR/d32f
860 mkdir -p $DIR/d32f/tmp
861 TMP_DIR=$DIR/d32f/tmp
862 ln -s $DIR/d32f $TMP_DIR/symlink11
863 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
864 ls $DIR/d32f/tmp/symlink11 || error
865 ls $DIR/d32f/symlink01 || error
867 run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir ===="
870 [ -e $DIR/d32g ] && rm -fr $DIR/d32g
871 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
872 mkdir -p $DIR/test_dir
873 mkdir -p $DIR/d32g/tmp
874 TMP_DIR=$DIR/d32g/tmp
875 ln -s $DIR/test_dir $TMP_DIR/symlink12
876 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
877 $CHECKSTAT -t link $DIR/d32g/tmp/symlink12 || error
878 $CHECKSTAT -t link $DIR/d32g/symlink02 || error
879 $CHECKSTAT -t dir -f $DIR/d32g/tmp/symlink12 || error
880 $CHECKSTAT -t dir -f $DIR/d32g/symlink02 || error
882 run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/test_dir"
885 [ -e $DIR/d32h ] && rm -fr $DIR/d32h
886 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
887 mkdir -p $DIR/test_dir
888 mkdir -p $DIR/d32h/tmp
889 TMP_DIR=$DIR/d32h/tmp
890 ln -s $DIR/test_dir $TMP_DIR/symlink12
891 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
892 ls $DIR/d32h/tmp/symlink12 || error
893 ls $DIR/d32h/symlink02 || error
895 run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/test_dir"
898 [ -e $DIR/d32i ] && rm -fr $DIR/d32i
899 mkdir -p $DIR/d32i/ext2-mountpoint
900 mount -t ext2 -o loop $EXT2_DEV $DIR/d32i/ext2-mountpoint || error
901 touch $DIR/d32i/test_file
902 $CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error
903 umount $DIR/d32i/ext2-mountpoint || error
905 run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="
908 [ -e $DIR/d32j ] && rm -fr $DIR/d32j
909 mkdir -p $DIR/d32j/ext2-mountpoint
910 mount -t ext2 -o loop $EXT2_DEV $DIR/d32j/ext2-mountpoint || error
911 touch $DIR/d32j/test_file
912 cat $DIR/d32j/ext2-mountpoint/../test_file || error
913 umount $DIR/d32j/ext2-mountpoint || error
915 run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="
919 mkdir -p $DIR/d32k/ext2-mountpoint
920 mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint
921 mkdir -p $DIR/d32k/d2
922 touch $DIR/d32k/d2/test_file || error
923 $CHECKSTAT -t file $DIR/d32k/ext2-mountpoint/../d2/test_file || error
924 umount $DIR/d32k/ext2-mountpoint || error
926 run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"
930 mkdir -p $DIR/d32l/ext2-mountpoint
931 mount -t ext2 -o loop $EXT2_DEV $DIR/d32l/ext2-mountpoint || error
932 mkdir -p $DIR/d32l/d2
933 touch $DIR/d32l/d2/test_file
934 cat $DIR/d32l/ext2-mountpoint/../d2/test_file || error
935 umount $DIR/d32l/ext2-mountpoint || error
937 run_test 32l "open d32l/ext2-mountpoint/../d2/test_file ========"
941 mkdir -p $DIR/d32m/tmp
942 TMP_DIR=$DIR/d32m/tmp
943 ln -s $DIR $TMP_DIR/symlink11
944 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
945 $CHECKSTAT -t link $DIR/d32m/tmp/symlink11 || error
946 $CHECKSTAT -t link $DIR/d32m/symlink01 || error
948 run_test 32m "stat d32m/symlink->tmp/symlink->lustre-root ======"
952 mkdir -p $DIR/d32n/tmp
953 TMP_DIR=$DIR/d32n/tmp
954 ln -s $DIR $TMP_DIR/symlink11
955 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
956 ls -l $DIR/d32n/tmp/symlink11 || error
957 ls -l $DIR/d32n/symlink01 || error
959 run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======"
965 mkdir -p $DIR/d32o/tmp
966 TMP_DIR=$DIR/d32o/tmp
967 ln -s $DIR/test_file $TMP_DIR/symlink12
968 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
969 $CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error
970 $CHECKSTAT -t link $DIR/d32o/symlink02 || error
971 $CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error
972 $CHECKSTAT -t file -f $DIR/d32o/symlink02 || error
974 run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/test_file"
984 mkdir -p $DIR/d32p/tmp
986 TMP_DIR=$DIR/d32p/tmp
988 ln -s $DIR/test_file $TMP_DIR/symlink12
990 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
992 cat $DIR/d32p/tmp/symlink12 || error
994 cat $DIR/d32p/symlink02 || error
997 run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/test_file"
1000 [ -e $DIR/d32q ] && rm -fr $DIR/d32q
1002 touch $DIR/d32q/under_the_mount
1003 mount -t ext2 -o loop $EXT2_DEV $DIR/d32q
1004 ls $DIR/d32q/under_the_mount && error || true
1005 umount $DIR/d32q || error
1007 run_test 32q "stat follows mountpoints in Lustre ========================="
1010 [ -e $DIR/d32r ] && rm -fr $DIR/d32r
1012 touch $DIR/d32r/under_the_mount
1013 mount -t ext2 -o loop $EXT2_DEV $DIR/d32r
1014 ls $DIR/d32r | grep -q under_the_mount && error || true
1015 umount $DIR/d32r || error
1017 run_test 32r "opendir follows mountpoints in Lustre ========================="
1019 # chmod 444 /mnt/lustre/somefile
1020 # open(/mnt/lustre/somefile, O_RDWR)
1023 rm -f $DIR/test_33_file
1024 touch $DIR/test_33_file
1025 chmod 444 $DIR/test_33_file
1026 chown $RUNAS_ID $DIR/test_33_file
1028 $RUNAS $OPENFILE -f O_RDWR $DIR/test_33_file && error || true
1031 run_test 33 "write file with mode 444 (should return error) ===="
1033 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
1035 rm -f $DIR/test_34_file
1036 $MCREATE $DIR/test_34_file || error
1037 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1038 $TRUNCATE $DIR/test_34_file $TEST_34_SIZE || error
1039 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1040 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1042 run_test 34a "truncate file that has not been opened ==========="
1045 [ ! -f $DIR/test_34_file ] && run_one 34a
1046 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1047 $OPENFILE -f O_RDONLY $DIR/test_34_file
1048 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1049 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1051 run_test 34b "O_RDONLY opening file doesn't create objects ====="
1054 [ ! -f $DIR/test_34_file ] && run_one 34a
1055 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1056 $OPENFILE -f O_RDWR $DIR/test_34_file
1057 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" && error
1058 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1060 run_test 34c "O_RDWR opening file-with-size works =============="
1063 dd if=/dev/zero of=$DIR/test_34_file conv=notrunc bs=4k count=1 || error
1064 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1065 rm $DIR/test_34_file
1067 run_test 34d "write to sparse file ============================="
1070 rm -f $DIR/test_34_file
1071 $MCREATE $DIR/test_34_file || error
1072 $TRUNCATE $DIR/test_34_file 1000 || error
1073 $CHECKSTAT -s 1000 $DIR/test_34_file || error
1074 $OPENFILE -f O_RDWR $DIR/test_34_file
1075 $CHECKSTAT -s 1000 $DIR/test_34_file || error
1077 run_test 34e "create objects, some with size and some without =="
1080 cp /bin/sh $DIR/test_35a_file
1081 chmod 444 $DIR/test_35a_file
1082 chown $RUNAS_ID $DIR/test_35a_file
1083 $RUNAS $DIR/test_35a_file && error || true
1084 rm $DIR/test_35a_file
1086 run_test 35a "exec file with mode 444 (should return and not leak) ====="
1090 rm -f $DIR/test_36_file
1091 utime $DIR/test_36_file || error
1093 run_test 36a "MDS utime check (mknod, utime) ==================="
1096 echo "" > $DIR/test_36_file
1097 utime $DIR/test_36_file || error
1099 run_test 36b "OST utime check (open, utime) ===================="
1102 rm -f $DIR/d36/test_36_file
1104 chown $RUNAS_ID $DIR/d36
1105 $RUNAS utime $DIR/d36/test_36_file || error
1107 run_test 36c "non-root MDS utime check (mknod, utime) =========="
1110 [ ! -d $DIR/d36 ] && run_one 36c
1111 echo "" > $DIR/d36/test_36_file
1112 $RUNAS utime $DIR/d36/test_36_file || error
1114 run_test 36d "non-root OST utime check (open, utime) ==========="
1117 [ $RUNAS_ID -eq $UID ] && return
1118 [ ! -d $DIR/d36 ] && mkdir $DIR/d36
1119 touch $DIR/d36/test_36_file2
1120 $RUNAS utime $DIR/d36/test_36_file2 && error || true
1122 run_test 36e "utime on non-owned file (should return error) ===="
1125 mkdir -p $DIR/dextra
1126 echo f > $DIR/dextra/fbugfile
1127 mount -t ext2 -o loop $EXT2_DEV $DIR/dextra
1128 ls $DIR/dextra | grep "\<fbugfile\>" && error
1129 umount $DIR/dextra || error
1130 rm -f $DIR/dextra/fbugfile || error
1132 run_test 37 "ls a mounted file system to check old content ====="
1135 o_directory $DIR/test38
1137 run_test 38 "open a regular file with O_DIRECTORY =============="
1140 touch $DIR/test_39_file
1141 touch $DIR/test_39_file2
1142 # ls -l $DIR/test_39_file $DIR/test_39_file2
1143 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1144 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1146 $OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/test_39_file2
1147 # ls -l $DIR/test_39_file $DIR/test_39_file2
1148 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1149 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1150 [ $DIR/test_39_file2 -nt $DIR/test_39_file ] || error
1152 run_test 39 "mtime changed on create ==========================="
1155 dd if=/dev/zero of=$DIR/f40 bs=4096 count=1
1156 $RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/f40 && error
1157 $CHECKSTAT -t file -s 4096 $DIR/f40 || error
1159 run_test 40 "failed open(O_TRUNC) doesn't truncate ============="
1163 small_write $DIR/f41 18
1165 run_test 41 "test small file write + fstat ====================="
1167 count_ost_writes() {
1168 cat /proc/fs/lustre/osc/*/stats |
1169 awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
1172 # in 2.6, restore /proc/sys/vm/dirty_writeback_centisecs
1173 kill -CONT `pidof kupdated`
1176 # in 2.6, save and 0 /proc/sys/vm/dirty_writeback_centisecs
1177 kill -STOP `pidof kupdated`
1178 trap start_kupdated EXIT
1181 # Tests 42* verify that our behaviour is correct WRT caching, file closure,
1182 # file truncation, and file removal.
1184 cancel_lru_locks OSC
1186 sync # just to be safe
1187 BEFOREWRITES=`count_ost_writes`
1188 dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
1189 AFTERWRITES=`count_ost_writes`
1190 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1191 error "$BEFOREWRITES < $AFTERWRITES"
1194 run_test 42a "ensure that we don't flush on close =============="
1197 cancel_lru_locks OSC
1200 dd if=/dev/zero of=$DIR/f42b bs=1024 count=100
1201 BEFOREWRITES=`count_ost_writes`
1202 $MUNLINK $DIR/f42b || error "$MUNLINK $DIR/f42b: $?"
1203 AFTERWRITES=`count_ost_writes`
1204 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1205 error "$BEFOREWRITES < $AFTERWRITES on unlink"
1206 BEFOREWRITES=`count_ost_writes`
1207 sync || error "sync: $?"
1208 AFTERWRITES=`count_ost_writes`
1209 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1210 error "$BEFOREWRITES < $AFTERWRITES on sync"
1211 dmesg | grep 'error from obd_brw_async' && error 'error writing back'
1215 run_test 42b "test destroy of file with cached dirty data ======"
1217 # if these tests just want to test the effect of truncation,
1218 # they have to be very careful. consider:
1219 # - the first open gets a {0,EOF}PR lock
1220 # - the first write conflicts and gets a {0, count-1}PW
1221 # - the rest of the writes are under {count,EOF}PW
1222 # - the open for truncate tries to match a {0,EOF}PR
1223 # for the filesize and cancels the PWs.
1224 # any number of fixes (don't get {0,EOF} on open, match
1225 # composite locks, do smarter file size management) fix
1226 # this, but for now we want these tests to verify that
1227 # the cancelation with truncate intent works, so we
1228 # start the file with a full-file pw lock to match against
1229 # until the truncate.
1234 cancel_lru_locks OSC
1236 # prime the file with 0,EOF PW to match
1240 # now the real test..
1241 dd if=/dev/zero of=$file bs=1024 count=100
1242 BEFOREWRITES=`count_ost_writes`
1243 $TRUNCATE $file $offset
1244 cancel_lru_locks OSC
1245 AFTERWRITES=`count_ost_writes`
1251 [ $BEFOREWRITES -eq $AFTERWRITES ] && \
1252 error "$BEFOREWRITES < $AFTERWRITES on truncate"
1255 run_test 42c "test partial truncate of file with cached dirty data ===="
1259 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1260 error "beforewrites $BEFOREWRITES != afterwrites $AFTERWRITES on truncate"
1263 run_test 42d "test complete truncate of file with cached dirty data ===="
1267 cp -p /bin/ls $DIR/d43/f
1268 exec 100>> $DIR/d43/f
1269 $DIR/d43/f && error || true
1272 run_test 43 "execution of file opened for write should return -ETXTBSY=="
1276 cp -p `which multiop` $DIR/d43/multiop
1278 $DIR/d43/multiop $DIR/d43/g o_c &
1281 multiop $DIR/d43/multiop Oc && error "expected error, got success"
1282 kill -USR1 $MULTIPID || return 2
1283 wait $MULTIPID || return 3
1285 run_test 43a "open(RDWR) of file being executed should return -ETXTBSY=="
1289 cp -p `which multiop` $DIR/d43/multiop
1291 $DIR/d43/multiop $DIR/d43/g o_c &
1294 truncate $DIR/d43/multiop 0 && error "expected error, got success"
1295 kill -USR1 $MULTIPID || return 2
1296 wait $MULTIPID || return 3
1298 run_test 43b "truncate of file being executed should return -ETXTBSY===="
1301 local testdir="$DIR/43a"
1304 ( cd $(dirname $SHELL) && md5sum $(basename $SHELL) ) | \
1305 ( cd $testdir && md5sum -c)
1307 run_test 43c "md5sum of copy into lustre================================"
1310 [ "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
1311 dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=127
1312 dd if=$DIR/f1 bs=4k count=1
1314 run_test 44 "zero length read from a sparse stripe ============="
1317 local nstripe=`$LCTL lov_getconfig $DIR | grep default_stripe_count: | \
1319 local stride=`$LCTL lov_getconfig $DIR | grep default_stripe_size: | \
1321 if [ $nstripe -eq 0 ] ; then
1322 nstripe=`$LCTL lov_getconfig $DIR | grep obd_count: | awk '{print $2}'`
1325 OFFSETS="0 $((stride/2)) $((stride-1))"
1326 for offset in $OFFSETS ; do
1327 for i in `seq 0 $((nstripe-1))`; do
1329 local GLOBALOFFSETS=""
1330 local size=$((((i + 2 * $nstripe )*$stride + $offset))) # Bytes
1331 ll_sparseness_write $DIR/44a $size || error "ll_sparseness_write"
1332 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1333 ll_sparseness_verify $DIR/44a $GLOBALOFFSETS \
1334 || error "ll_sparseness_verify $GLOBALOFFSETS"
1336 for j in `seq 0 $((nstripe-1))`; do
1337 size=$((((j + $nstripe )*$stride + $offset))) # Bytes
1338 ll_sparseness_write $DIR/44a $size || error "ll_sparseness_write"
1339 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1341 ll_sparseness_verify $DIR/44a $GLOBALOFFSETS \
1342 || error "ll_sparseness_verify $GLOBALOFFSETS"
1346 run_test 44a "test sparse pwrite ==============================="
1350 for d in /proc/fs/lustre/osc/*/cur_dirty_bytes; do
1351 tot=$(($tot + `cat $d`))
1356 before=`dirty_osc_total`
1357 echo executing "\"$*\""
1359 after=`dirty_osc_total`
1360 echo before $before, after $after
1366 do_dirty_record "echo blah > $f"
1367 [ $before -eq $after ] && error "write wasn't cached"
1368 do_dirty_record "> $f"
1369 [ $before -gt $after ] || error "truncate didn't lower dirty count"
1370 do_dirty_record "echo blah > $f"
1371 [ $before -eq $after ] && error "write wasn't cached"
1372 do_dirty_record "sync"
1373 [ $before -gt $after ] || error "writeback didn't lower dirty count"
1374 do_dirty_record "echo blah > $f"
1375 [ $before -eq $after ] && error "write wasn't cached"
1376 do_dirty_record "cancel_lru_locks OSC"
1377 [ $before -gt $after ] || error "lock cancelation didn't lower dirty count"
1380 run_test 45 "osc io page accounting ============================"
1386 # in a 2 stripe file (lov.sh), page 63 maps to page 31 in its object. this
1387 # test tickles a bug where re-dirtying a page was failing to be mapped to the
1388 # objects offset and an assert hit when an rpc was built with 63's mapped
1389 # offset 31 and 31's raw 31 offset. it also found general redirtying bugs.
1394 dd if=/dev/zero of=$f bs=`page_size` seek=31 count=1
1396 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=63 count=1
1397 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=31 count=1
1401 run_test 46 "dirtying a previously written page ================"
1403 # Check that device nodes are created and then visible correctly (#2091)
1405 cmknod $DIR/test_47_node || error
1407 run_test 47 "Device nodes check ================================"
1412 mv $DIR/d48 $DIR/d48.new || error "move directory failed"
1413 mkdir $DIR/d48 || error "recreate diectory failed"
1414 ls || error "can't list after recreate directory"
1416 run_test 48 "Access renamed current working directory ========="
1422 ls /proc/$$/cwd || error
1424 run_test 50 "special situations: /proc symlinks ==============="
1427 # bug 1516 - create an empty entry right after ".." then split dir
1430 $MCREATE $DIR/d49/bar
1432 createmany -m $DIR/d49/longfile 201
1434 while [ `ls -sd $DIR/d49 | awk '{ print $1 }'` -eq 4 ]; do
1435 $MCREATE $DIR/d49/longfile$FNUM
1439 ls -l $DIR/d49 > /dev/null || error
1441 run_test 51 "special situations: split htree with empty entry =="
1444 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
1447 chattr =a $DIR/d52a/foo || error
1448 echo bar >> $DIR/d52a/foo || error
1449 cp /etc/hosts $DIR/d52a/foo && error
1450 rm -f $DIR/d52a/foo 2>/dev/null && error
1451 link $DIR/d52a/foo $DIR/d52a/foo_link 2>/dev/null && error
1452 echo foo >> $DIR/d52a/foo || error
1453 mrename $DIR/d52a/foo $DIR/d52a/foo_ren && error
1454 lsattr $DIR/d52a/foo | egrep -q "^-+a-+ $DIR/d52a/foo" || error
1455 chattr -a $DIR/d52a/foo || error
1457 rm -fr $DIR/d52a || error
1459 run_test 52a "append-only flag test ============================"
1462 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
1465 chattr =i $DIR/d52b/foo || error
1466 cat test > $DIR/d52b/foo && error
1467 cp /etc/hosts $DIR/d52b/foo && error
1468 rm -f $DIR/d52b/foo 2>/dev/null && error
1469 link $DIR/d52b/foo $DIR/d52b/foo_link 2>/dev/null && error
1470 echo foo >> $DIR/d52b/foo && error
1471 mrename $DIR/d52b/foo $DIR/d52b/foo_ren && error
1472 [ -f $DIR/d52b/foo ] || error
1473 [ -f $DIR/d52b/foo_ren ] && error
1474 lsattr $DIR/d52b/foo | egrep -q "^-+i-+ $DIR/d52b/foo" || error
1475 chattr -i $DIR/d52b/foo || error
1477 rm -fr $DIR/d52b || error
1479 run_test 52b "immutable flag test =============================="
1482 for i in /proc/fs/lustre/osc/OSC*mds1 ; do
1483 ostname=`echo $i | cut -d _ -f 3-4`
1484 ost_last=`cat /proc/fs/lustre/obdfilter/$ostname/last_id`
1485 mds_last=`cat $i/prealloc_last_id`
1486 echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1487 if [ $ost_last != $mds_last ]; then
1488 error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1492 run_test 53 "verify that MDS and OSTs agree on pre-creation====="
1495 $SOCKETSERVER $DIR/socket &
1497 $SOCKETCLIENT $DIR/socket || error
1498 $MUNLINK $DIR/socket
1500 run_test 54a "unix damain socket test ==========================="
1506 dd if=/dev/zero of=$f bs=`page_size` count=1
1508 run_test 54b "char device works in lustre"
1513 loopdev="$DIR/loop54c"
1515 mknod $loopdev b 7 1
1516 dd if=/dev/zero of=$f bs=`page_size` count=1024 > /dev/null
1519 echo "make a loop file system..."
1520 mkfs.ext2 -F $f > /dev/null
1523 dd if=/dev/zero of=$dir/tmp bs=`page_size` count=30 || error
1524 dd if=$dir/tmp of=/dev/zero bs=`page_size` count=30 || error
1527 run_test 54c "loop device works in lustre"
1533 [ "$string" = `echo $string > $f | cat $f` ] || error
1535 run_test 54d "fifo device works in lustre"
1538 echo "touch 130 files"
1539 for i in `seq 1 130` ; do
1543 for i in `seq 1 130` ; do
1548 # wait for commitment of removal
1550 run_test 59 "verify cancellation of llog records async=========="
1553 echo 60 "llog tests run from kernel mode"
1556 run_test 60 "llog sanity tests run from kernel module =========="
1560 dd if=/dev/zero of=$f bs=`page_size` count=1
1561 cancel_lru_locks OSC
1562 multiop $f OSMWUc || error
1565 run_test 61 "mmap() writes don't make sync hang =========="
1567 # bug 2330 - insufficient obd_match error checking causes LBUG
1571 cancel_lru_locks OSC
1572 echo 0x405 > /proc/sys/lustre/fail_loc
1573 cat $f && error # expect -EIO
1574 multiop $f Owc && error
1575 echo 0 > /proc/sys/lustre/fail_loc
1577 run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
1579 # on the LLNL clusters, runas will still pick up root's $TMP settings,
1580 # which will not be writable for the runas user, and then you get a CVS
1581 # error message with a corrupt path string (CVS bug) and panic.
1582 # We're not using much space, so just stick it in /tmp, which is safe.
1588 [ $RUNAS_ID -ne $UID ] && HOME=/tmp
1591 echo 99 "cvs operations ===================================="
1592 mkdir -p $DIR/d99cvsroot
1593 chown $RUNAS_ID $DIR/d99cvsroot
1594 $RUNAS cvs -d $DIR/d99cvsroot init || error
1596 run_test 99a "cvs init ========================================="
1599 [ ! -d $DIR/d99cvsroot ] && run_one 99a
1601 $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" d99reposname vtag rtag
1603 run_test 99b "cvs import ======================================="
1606 [ ! -d $DIR/d99cvsroot ] && run_one 99b
1608 mkdir -p $DIR/d99reposname
1609 chown $RUNAS_ID $DIR/d99reposname
1610 $RUNAS cvs -d $DIR/d99cvsroot co d99reposname
1612 run_test 99c "cvs checkout ====================================="
1615 [ ! -d $DIR/d99cvsroot ] && run_one 99c
1616 cd $DIR/d99reposname
1618 $RUNAS cvs add -m 'addmsg' foo99
1620 run_test 99d "cvs add =========================================="
1623 [ ! -d $DIR/d99cvsroot ] && run_one 99c
1624 cd $DIR/d99reposname
1627 run_test 99e "cvs update ======================================="
1630 [ ! -d $DIR/d99cvsroot ] && run_one 99d
1631 cd $DIR/d99reposname
1632 $RUNAS cvs commit -m 'nomsg' foo99
1634 run_test 99f "cvs commit ======================================="
1640 log "cleanup: ======================================================"
1641 if [ "$I_MOUNTED" = "yes" -a "`mount | grep ^$NAME`" ]; then
1642 rm -rf $DIR/[Rdfs][1-9]*
1643 sh llmountcleanup.sh || error
1646 echo '=========================== finished ==============================='
1647 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true