2 # FS QA Test No. btrfs/035
4 # Regression test for overwriting clones
6 #-----------------------------------------------------------------------
7 # Copyright (C) 2014 SUSE Linux Products GmbH. 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
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
38 trap "_cleanup ; exit \$status" 0 1 2 3 15
40 # get standard environment, filters and checks
44 # real QA test starts here
50 _scratch_mkfs > /dev/null 2>&1
55 echo -n "$src_str" > $SCRATCH_MNT/src
57 $CLONER_PROG $SCRATCH_MNT/src $SCRATCH_MNT/src.clone1
59 src_str="bbbbbbbbbbcccccccccc"
61 echo -n "$src_str" > $SCRATCH_MNT/src
63 $CLONER_PROG $SCRATCH_MNT/src $SCRATCH_MNT/src.clone2
65 snap_src_sz=`ls -lah $SCRATCH_MNT/src.clone1 | awk '{print $5}'`
66 echo "attempting ioctl (src.clone1 src)"
67 $CLONER_PROG -s 0 -d 0 -l ${snap_src_sz} \
68 $SCRATCH_MNT/src.clone1 $SCRATCH_MNT/src
70 snap_src_sz=`ls -lah $SCRATCH_MNT/src.clone2 | awk '{print $5}'`
71 echo "attempting ioctl (src.clone2 src)"
72 $CLONER_PROG -s 0 -d 0 -l ${snap_src_sz} \
73 $SCRATCH_MNT/src.clone2 $SCRATCH_MNT/src