Whamcloud - gitweb
LU-10496 tests: disable 39k for DoM for a while
[fs/lustre-release.git] / lustre / tests / sanity-dom.sh
1 #!/bin/bash
2 #
3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
5 #
6
7 set -e
8
9 ONLY=${ONLY:-"$*"}
10 # bug number for skipped test:
11 ALWAYS_EXCEPT="$SANITY_DOM_EXCEPT"
12 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
13 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
14
15 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
16 # bug number for skipped test:
17         ALWAYS_EXCEPT+=""
18         if [ $MDSCOUNT -gt 1 ]; then
19 # bug number for skipped test:
20                 ALWAYS_EXCEPT+=""
21         fi
22 fi
23
24 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
25
26 . $LUSTRE/tests/test-framework.sh
27 CLEANUP=${CLEANUP:-:}
28 SETUP=${SETUP:-:}
29 init_test_env $@
30 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
31 init_logging
32
33 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
34         { skip "Need MDS version at least 2.10.56"; exit 0; }
35
36 MULTIOP=${MULTIOP:-multiop}
37 OPENFILE=${OPENFILE:-openfile}
38 MOUNT_2=${MOUNT_2:-"yes"}
39 FAIL_ON_ERROR=false
40
41 check_and_setup_lustre
42
43 # $RUNAS_ID may get set incorrectly somewhere else
44 if [[ $UID -eq 0 && $RUNAS_ID -eq 0 ]]; then
45         skip_env "\$RUNAS_ID set to 0, but \$UID is also 0!" && exit
46 fi
47 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
48
49 build_test_filter
50
51 DOM="yes"
52 DOM_SIZE=${DOM_SIZE:-"$((1024*1024))"}
53 OSC="mdc"
54
55 save_layout_restore_at_exit $DIR1
56 $LFS setstripe -E $DOM_SIZE -L mdt -E EOF $DIR1
57
58 mkdir -p $MOUNT2
59 mount_client $MOUNT2
60
61 test_1() {
62         dd if=/dev/zero of=$DIR1/$tfile bs=7k count=1 || error "write 1"
63         $TRUNCATE $DIR2/$tfile 1000 || error "truncate"
64         dd if=/dev/zero of=$DIR1/$tfile bs=3k count=1 seek=1 || error "write 2"
65         $CHECKSTAT -t file -s 6144 $DIR2/$tfile || error "stat"
66         rm $DIR1/$tfile
67 }
68 run_test 1 "write a file on one mount, truncate on the other, write again"
69
70 test_2() {
71         SZ1=234852
72         dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 seek=4 || return 1
73         dd if=/dev/zero bs=$SZ1 count=1 >> $DIR/$tfile || return 2
74         dd if=$DIR/$tfile of=$DIR/${tfile}_left bs=1M skip=5 || return 3
75         $CHECKSTAT -t file -s $SZ1 $DIR/${tfile}_left ||
76                 error "Error reading at the end of the file $tfile"
77 }
78 run_test 2 "Write with a seek, append, read from a single mountpoint"
79
80 test_3() {
81         # Write on one node to the DoM stripe and then truncate to over DoM size
82         dd if=/dev/zero of=$DIR1/$tfile bs=$((DOM_SIZE-100)) count=1 ||
83                 return 1
84         truncate $DIR1/$tfile $((DOM_SIZE+700)) || return 2
85         # read on the second node inside DoM stripe to take a lock data from
86         # the first client
87         dd if=$DIR2/$tfile of=/dev/null bs=4096 count=1 seek=1 || return 3
88         $CHECKSTAT -t file -s $((DOM_SIZE+700)) $DIR2/$tfile ||
89                 error "Wrong size after first truncate $tfile on first node"
90         # now do local truncate over DoM size and check size is correct
91         truncate $DIR2/$tfile $((DOM_SIZE+500)) || return 4
92         $CHECKSTAT -t file -s $((DOM_SIZE+500)) $DIR2/$tfile ||
93                 error "Wrong size after second truncate on the same node"
94         $CHECKSTAT -t file -s $((DOM_SIZE+500)) $DIR1/$tfile ||
95                 error "Wrong size after second truncate on other node"
96 }
97 run_test 3 "Truncate over DoM size on different nodes"
98
99 test_fsx() {
100         local file1=$DIR1/$tfile
101         local file2=$DIR2/$tfile
102
103         touch $file1
104         fsx -c 50 -p 100 -N 1000 -l $((DOM_SIZE*2)) -S 0 -d -d $file1 $file2
105 }
106 run_test fsx "Dual-mount fsx with DoM files"
107
108 test_sanity()
109 {
110         # XXX: to fix 45. Add 42a, c when LU-9693 fixed.
111         # Add 42b when LU-6493 fixed
112         # Enable 39k when LU-10496 fixed
113         ONLY="36 39 40 41 42d 42e 43 46 56r 101e 119a 131 150 155a 155b 155c \
114                 155d 207 241 251" \
115                 EXCEPT=39k OSC="mdc" DOM="yes" bash sanity.sh
116 }
117 run_test sanity "Run sanity with Data-on-MDT files"
118
119 test_sanityn()
120 {
121         # XXX: to fix 60
122         ONLY="1 2 4 5 6 7 8 9 10 11 12 14 17 19 20 23 27 39 51a 51c 51d" \
123                 OSC="mdc" DOM="yes" bash sanityn.sh
124 }
125 run_test sanityn "Run sanityn with Data-on-MDT files"
126
127 complete $SECONDS
128 check_and_cleanup_lustre
129 exit_status