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 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"35 32q 37 39"} # bugs 1360, 1504
13 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
15 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
16 CREATETEST=${CREATETEST:-createtest}
18 LSTRIPE=${LSTRIPE:-lstripe}
20 MCREATE=${MCREATE:-mcreate}
21 OPENFILE=${OPENFILE:-openfile}
22 OPENUNLINK=${OPENUNLINK:-openunlink}
23 TOEXCL=${TOEXCL:-toexcl}
24 TRUNCATE=${TRUNCATE:-truncate}
26 if [ $UID -ne 0 ]; then
30 RUNAS_ID=${RUNAS_ID:-500}
31 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
34 export NAME=${NAME:-local}
40 sh llmountcleanup.sh > /dev/null || exit 20
46 sh llrmount.sh > /dev/null || exit 10
53 lctl mark "$*" || true
57 if ! mount | grep -q $DIR; then
69 if [ "`echo $1 | grep '\<'$O'[a-z]*\>'`" ]; then
77 for X in $EXCEPT $ALWAYS_EXCEPT; do
78 if [ "`echo $1 | grep '\<'$X'[a-z]*\>'`" ]; then
79 echo "skipping excluded test $1"
83 if [ -z "$ONLY" ]; then
98 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
99 if [ -z "$MOUNT" ]; then
101 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
102 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
106 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
109 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
111 rm -rf $DIR/[Rdfs][1-9]*
113 echo preparing for tests involving mounts
114 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
116 mke2fs -F $EXT2_DEV 1000 > /dev/null
120 $CHECKSTAT -t file $DIR/f || error
122 $CHECKSTAT -a $DIR/f || error
124 run_test 0 "touch .../f ; rm .../f ============================="
129 $CHECKSTAT -t dir $DIR/d1/d2 || error
131 run_test 1a "mkdir .../d1; mkdir .../d1/d2 ====================="
136 $CHECKSTAT -a $DIR/d1 || error
138 run_test 1b "rmdir .../d1/d2; rmdir .../d1 ====================="
143 $CHECKSTAT -t file $DIR/d2/f || error
145 run_test 2a "mkdir .../d2; touch .../d2/f ======================"
149 $CHECKSTAT -a $DIR/d2 || error
151 run_test 2b "rm -r .../d2; touch .../d2/f ======================"
155 $CHECKSTAT -t dir $DIR/d3 || error
157 run_test 3a "mkdir .../d3 ======================================"
161 $CHECKSTAT -t file $DIR/d3/f || error
163 run_test 3b "touch .../d3/f ===================================="
167 $CHECKSTAT -a $DIR/d3 || error
169 run_test 3c "rm -r .../d3 ======================================"
173 $CHECKSTAT -t dir $DIR/d4 || error
175 run_test 4a "mkdir .../d4 ======================================"
179 $CHECKSTAT -t dir $DIR/d4/d2 || error
181 run_test 4b "mkdir .../d4/d2 ==================================="
186 chmod 0707 $DIR/d5/d2
187 $CHECKSTAT -t dir -p 0707 $DIR/d5/d2 || error
189 run_test 5 "mkdir .../d5 .../d5/d2; chmod .../d5/d2 ============"
193 chmod 0666 $DIR/f6a || error
194 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
196 run_test 6a "touch .../f6a; chmod .../f6a ======================"
199 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6b" && return
200 $RUNAS chmod 0444 $DIR/f6a && error
201 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
203 run_test 6b "$RUNAS chmod .../f6a (should return error) =="
206 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6c" && return
208 chown $RUNAS_ID $DIR/f6c || error
209 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
211 run_test 6c "touch .../f6c; chown .../f6c ======================"
214 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6d" && return
215 $RUNAS chown $UID $DIR/f6c && error
216 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
218 run_test 6d "$RUNAS chown .../f6c (should return error) =="
221 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6e" && return
223 chgrp $RUNAS_ID $DIR/f6e || error
224 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
226 run_test 6e "touch .../f6e; chgrp .../f6e ======================"
229 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6f" && return
230 $RUNAS chgrp $UID $DIR/f6e && error
231 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
233 run_test 6f "$RUNAS chgrp .../f6e (should return error) =="
239 $CHECKSTAT -t file -p 0666 $DIR/d7/f || error
241 run_test 7a "mkdir .../d7; mcreate .../d7/f; chmod .../d7/f ===="
245 echo -n foo > $DIR/d7/f2
246 [ "`cat $DIR/d7/f2`" = "foo" ] || error
247 $CHECKSTAT -t file -s 3 $DIR/d7/f2 || error
249 run_test 7b "mkdir .../d7; mcreate d7/f2; echo foo > d7/f2 ====="
255 $CHECKSTAT -t file -p 0666 $DIR/d8/f || error
257 run_test 8 "mkdir .../d8; touch .../d8/f; chmod .../d8/f ======="
263 $CHECKSTAT -t dir $DIR/d9/d2/d3 || error
265 run_test 9 "mkdir .../d9 .../d9/d2 .../d9/d2/d3 ================"
271 $CHECKSTAT -t file $DIR/d10/d2/f || error
273 run_test 10 "mkdir .../d10 .../d10/d2; touch .../d10/d2/f ======"
278 chmod 0666 $DIR/d11/d2
279 chmod 0705 $DIR/d11/d2
280 $CHECKSTAT -t dir -p 0705 $DIR/d11/d2 || error
282 run_test 11 "mkdir .../d11 d11/d2; chmod .../d11/d2 ============"
287 chmod 0666 $DIR/d12/f
288 chmod 0654 $DIR/d12/f
289 $CHECKSTAT -t file -p 0654 $DIR/d12/f || error
291 run_test 12 "touch .../d12/f; chmod .../d12/f .../d12/f ========"
295 dd if=/dev/zero of=$DIR/d13/f count=10
297 $CHECKSTAT -t file -s 0 $DIR/d13/f || error
299 run_test 13 "creat .../d13/f; dd .../d13/f; > .../d13/f ========"
305 $CHECKSTAT -a $DIR/d14/f || error
307 run_test 14 "touch .../d14/f; rm .../d14/f; rm .../d14/f ======="
312 mv $DIR/d15/f $DIR/d15/f2
313 $CHECKSTAT -t file $DIR/d15/f2 || error
315 run_test 15 "touch .../d15/f; mv .../d15/f .../d15/f2 =========="
321 $CHECKSTAT -a $DIR/d16/f || error
323 run_test 16 "touch .../d16/f; rm -rf .../d16/f ================="
328 ln -s $DIR/d17/f $DIR/d17/l-exist
330 $CHECKSTAT -l $DIR/d17/f $DIR/d17/l-exist || error
331 $CHECKSTAT -f -t f $DIR/d17/l-exist || error
333 $CHECKSTAT -a $DIR/l-exist || error
335 run_test 17a "symlinks: create, remove (real) =================="
338 ln -s no-such-file $DIR/d17/l-dangle
340 $CHECKSTAT -l no-such-file $DIR/d17/l-dangle || error
341 $CHECKSTAT -fa $DIR/d17/l-dangle || error
343 $CHECKSTAT -a $DIR/l-dangle || error
345 run_test 17b "symlinks: create, remove (dangling) =============="
351 run_test 18 "touch .../f ; ls ... =============================="
357 $CHECKSTAT -a $DIR/f || error
359 run_test 19 "touch .../f ; ls -l ... ==========================="
371 $CHECKSTAT -a $DIR/f || error
373 run_test 20 "touch .../f ; ls -l ... ==========================="
377 [ -f $DIR/d21/dangle ] && rm -f $DIR/d21/dangle
378 ln -s dangle $DIR/d21/link
379 echo foo >> $DIR/d21/link
381 $CHECKSTAT -t link $DIR/d21/link || error
382 $CHECKSTAT -f -t file $DIR/d21/link || error
384 run_test 21 "write to dangling link ============================"
388 chown $RUNAS_ID $DIR/d22
389 # Tar gets pissy if it can't access $PWD *sigh*
391 $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
392 $RUNAS tar xfC - $DIR/d22)
394 $CHECKSTAT -t dir $DIR/d22/etc || error
395 $CHECKSTAT -u \#$RUNAS_ID $DIR/d22/etc || error
397 run_test 22 "unpack tar archive as non-root user ==============="
402 $TOEXCL -e $DIR/d23/f23 || error
404 run_test 23 "O_CREAT|O_EXCL in subdir =========================="
407 echo '== rename sanity =============================================='
408 echo '-- same directory rename'
411 mv $DIR/R1/f $DIR/R1/g
412 $CHECKSTAT -t file $DIR/R1/g || error
414 run_test 24a "touch .../R1/f; rename .../R1/f .../R1/g ========="
419 mv $DIR/R2/f $DIR/R2/g
420 $CHECKSTAT -a $DIR/R2/f || error
421 $CHECKSTAT -t file $DIR/R2/g || error
423 run_test 24b "touch .../R2/{f,g}; rename .../R2/f .../R2/g ====="
428 mv $DIR/R3/f $DIR/R3/g
429 $CHECKSTAT -a $DIR/R3/f || error
430 $CHECKSTAT -t dir $DIR/R3/g || error
432 run_test 24c "mkdir .../R3/f; rename .../R3/f .../R3/g ========="
437 perl -e "rename \"$DIR/R4/f\", \"$DIR/R4/g\";"
438 $CHECKSTAT -a $DIR/R4/f || error
439 $CHECKSTAT -t dir $DIR/R4/g || error
441 run_test 24d "mkdir .../R4/{f,g}; rename .../R4/f .../R4/g ====="
444 echo '-- cross directory renames --'
447 mv $DIR/R5a/f $DIR/R5b/g
448 $CHECKSTAT -a $DIR/R5a/f || error
449 $CHECKSTAT -t file $DIR/R5b/g || error
451 run_test 24e "touch .../R5a/f; rename .../R5a/f .../R5b/g ======"
455 touch $DIR/R6a/f $DIR/R6b/g
456 mv $DIR/R6a/f $DIR/R6b/g
457 $CHECKSTAT -a $DIR/R6a/f || error
458 $CHECKSTAT -t file $DIR/R6b/g || error
460 run_test 24f "touch .../R6a/f R6b/g; mv .../R6a/f .../R6b/g ===="
465 mv $DIR/R7a/d $DIR/R7b/e
466 $CHECKSTAT -a $DIR/R7a/d || error
467 $CHECKSTAT -t dir $DIR/R7b/e || error
469 run_test 24g "mkdir .../R7a/d; rename .../R7a/d .../R5b/e ======"
473 mkdir $DIR/R8a/d $DIR/R8b/e
474 perl -e "rename \"$DIR/R8a/d\", \"$DIR/R8b/e\";"
475 $CHECKSTAT -a $DIR/R8a/d || error
476 $CHECKSTAT -t dir $DIR/R8b/e || error
478 run_test 24h "mkdir .../R8{a,b} R8a/{d,e}; mv .../R8a/d .../R8b/e"
481 echo "-- rename error cases"
485 perl -e "rename \"$DIR/R9/f\", \"$DIR/R9/a\";"
486 $CHECKSTAT -t file $DIR/R9/f || error
487 $CHECKSTAT -t dir $DIR/R9/a || error
488 $CHECKSTAT -a file $DIR/R9/a/f || error
490 run_test 24i "rename file to dir error: touch f ; mkdir a ; rename f a"
494 perl -e "rename \"$DIR/R10/f\", \"$DIR/R10/g\""
495 $CHECKSTAT -t dir $DIR/R10 || error
496 $CHECKSTAT -a $DIR/R10/f || error
497 $CHECKSTAT -a $DIR/R10/g || error
499 run_test 24j "source does not exist ============================"
502 echo '== symlink sanity ============================================='
505 touch $DIR/s25/foo || error
507 run_test 25a "create file in symlinked directory ==============="
510 $CHECKSTAT -t file $DIR/s25/foo || error
512 run_test 25b "lookup file in symlinked directory ==============="
517 ln -s d26/d26-2 $DIR/s26
518 touch $DIR/s26/foo || error
520 run_test 26a "multiple component symlink ======================="
523 mkdir -p $DIR/d26b/d26-2
524 ln -s d26b/d26-2/foo $DIR/s26-2
525 touch $DIR/s26-2 || error
527 run_test 26b "multiple component symlink at end of lookup ======"
532 ln -s d26.2 $DIR/s26.2-1
533 ln -s s26.2-1 $DIR/s26.2-2
534 ln -s s26.2-2 $DIR/s26.2-3
535 chmod 0666 $DIR/s26.2-3/foo
537 run_test 26c "chain of symlinks ================================"
539 # recursive symlinks (bug 439)
541 ln -s d26-3/foo $DIR/d26-3
543 run_test 26d "create multiple component recursive symlink ======"
548 run_test 26e "unlink multiple component recursive symlink ======"
551 echo '== stripe sanity =============================================='
553 $LSTRIPE $DIR/d27/f0 8192 0 1
554 $CHECKSTAT -t file $DIR/d27/f0
556 log "== test_27b: write to one stripe file ========================="
557 cp /etc/hosts $DIR/d27/f0
559 run_test 27a "one stripe file =================================="
562 $LSTRIPE $DIR/d27/f01 8192 0 2
564 log "== test_27d: write to two stripe file file f01 ================"
565 dd if=/dev/zero of=$DIR/d27/f01 bs=4k count=4
567 run_test 27c "create two stripe file f01 ======================="
570 $LSTRIPE $DIR/d27/fdef 0 -1 0
571 $CHECKSTAT -t file $DIR/d27/fdef
572 #dd if=/dev/zero of=$DIR/d27/fdef bs=4k count=4
574 run_test 27d "create file with default settings ================"
577 $LSTRIPE $DIR/d27/f12 8192 1 2
578 $LSTRIPE $DIR/d27/f12 8192 1 2 && error
579 $CHECKSTAT -t file $DIR/d27/f12 || error
580 #dd if=/dev/zero of=$DIR/d27/f12 bs=4k count=4
582 run_test 27e "lstripe existing file (should return error) ======"
586 $LSTRIPE $DIR/d27/fbad 100 1 2 || true
587 dd if=/dev/zero of=$DIR/d27/f12 bs=4k count=4
590 run_test 27f "lstripe with bad stripe size (should return error on LOV)"
593 $MCREATE $DIR/d27/fnone || error
595 log "== test 27h: lfind ============================================"
596 $LFIND $DIR/d27/fnone | grep -q "Has no stripe info" || error
598 run_test 27g "mcreate file without objects to test lfind ======="
602 $CREATETEST $DIR/d28/ct || error
604 run_test 28 "create/mknod/mkdir with bad file types ============"
611 MDCDIR=${MDCDIR:-/proc/fs/lustre/ldlm/ldlm/MDC_*}
612 LOCKCOUNTORIG=`cat $MDCDIR/lock_count`
613 LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count`
617 LOCKCOUNTCURRENT=`cat $MDCDIR/lock_count`
618 LOCKUNUSEDCOUNTCURRENT=`cat $MDCDIR/lock_unused_count`
619 if [ $LOCKCOUNTCURRENT -gt $LOCKCOUNTORIG ]; then
620 echo "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG"
623 if [ $LOCKUNUSEDCOUNTCURRENT -gt $LOCKUNUSEDCOUNTORIG ]; then
624 echo "UNUSED: $LOCKUNUSEDCOUNTCURRENT > $LOCKUNUSEDCOUNTORIG"
628 run_test 29 "IT_GETATTR regression ============================"
635 run_test 30 "run binary from Lustre (execve) ==================="
638 $OPENUNLINK $DIR/f31 $DIR/f31 || error
640 run_test 31 "open-unlink file =================================="
643 echo "== more mountpoints and symlinks ================="
644 [ -e $DIR/d32a ] && rm -fr $DIR/d32a
645 mkdir -p $DIR/d32a/ext2-mountpoint
646 mount -t ext2 -o loop $EXT2_DEV $DIR/d32a/ext2-mountpoint || error
647 $CHECKSTAT -t dir $DIR/d32a/ext2-mountpoint/.. || error
648 umount $DIR/d32a/ext2-mountpoint || error
650 run_test 32a "stat d32a/ext2-mountpoint/.. ====================="
653 [ -e $DIR/d32b ] && rm -fr $DIR/d32b
654 mkdir -p $DIR/d32b/ext2-mountpoint
655 mount -t ext2 -o loop $EXT2_DEV $DIR/d32b/ext2-mountpoint || error
656 ls -al $DIR/d32b/ext2-mountpoint/.. || error
657 umount $DIR/d32b/ext2-mountpoint || error
659 run_test 32b "open d32b/ext2-mountpoint/.. ====================="
662 [ -e $DIR/d32c ] && rm -fr $DIR/d32c
663 mkdir -p $DIR/d32c/ext2-mountpoint
664 mount -t ext2 -o loop $EXT2_DEV $DIR/d32c/ext2-mountpoint || error
665 mkdir -p $DIR/d32c/d2/test_dir
666 $CHECKSTAT -t dir $DIR/d32c/ext2-mountpoint/../d2/test_dir || error
667 umount $DIR/d32c/ext2-mountpoint || error
669 run_test 32c "stat d32c/ext2-mountpoint/../d2/test_dir ========="
672 [ -e $DIR/d32d ] && rm -fr $DIR/d32d
673 mkdir -p $DIR/d32d/ext2-mountpoint
674 mount -t ext2 -o loop $EXT2_DEV $DIR/d32d/ext2-mountpoint || error
675 mkdir -p $DIR/d32d/d2/test_dir
676 ls -al $DIR/d32d/ext2-mountpoint/../d2/test_dir || error
677 umount $DIR/d32d/ext2-mountpoint || error
679 run_test 32d "open d32d/ext2-mountpoint/../d2/test_dir ========="
682 [ -e $DIR/d32e ] && rm -fr $DIR/d32e
683 mkdir -p $DIR/d32e/tmp
684 TMP_DIR=$DIR/d32e/tmp
685 ln -s $DIR/d32e $TMP_DIR/symlink11
686 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
687 $CHECKSTAT -t link $DIR/d32e/tmp/symlink11 || error
688 $CHECKSTAT -t link $DIR/d32e/symlink01 || error
690 run_test 32e "stat d32e/symlink->tmp/symlink->lustre-subdir ===="
693 [ -e $DIR/d32f ] && rm -fr $DIR/d32f
694 mkdir -p $DIR/d32f/tmp
695 TMP_DIR=$DIR/d32f/tmp
696 ln -s $DIR/d32f $TMP_DIR/symlink11
697 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
698 ls $DIR/d32f/tmp/symlink11 || error
699 ls $DIR/d32f/symlink01 || error
701 run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir ===="
704 [ -e $DIR/d32g ] && rm -fr $DIR/d32g
705 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
706 mkdir -p $DIR/test_dir
707 mkdir -p $DIR/d32g/tmp
708 TMP_DIR=$DIR/d32g/tmp
709 ln -s $DIR/test_dir $TMP_DIR/symlink12
710 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
711 $CHECKSTAT -t link $DIR/d32g/tmp/symlink12 || error
712 $CHECKSTAT -t link $DIR/d32g/symlink02 || error
713 $CHECKSTAT -t dir -f $DIR/d32g/tmp/symlink12 || error
714 $CHECKSTAT -t dir -f $DIR/d32g/symlink02 || error
716 run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/test_dir"
719 [ -e $DIR/d32h ] && rm -fr $DIR/d32h
720 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
721 mkdir -p $DIR/test_dir
722 mkdir -p $DIR/d32h/tmp
723 TMP_DIR=$DIR/d32h/tmp
724 ln -s $DIR/test_dir $TMP_DIR/symlink12
725 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
726 ls $DIR/d32h/tmp/symlink12 || error
727 ls $DIR/d32h/symlink02 || error
729 run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/test_dir"
732 [ -e $DIR/d32i ] && rm -fr $DIR/d32i
733 mkdir -p $DIR/d32i/ext2-mountpoint
734 mount -t ext2 -o loop $EXT2_DEV $DIR/d32i/ext2-mountpoint || error
735 touch $DIR/d32i/test_file
736 $CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error
737 umount $DIR/d32i/ext2-mountpoint || error
739 run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="
742 [ -e $DIR/d32j ] && rm -fr $DIR/d32j
743 mkdir -p $DIR/d32j/ext2-mountpoint
744 mount -t ext2 -o loop $EXT2_DEV $DIR/d32j/ext2-mountpoint || error
745 touch $DIR/d32j/test_file
746 cat $DIR/d32j/ext2-mountpoint/../test_file || error
747 umount $DIR/d32j/ext2-mountpoint || error
749 run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="
753 mkdir -p $DIR/d32k/ext2-mountpoint
754 mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint
755 mkdir -p $DIR/d32k/d2
756 touch $DIR/d32k/d2/test_file || error
757 $CHECKSTAT -t file $DIR/d32k/ext2-mountpoint/../d2/test_file || error
758 umount $DIR/d32k/ext2-mountpoint || error
760 run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"
764 mkdir -p $DIR/d32l/ext2-mountpoint
765 mount -t ext2 -o loop $EXT2_DEV $DIR/d32l/ext2-mountpoint || error
766 mkdir -p $DIR/d32l/d2
767 touch $DIR/d32l/d2/test_file
768 cat $DIR/d32l/ext2-mountpoint/../d2/test_file || error
769 umount $DIR/d32l/ext2-mountpoint || error
771 run_test 32l "open d32l/ext2-mountpoint/../d2/test_file ========"
775 mkdir -p $DIR/d32m/tmp
776 TMP_DIR=$DIR/d32m/tmp
777 ln -s $DIR $TMP_DIR/symlink11
778 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
779 $CHECKSTAT -t link $DIR/d32m/tmp/symlink11 || error
780 $CHECKSTAT -t link $DIR/d32m/symlink01 || error
782 run_test 32m "stat d32m/symlink->tmp/symlink->lustre-root ======"
786 mkdir -p $DIR/d32n/tmp
787 TMP_DIR=$DIR/d32n/tmp
788 ln -s $DIR $TMP_DIR/symlink11
789 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
790 ls -l $DIR/d32n/tmp/symlink11 || error
791 ls -l $DIR/d32n/symlink01 || error
793 run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======"
799 mkdir -p $DIR/d32o/tmp
800 TMP_DIR=$DIR/d32o/tmp
801 ln -s $DIR/test_file $TMP_DIR/symlink12
802 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
803 $CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error
804 $CHECKSTAT -t link $DIR/d32o/symlink02 || error
805 $CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error
806 $CHECKSTAT -t file -f $DIR/d32o/symlink02 || error
808 run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/test_file"
814 mkdir -p $DIR/d32p/tmp
815 TMP_DIR=$DIR/d32p/tmp
816 ln -s $DIR/test_file $TMP_DIR/symlink12
817 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
818 cat $DIR/d32p/tmp/symlink12 || error
819 cat $DIR/d32p/symlink02 || error
821 run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/test_file"
824 [ -e $DIR/d32q ] && rm -fr $DIR/d32q
826 mount -t ext2 -o loop $EXT2_DEV $DIR/d32q
827 ls $DIR/d32q || error
828 umount $DIR/d32q || error
830 run_test 32q "ls a mounted file system ========================="
832 # chmod 444 /mnt/lustre/somefile
833 # open(/mnt/lustre/somefile, O_RDWR)
836 rm -f $DIR/test_33_file
837 touch $DIR/test_33_file
838 chmod 444 $DIR/test_33_file
839 chown $RUNAS_ID $DIR/test_33_file
840 $RUNAS $OPENFILE -f O_RDWR $DIR/test_33_file && error || true
842 run_test 33 "write file with mode 444 (should return error) ===="
844 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
846 rm -f $DIR/test_34_file
847 $MCREATE $DIR/test_34_file || error
848 $LFIND $DIR/test_34_file | grep -q "Has no stripe information" || error
849 $TRUNCATE $DIR/test_34_file $TEST_34_SIZE || error
850 $LFIND $DIR/test_34_file | grep -q "Has no stripe information" || error
851 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
853 run_test 34a "truncate file that has not been opened ==========="
856 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
857 $OPENFILE -f O_RDONLY $DIR/test_34_file
858 $LFIND $DIR/test_34_file | grep -q "Has no stripe information" || error
859 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
861 run_test 34b "O_RDONLY opening file doesn't create objects ====="
864 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
865 $OPENFILE -f O_RDWR $DIR/test_34_file
866 $LFIND $DIR/test_34_file | grep -q "Has no stripe information" && error
867 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
869 run_test 34c "O_RDWR opening file-with-size works =============="
872 dd if=/dev/zero of=$DIR/test_34_file conv=notrunc bs=4k count=1 || error
873 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
876 run_test 34d "write to sparse file ============================="
879 rm -f $DIR/test_34_file
880 $MCREATE $DIR/test_34_file || error
881 $TRUNCATE $DIR/test_34_file 1000 || error
882 $CHECKSTAT -s 1000 $DIR/test_34_file || error
883 $OPENFILE -f O_RDWR $DIR/test_34_file
884 $CHECKSTAT -s 1000 $DIR/test_34_file || error
886 run_test 34e "create objects, some with size and some without =="
889 cp /bin/sh $DIR/test_35_file
890 chmod 444 $DIR/test_35_file
891 chown $RUNAS_ID $DIR/test_35_file
892 $DIR/test_35_file && error || true
895 run_test 35 "exec file with mode 444 (should return error) ====="
898 sleep 1 # we need a rest, or UMLs clock becomes skewed
899 rm -f $DIR/test_36_file
900 utime $DIR/test_36_file || error
902 run_test 36a "MDS utime check (mknod, utime) ==================="
906 echo "" > $DIR/test_36_file
907 utime $DIR/test_36_file || error
909 run_test 36b "OST utime check (open, utime) ===================="
913 rm -f $DIR/d36/test_36_file
915 chown $RUNAS_ID $DIR/d36
916 $RUNAS utime $DIR/d36/test_36_file || error
918 run_test 36c "non-root MDS utime check (mknod, utime) =========="
922 echo "" > $DIR/d36/test_36_file
923 $RUNAS utime $DIR/d36/test_36_file || error
925 run_test 36d "non-root OST utime check (open, utime) ==========="
929 [ $RUNAS_ID -eq $UID ] && return
930 touch $DIR/d36/test_36_file2
931 $RUNAS utime $DIR/d36/test_36_file2 && error || true
933 run_test 36e "utime on non-owned file (should return error) ===="
937 echo f > $DIR/dextra/fbugfile
938 mount -t ext2 -o loop $EXT2_DEV $DIR/dextra
939 ls $DIR/dextra | grep "\<fbugfile\>" && error
940 umount $DIR/dextra || error
941 rm -f $DIR/dextra/fbugfile || error
943 run_test 37 "ls a mounted file system to check old content ====="
945 # open(file, O_DIRECTORY) will leak a request and not cleanup (bug 1501)
947 o_directory $DIR/test38
949 run_test 38 "open a regular file with O_DIRECTORY =============="
952 touch $DIR/test_39_file
953 touch $DIR/test_39_file2
954 # ls -l $DIR/test_39_file $DIR/test_39_file2
955 # ls -lu $DIR/test_39_file $DIR/test_39_file2
956 # ls -lc $DIR/test_39_file $DIR/test_39_file2
958 $OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/test_39_file2
959 # ls -l $DIR/test_39_file $DIR/test_39_file2
960 # ls -lu $DIR/test_39_file $DIR/test_39_file2
961 # ls -lc $DIR/test_39_file $DIR/test_39_file2
962 [ $DIR/test_39_file2 -nt $DIR/test_39_file ] || error
964 run_test 39 "mtime changed on create ==========================="
967 dd if=/dev/zero of=$DIR/f40 bs=4096 count=1
968 $RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/f40 && error
969 $CHECKSTAT -t file -s 4096 $DIR/f40 || error
971 run_test 40 "failed open(O_TRUNC) doesn't truncate ============="
975 small_write $DIR/f41 18
977 run_test 41 "test small file write + fstat ====================="
979 # on the LLNL clusters, runas will still pick up root's $TMP settings,
980 # which will not be writable for the runas user, and then you get a CVS
981 # error message with a corrupt path string (CVS bug) and panic.
982 # We're not using much space, so just stick it in /tmp, which is safe.
988 [ $RUNAS_ID -ne $UID ] && HOME=/tmp
991 echo 99 "cvs operations ===================================="
992 mkdir -p $DIR/d99cvsroot
993 chown $RUNAS_ID $DIR/d99cvsroot
994 $RUNAS cvs -d $DIR/d99cvsroot init || error
996 run_test 99a "cvs init ========================================="
1000 $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" d99reposname vtag rtag
1002 run_test 99b "cvs import ======================================="
1006 mkdir -p $DIR/d99reposname
1007 chown $RUNAS_ID $DIR/d99reposname
1008 $RUNAS cvs -d $DIR/d99cvsroot co d99reposname
1010 run_test 99c "cvs checkout ====================================="
1013 cd $DIR/d99reposname
1015 $RUNAS cvs add -m 'addmsg' foo99
1017 run_test 99d "cvs add =========================================="
1020 cd $DIR/d99reposname
1023 run_test 99e "cvs update ======================================="
1026 cd $DIR/d99reposname
1027 $RUNAS cvs commit -m 'nomsg' foo99
1029 run_test 99f "cvs commit ======================================="
1035 log "cleanup: ======================================================"
1036 rm -rf $DIR/[Rdfs][1-9]*
1037 if [ "$I_MOUNTED" = "yes" ]; then
1038 sh llmountcleanup.sh || error
1041 echo '=========================== finished ==============================='