4 # Run fsx with log writes to verify power fail safeness.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2015 Facebook. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
29 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
40 . ./common/dmlogwrites
42 # real QA test starts here
46 _require_scratch_nocheck
55 # Now look for our files
56 for i in $(find $SANITY_DIR -type f | grep $name | grep mark); do
57 local filename=$(basename $i)
58 local mark="${filename##*.}"
59 echo "checking $filename" >> $seqres.full
60 _log_writes_replay_log $filename
62 local expected_md5=$(_md5_checksum $i)
63 local md5=$(_md5_checksum $SCRATCH_MNT/$name)
64 [ "${md5}" != "${expected_md5}" ] && _fail "$filename md5sum mismatched"
70 SANITY_DIR=$TEST_DIR/fsxtests
77 _log_writes_mkfs >> $seqres.full 2>&1
79 # Log writes emulates discard support, turn it on for maximum crying.
80 _log_writes_mount -o discard
84 FSX_OPTS="-N $NUM_OPS -d -P $SANITY_DIR -i $LOGWRITES_DMDEV"
85 # Set random seeds for fsx runs (0 for timestamp + pid)
86 # When test failure is detected, check the seed values printed
87 # by fsx processes to $seqres.full and set them in this array
88 # to repeat the same fsx runs
91 for j in `seq 0 $((NUM_FILES-1))`; do
92 run_check $here/ltp/fsx $FSX_OPTS -S ${seeds[$j]} -j $j $SCRATCH_MNT/testfile$j &
97 for j in `seq 0 $((NUM_FILES-1))`; do
98 test_md5[$j]=$(_md5_checksum $SCRATCH_MNT/testfile$j)
101 # Unmount the scratch dir and tear down the log writes target
102 _log_writes_mark last
109 echo "checking pre umount" >> $seqres.full
110 _log_writes_replay_log last
115 for j in `seq 0 $((NUM_FILES-1))`; do
116 check_files testfile$j
120 echo "checking post umount" >> $seqres.full
121 _log_writes_replay_log end
123 for j in `seq 0 $((NUM_FILES-1))`; do
124 md5=$(_md5_checksum $SCRATCH_MNT/testfile$j)
125 [ "${md5}" != "${test_md5[$j]}" ] && _fail "testfile$j end md5sum mismatched"
130 echo "Silence is golden"