generic/563: use a loop device to avoid partition incompatibility
[xfstests-dev.git] / tests / cifs / 001
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. cifs/001
6 #
7 # Sanity test for server-side copies initiated via CIFS_IOC_COPYCHUNK_FILE
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
17 _cleanup()
18 {
19         rm -f $tmp.*
20         rm -rf $TEST_DIR/$$
21 }
22
23 trap "_cleanup ; exit \$status" 0 1 2 3 15
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # real QA test starts here
30 _supported_fs cifs
31 _require_cloner
32 _require_test
33
34 mkdir -p $TEST_DIR/$$/src || _fail "failed to create clone src dir"
35 mkdir -p $TEST_DIR/$$/dest || _fail "failed to create clone dest dir"
36
37 # populate 10 files, 1K-10K in size
38 for i in `seq 1 10`; do
39         len=$(($i * 1024))
40         $XFS_IO_PROG -f -c "pwrite -S $i 0 $len" $TEST_DIR/$$/src/${i} \
41                 | _filter_xfs_io
42 done
43 sync
44
45 # clone each, then compare both versions
46 for i in `seq 1 10`; do
47         $CLONER_PROG $TEST_DIR/$$/src/${i} $TEST_DIR/$$/dest/${i}
48         diff $TEST_DIR/$$/src/${i} $TEST_DIR/$$/dest/${i}
49 done
50
51 status=0
52 exit