generic/402: Drop useless fail message
[xfstests-dev.git] / tests / generic / 407
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Christoph Hellwig.  All Rights Reserved.
4 #
5 # FS QA Test No. 407
6 #
7 # Verify that mtime is updated when cloning files
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 status=0
15 trap "_cleanup; exit \$status" 0 1 2 3 15
16
17 _cleanup()
18 {
19         cd /
20         rm -f $sourcefile
21         rm -f $destfile
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_fs generic
31
32 _require_test
33 _require_test_reflink
34
35 echo "Silence is golden."
36 rm -f $seqres.full
37
38 # pattern the files.
39 sourcefile=$TEST_DIR/clone_mtime_sourcefile
40 $XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
41
42 destfile=$TEST_DIR/clone_mtime_destfile
43 touch $destfile >> $seqres.full
44
45 # sample timestamps.
46 mtime1=`stat -c %Y $destfile`
47 ctime1=`stat -c %Z $destfile`
48 echo "before clone: $mtime1 $ctime1" >> $seqres.full
49
50 # clone to trigger timestamp change
51 sleep 1
52 $XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
53
54 # sample and verify that timestamps have changed.
55 mtime2=`stat -c %Y $destfile`
56 ctime2=`stat -c %Z $destfile`
57 echo "after clone : $mtime2 $ctime2" >> $seqres.full
58
59 if [ "$mtime1" == "$mtime2" ]; then
60         echo "mtime not updated"
61         let status=$status+1
62 fi
63 if [ "$ctime1" == "$ctime2" ]; then
64         echo "ctime not updated"
65         let status=$status+1
66 fi
67
68 exit