2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Facebook. All Rights Reserved.
7 # Run fsx with log writes to verify power fail safeness.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
14 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
22 # get standard environment, filters and checks
25 . ./common/dmlogwrites
27 # real QA test starts here
31 _require_scratch_nocheck
40 # Now look for our files
41 for i in $(find $SANITY_DIR -type f | grep $name | grep mark); do
42 local filename=$(basename $i)
43 local mark="${filename##*.}"
44 echo "checking $filename" >> $seqres.full
45 _log_writes_replay_log $filename $SCRATCH_DEV
47 local expected_md5=$(_md5_checksum $i)
48 local md5=$(_md5_checksum $SCRATCH_MNT/$name)
49 [ "${md5}" != "${expected_md5}" ] && _fail "$filename md5sum mismatched"
55 SANITY_DIR=$TEST_DIR/fsxtests
60 _log_writes_init $SCRATCH_DEV
62 _log_writes_mkfs >> $seqres.full 2>&1
64 # Log writes emulates discard support, turn it on for maximum crying.
65 _log_writes_mount -o discard
69 FSX_OPTS="-N $NUM_OPS -d -P $SANITY_DIR -i $LOGWRITES_DMDEV"
70 # Set random seeds for fsx runs (0 for timestamp + pid)
71 # When test failure is detected, check the seed values printed
72 # by fsx processes to $seqres.full and set them in this array
73 # to repeat the same fsx runs
76 for j in `seq 0 $((NUM_FILES-1))`; do
77 run_check $here/ltp/fsx $FSX_OPTS -S ${seeds[$j]} -j $j $SCRATCH_MNT/testfile$j &
82 for j in `seq 0 $((NUM_FILES-1))`; do
83 test_md5[$j]=$(_md5_checksum $SCRATCH_MNT/testfile$j)
86 # Unmount the scratch dir and tear down the log writes target
94 echo "checking pre umount" >> $seqres.full
95 _log_writes_replay_log last $SCRATCH_DEV
100 for j in `seq 0 $((NUM_FILES-1))`; do
101 check_files testfile$j
105 echo "checking post umount" >> $seqres.full
106 _log_writes_replay_log end $SCRATCH_DEV
108 for j in `seq 0 $((NUM_FILES-1))`; do
109 md5=$(_md5_checksum $SCRATCH_MNT/testfile$j)
110 [ "${md5}" != "${test_md5[$j]}" ] && _fail "testfile$j end md5sum mismatched"
115 echo "Silence is golden"