3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
10 ALWAYS_EXCEPT="$SANITY_DOM_EXCEPT"
11 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
12 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
14 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
16 . $LUSTRE/tests/test-framework.sh
20 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
23 MULTIOP=${MULTIOP:-multiop}
24 OPENFILE=${OPENFILE:-openfile}
25 MOUNT_2=${MOUNT_2:-"yes"}
28 check_and_setup_lustre
30 # $RUNAS_ID may get set incorrectly somewhere else
31 if [[ $UID -eq 0 && $RUNAS_ID -eq 0 ]]; then
32 skip_env "\$RUNAS_ID set to 0, but \$UID is also 0!" && exit
34 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
39 DOM_SIZE=${DOM_SIZE:-"$((1024*1024))"}
42 lfs setstripe -E $DOM_SIZE -L mdt -E EOF $DIR1
47 lctl set_param debug=0xffffffff 2> /dev/null
50 dd if=/dev/zero of=$DIR1/$tfile bs=7k count=1 || error "write 1"
51 $TRUNCATE $DIR2/$tfile 1000 || error "truncate"
52 dd if=/dev/zero of=$DIR1/$tfile bs=3k count=1 seek=1 || error "write 2"
53 $CHECKSTAT -t file -s 6144 $DIR2/$tfile || error "stat"
56 run_test 1 "write a file on one mount, truncate on the other, write again"
60 dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 seek=4 || return 1
61 dd if=/dev/zero bs=$SZ1 count=1 >> $DIR/$tfile || return 2
62 dd if=$DIR/$tfile of=$DIR/${tfile}_left bs=1M skip=5 || return 3
63 $CHECKSTAT -t file -s $SZ1 $DIR/${tfile}_left ||
64 error "Error reading at the end of the file $tfile"
66 run_test 2 "Write with a seek, append, read from a single mountpoint"
69 # Write on one node to the DoM stripe and then truncate to over DoM size
70 dd if=/dev/zero of=$DIR1/$tfile bs=$((DOM_SIZE-100)) count=1 ||
72 truncate $DIR1/$tfile $((DOM_SIZE+700)) || return 2
73 # read on the second node inside DoM stripe to take a lock data from
75 dd if=$DIR2/$tfile of=/dev/null bs=4096 count=1 seek=1 || return 3
76 $CHECKSTAT -t file -s $((DOM_SIZE+700)) $DIR2/$tfile ||
77 error "Wrong size after first truncate $tfile on first node"
78 # now do local truncate over DoM size and check size is correct
79 truncate $DIR2/$tfile $((DOM_SIZE+500)) || return 4
80 $CHECKSTAT -t file -s $((DOM_SIZE+500)) $DIR2/$tfile ||
81 error "Wrong size after second truncate on the same node"
82 $CHECKSTAT -t file -s $((DOM_SIZE+500)) $DIR1/$tfile ||
83 error "Wrong size after second truncate on other node"
85 run_test 3 "Truncate over DoM size on different nodes"
88 local file1=$DIR1/$tfile
89 local file2=$DIR2/$tfile
92 fsx -c 50 -p 100 -N 1000 -l $((DOM_SIZE*2)) -S 0 -d -d $file1 $file2
94 run_test fsx "Dual-mount fsx with DoM files"
100 [ ! -f sanity.sh ] && skip_env "No sanity.sh skipping" && return
102 ONLY="36 39 40 41 42 43 46 56r 101e 119a 131 150 155a 155b 155c \
103 155d 207 241 251" OSC="mdc" DOM="yes" sh sanity.sh
106 run_test sanity "Run sanity with Data-on-MDT files"
110 local SAVE_ONLY=$ONLY
112 [ ! -f sanity.sh ] && skip_env "No sanity.sh skipping" && return
114 ONLY="1 2 4 5 6 7 8 9 10 11 12 14 17 19 20 23 27 39 51a 51c 51d" \
115 OSC="mdc" DOM="yes" sh sanityn.sh
118 run_test sanityn "Run sanityn with Data-on-MDT files"
121 check_and_cleanup_lustre