2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Oracle, Inc. All Rights Reserved.
7 # Test for race between dedupe and writing the dest file
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 7 15
21 rm -rf $tmp.* $finished_file
25 # get standard environment, filters and checks
30 # real QA test starts here
31 _require_scratch_dedupe
33 echo "Format and mount"
34 _scratch_mkfs > $seqres.full 2>&1
35 _scratch_mount >> $seqres.full 2>&1
37 testdir=$SCRATCH_MNT/test-$seq
38 finished_file=/tmp/finished
43 nr_loops=$((loops - 1))
46 echo "Initialize files"
48 _pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
49 _pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
53 while [ ! -e $finished_file ]; do
54 seq $nr_loops -1 0 | while read i; do
55 _pwrite_byte 0x61 $((i * blksz)) $blksz $testdir/file2 >> $seqres.full
60 echo "Dedupe and rewrite the file!"
62 for i in `seq 1 2`; do
63 seq $nr_loops -1 0 | while read i; do
64 _dedupe_range $testdir/file1 $((i * blksz)) \
65 $testdir/file2 $((i * blksz)) $blksz >> $seqres.full
69 echo "Finished dedupeing"