generic: test for creating duplicate filenames in encrypted dir
[xfstests-dev.git] / tests / generic / 192
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 192
6 #
7 # Simple test of atime
8 # - ensure it is persistent after unmount
9 # - check updated time by correct amount
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "exit \$status" 0 1 2 3 15
19
20 _access_time()
21 {
22         stat -c %X $1
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # real QA test starts here
30
31 _supported_fs generic
32 _require_test
33 _require_atime
34 delay=5
35
36 testfile=$TEST_DIR/testfile
37 rm -f $testfile
38 rm -f $seqres.full
39
40 echo test >$testfile
41 time1=`_access_time $testfile | tee -a $seqres.full`
42
43 echo "sleep for $delay seconds"
44 sleep $delay # sleep to allow time to move on for access
45 cat $testfile
46 time2=`_access_time $testfile | tee -a $seqres.full`
47
48 cd /
49 _test_cycle_mount
50 time3=`_access_time $testfile | tee -a $seqres.full`
51
52 delta1=`expr $time2 - $time1`
53 delta2=`expr $time3 - $time1`
54
55 # tolerate an atime up to 2s later than the ideal case
56 _within_tolerance "delta1" $delta1 $delay  0 2 -v
57 _within_tolerance "delta2" $delta2 $delta1 0 0 -v
58
59 # success, all done
60 status=0
61 exit