xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 332
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 332
6 #
7 # Test AIO CoW behavior.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -rf $tmp.* $TEST_DIR/moo
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/reflink
28
29 # real QA test starts here
30 _supported_os Linux
31 _require_scratch_reflink
32 _require_cp_reflink
33 _require_aiodio "aiocp"
34 AIO_TEST="$here/src/aio-dio-regress/aiocp"
35
36 rm -f $seqres.full
37
38
39 echo "Format and mount"
40 _scratch_mkfs > $seqres.full 2>&1
41 _scratch_mount >> $seqres.full 2>&1
42
43 testdir=$SCRATCH_MNT/test-$seq
44 mkdir $testdir
45
46 blksz=65536
47 nr=640
48 bufnr=128
49 filesize=$((blksz * nr))
50 bufsize=$((blksz * bufnr))
51
52 _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
53
54 echo "Create the original files"
55 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $filesize" $testdir/file1 >> $seqres.full
56 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
57 _scratch_cycle_mount
58
59 echo "Compare files"
60 md5sum $testdir/file1 | _filter_scratch
61 md5sum $testdir/file2 | _filter_scratch
62
63 echo "CoW and unmount"
64 $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
65 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
66 sync
67 $AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
68 _scratch_cycle_mount
69
70 echo "Compare files"
71 md5sum $testdir/file1 | _filter_scratch
72 md5sum $testdir/file2 | _filter_scratch
73
74 echo "Check for damage"
75 umount $SCRATCH_MNT
76 _repair_scratch_fs >> $seqres.full
77
78 # success, all done
79 status=0
80 exit